From a41bfa10a0336526f6af7dc19478b949baa83479 Mon Sep 17 00:00:00 2001 From: Yoann Congal Date: Sat, 11 Oct 2025 01:11:10 +0200 Subject: [PATCH] oeqa/selftest/buildoptions: Fix test_yocto_source_mirror MIRRORS & PREMIRRORS definitions Currently, the definitions of MIRRORS and PREMIRRORS made by test_yocto_source_mirror() are overwritten when run on the autobuilder: * MIRRORS = "" is extended by mirrors.bbclass to its usual value. * PREMIRRORS = "* dl.yp.org" is overwritten by the autobuilder.conf config fragment to "" Simplified variable history: # $MIRRORS [4 operations] # set .../contribution-yocto/builds/build-qemux86-64-st/conf/selftest.inc:3 # "" # append .../contribution-yocto/builds/build-qemux86-64-st/../../layers/poky/meta/classes-global/mirrors.bbclass:57 # "${DEBIAN_MIRROR} ..." MIRRORS=" http://deb.debian.org/debian/pool ..." # $PREMIRRORS [4 operations] # set .../contribution-yocto/builds/build-qemux86-64-st/conf/selftest.inc:18 # " bzr://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \n ..." # set .../contribution-yocto/builds/build-qemux86-64-st/../../layers/poky/meta/conf/fragments/yocto-autobuilder/autobuilder.conf:6 # "" # append .../contribution-yocto/builds/build-qemux86-64-st/../../layers/poky/meta/classes-global/mirrors.bbclass:84 # "git://sourceware.org/git/glibc.git https://downloads.yoctoproject.org/mirror/sources/ ..." PREMIRRORS=" git://sourceware.org/git/glibc.git https://downloads.yoctoproject.org/mirror/sources/ ..." Despite this unexpected configuration, the test passes because after failing to find a PREMIRROR (empty), failing to download the normal SRC_URI (because of BB_ALLOWED_NETWORKS), the fetcher tries the MIRRORS which have by default download.yoctoproject.org. For example, on a failed meta-oe-mirror test[0], we can see a lot of warnings: "stdio: WARNING: ... do_fetch: Failed to fetch URL https://... attempting MIRRORS if available" By using the ":forcevariable" override, test_yocto_source_mirror() makes sure the correct value is set for MIRRORS and PREMIRRORS (whatever is the configuration). Simplified variable history (after the fix): # $MIRRORS [4 operations] # append .../contribution-yocto/builds/build-qemux86-64-st/../../layers/poky/meta/classes-global/mirrors.bbclass:57 # "${DEBIAN_MIRROR} ..." # append .../contribution-yocto/builds/build-qemux86-64-st/../../layers/poky/meta/classes-global/mirrors.bbclass:68 # "git://salsa.debian.org/.* ..." # override[forcevariable]:set .../contribution-yocto/builds/build-qemux86-64-st/conf/selftest.inc:3 # "" MIRRORS="" # $PREMIRRORS [4 operations] # set .../contribution-yocto/builds/build-qemux86-64-st/../../layers/poky/meta/conf/fragments/yocto-autobuilder/autobuilder.conf:6 # "" # append .../contribution-yocto/builds/build-qemux86-64-st/../../layers/poky/meta/classes-global/mirrors.bbclass:84 # "git://sourceware.org/git/glibc.git ..." # override[forcevariable]:set .../contribution-yocto/builds/build-qemux86-64-st/conf/selftest.inc:18 # " bzr://.*/.* http://downloads.yoctoproject.org/mirror/sources/ ..." # pre-expansion value: # " bzr://.*/.* http://downloads.yoctoproject.org/mirror/sources/ ..." PREMIRRORS=" bzr://.*/.* http://downloads.yoctoproject.org/mirror/sources/ ..." [0]: https://autobuilder.yoctoproject.org/valkyrie/#/builders/82/builds/470/steps/17/logs/warnings Fixes [YOCTO #15993] (From OE-Core rev: ab810d1239d4db0bc0f23db31c70cc9c6e59357e) Signed-off-by: Yoann Congal Signed-off-by: Mathieu Dubois-Briand Signed-off-by: Richard Purdie --- meta/lib/oeqa/selftest/cases/buildoptions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meta/lib/oeqa/selftest/cases/buildoptions.py b/meta/lib/oeqa/selftest/cases/buildoptions.py index 767e19bd88..b46f55e256 100644 --- a/meta/lib/oeqa/selftest/cases/buildoptions.py +++ b/meta/lib/oeqa/selftest/cases/buildoptions.py @@ -173,11 +173,11 @@ class SourceMirroring(OESelftestTestCase): def test_yocto_source_mirror(self): self.write_config(""" BB_ALLOWED_NETWORKS = "downloads.yoctoproject.org" -MIRRORS = "" +MIRRORS:forcevariable = "" DL_DIR = "${TMPDIR}/test_downloads" STAMPS_DIR = "${TMPDIR}/test_stamps" SSTATE_DIR = "${TMPDIR}/test_sstate-cache" -PREMIRRORS = "\\ +PREMIRRORS:forcevariable = "\\ bzr://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \\n \\ cvs://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \\n \\ git://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \\n \\