sanity: add check for own-mirrors/SOURCE_MIRROR_URL
PATCH v2 1/1 sanity: add check for own-mirrors/SOURCE_MIRROR_URL
From: Corentin Guillevic <[email protected]>
The SOURCE_MIRROR_URL variable belongs to the own-mirrors class. However, the user may forget to define it. This will cause the class to inject incorrect content into PREMIRRORS, resulting in the following error:
ERROR: gettext-minimal-native-1.0-r0 do_fetch: Bitbake Fetcher Error: MalformedUrl('${SOURCE_MIRROR_URL}')
ERROR: Logfile of failure stored in: /path/to/tmp/work/x86_64-linux/gettext-minimal-native/1.0/temp/log.do_fetch.258066
ERROR: Task (/path/to/layers/poky/meta/recipes-core/gettext/gettext-minimal-native_1.0.bb:do_fetch) failed with exit code '1'
Add a check to the sanity class, to detect this case and raise an error.
---
Notes:
Changes in v2:
- Use addresult() / oe.utils.inherits() instead of bb.fatal() / inheritlist.split()
meta/classes-global/sanity.bbclass | 5 +++++ 1 file changed, 5 insertions(+)
meta/classes-global/sanity.bbclass +5 -0
@@ -984,6 +984,11 @@ def check_sanity_everybuild(status, d): "Please set TMPDIR to a clean path with no trailing slash or " "consecutive slashes (e.g. %s).\n" % (tmpdir, os.path.normpath(tmpdir))) + # Check whether the SOURCE_MIRROR_URL variable, belonging to the 'own-mirrors' class, is defined + inheritlist = d.getVar('INHERIT') + if oe.utils.inherits(d, 'own-mirrors') and not d.getVar('SOURCE_MIRROR_URL'): + status.addresult("own-mirrors is enabled, but SOURCE_MIRROR_URL is not defined") + # Check the format of MIRRORS, PREMIRRORS and SSTATE_MIRRORS import re mirror_vars = ['MIRRORS', 'PREMIRRORS', 'SSTATE_MIRRORS']
Signature · 1 line
2.51.0
Hi,
Quoted 27 lines · Corentin Guillevic via lists.openembedded.org
From: Corentin Guillevic <[email protected]>
The
SOURCE_MIRROR_URLvariable belongs to the own-mirrors class. However, the user may forget to define it. This will cause the class to inject incorrect content into PREMIRRORS, resulting in the following error:ERROR: gettext-minimal-native-1.0-r0
do_fetch: Bitbake Fetcher Error:MalformedUrl('${SOURCE_MIRROR_URL}')
ERROR: Logfile of failure stored in: /path/to/tmp/work/x86_64-linux/gettext-minimal-native/1.0/temp/log.do_fetch.258066
ERROR: Task (/path/to/layers/poky/meta/recipes-core/gettext/gettext-minimal-native_1.0.bb:do_fetch) failed with exit code '1'Add a check to the sanity class, to detect this case and raise an error.
Signed-off-by Corentin Guillevic <[email protected]>---
Notes:
Changes in v2:
- Useaddresult()/oe.utils.inherits()instead ofbb.fatal()/inheritlist.split()meta/classes-global/sanity.bbclass | 5 +++++ 1 file changed, 5 insertions(+)meta/classes-global/sanity.bbclass +0
-0
meta/classes-global/sanity.bbclass def check_sanity_everybuild(status, d): · line 988
Quoted 5 lines
meta/classes-global/sanity.bbclass +2
-0@@ -984,6 +984,11 @@ def check_sanity_everybuild(status, d): "Please set TMPDIR to a clean path with no trailing slash or " "consecutive slashes (e.g. %s).\n" % (tmpdir, os.path.normpath(tmpdir))) + # Check whether the SOURCE_MIRROR_URL variable, belonging to the 'own-mirrors' class, is defined + inheritlist = d.getVar('INHERIT')
This variable isn't used afterwards, you can remove it
meta/classes-global/sanity.bbclass def check_sanity_everybuild(status, d): · line 994
Quoted 6 lines
meta/classes-global/sanity.bbclass +3
-0+ if oe.utils.inherits(d, 'own-mirrors') and not d.getVar('SOURCE_MIRROR_URL'): + status.addresult("own-mirrors is enabled, but SOURCE_MIRROR_URL is not defined") + # Check the format of MIRRORS, PREMIRRORS and SSTATE_MIRRORS import re mirror_vars = ['MIRRORS', 'PREMIRRORS', 'SSTATE_MIRRORS']
Antonin
Hi Antonin,
My bad, I forgot to remove it... Will send a v3 shortly
Corentin
Le lun. 20 avr. 2026 à 15:48, Antonin Godard <[email protected]> a écrit :
Quoted 62 lines
Hi,
Quoted 3 lines · Corentin Guillevic via lists.openembedded.org
From: Corentin Guillevic <[email protected]>
The
SOURCE_MIRROR_URLvariable belongs to the own-mirrors class.However, the
Quoted 1 line
user may forget to define it. This will cause the class to inject
incorrect
Quoted 3 lines
content into PREMIRRORS, resulting in the following error:
ERROR: gettext-minimal-native-1.0-r0
do_fetch: Bitbake Fetcher Error:
MalformedUrl('${SOURCE_MIRROR_URL}')Quoted 1 line
ERROR: Logfile of failure stored in:
/path/to/tmp/work/x86_64-linux/gettext-minimal-native/1.0/temp/log.do_fetch.258066
Quoted 1 line
ERROR: Task
(/path/to/layers/poky/meta/recipes-core/gettext/gettext-minimal-native_1.0.bb:do_fetch) failed with exit code '1'
Quoted 9 lines
Add a check to the sanity class, to detect this case and raise an error.
Signed-off-by Corentin Guillevic <[email protected]>---
Notes:
Changes in v2:
- Useaddresult()/oe.utils.inherits()instead ofbb.fatal()/
inheritlist.split()Review
Quoted 5 lines
meta/classes-global/sanity.bbclass | 5 +++++ 1 file changed, 5 insertions(+)(quoted diff) +0
-0b/meta/classes-global/sanity.bbclass
meta/classes-global/sanity.bbclass def check_sanity_everybuild(status, d): · line 984
Quoted 5 lines
index
1a490f8d61..cd2cfa9a62100644meta/classes-global/sanity.bbclass +0
-0@@ -984,6 +984,11 @@ def check_sanity_everybuild(status, d): "Please set TMPDIR to a clean path with no trailing slashor "
meta/classes-global/sanity.bbclass def check_sanity_everybuild(status, d): · line 985
Quoted 1 line
meta/classes-global/sanity.bbclass +0
-0"consecutive slashes (e.g. %s).\n" % (tmpdir,
os.path.normpath(tmpdir)))meta/classes-global/sanity.bbclass def check_sanity_everybuild(status, d): · line 986
Quoted 2 lines
meta/classes-global/sanity.bbclass +1
-0+ # Check whether the SOURCE_MIRROR_URL variable, belonging to the'own-mirrors' class, is defined
meta/classes-global/sanity.bbclass def check_sanity_everybuild(status, d): · line 988
Quoted 1 line
meta/classes-global/sanity.bbclass +1
-0+ inheritlist = d.getVar('INHERIT')This variable isn't used afterwards, you can remove it
meta/classes-global/sanity.bbclass def check_sanity_everybuild(status, d): · line 988
Quoted 1 line
meta/classes-global/sanity.bbclass +1
-0+ if oe.utils.inherits(d, 'own-mirrors') and not
d.getVar('SOURCE_MIRROR_URL'):meta/classes-global/sanity.bbclass def check_sanity_everybuild(status, d): · line 989
Quoted 1 line
meta/classes-global/sanity.bbclass +1
-0+ status.addresult("own-mirrors is enabled, but SOURCE_MIRROR_URLis not defined")
meta/classes-global/sanity.bbclass def check_sanity_everybuild(status, d): · line 994
Quoted 4 lines
meta/classes-global/sanity.bbclass +1
-0+ # Check the format of MIRRORS, PREMIRRORS and SSTATE_MIRRORS import re mirror_vars = ['MIRRORS', 'PREMIRRORS', 'SSTATE_MIRRORS']Antonin