Skip to contentSkip to conversation

[2.18][PATCH 0/6] Patch review

bitbake Yoann Congal 1 participant 7 messages Jun 10

lore
Share & tools
lore
#0 lore raw

Please review this set of changes for 2.18/wrynose and have comments back by end of day Friday, June 12.

Passed a-full on autobuilder:
https://autobuilder.yoctoproject.org/valkyrie/?#/builders/29/builds/3963

The following changes since commit 294074e65f37822a0f31bb11eb968d311b54a66a:

toaster: use https for clones, remove cgit in links in defaults (2026-06-06 01:17:50 +0200)

are available in the Git repository at:

https://git.openembedded.org/bitbake-contrib stable/2.18-nut
https://git.openembedded.org/bitbake-contrib/log/?h=stable/2.18-nut

for you to fetch changes up to 52b3bff42f17933595af48654098b172ea10baff:

fetch2: allow empty value for params while formatting URI string. (2026-06-10 14:11:31 +0200)

----------------------------------------------------------------

Anthony Squires (1):
fetch2: reraise IOError during download

João Marcos Costa (1):
layerindexlib: restapi.py: fix unbound variable

Marcio Henriques (1):
bitbake: fix issue with varflag exclusion

Thomas Perrot (2):
fetch2/crate: skip yanked versions when reading cargo index fetch2/crate: guard against empty version list

hongxu (1):
fetch2: allow empty value for params while formatting URI string.

 lib/bb/data.py               | 2 +-
 lib/bb/fetch2/__init__.py    | 8 ++++++--
 lib/bb/fetch2/crate.py       | 7 ++++---
 lib/bb/tests/fetch.py        | 6 +++---
 lib/layerindexlib/restapi.py | 2 +-
 5 files changed, 15 insertions(+), 10 deletions(-)
#1 lore raw

[bitbake][wrynose][2.18][PATCH 6/6] fetch2: allow empty value for params while formatting URI string.

From: hongxu <[email protected]>

While using PREMIRRORS to gets source code, recipe sbom-cve-check-update-nvd-native do fetch failed:

$ bitbake sbom-cve-check-update-nvd-native  -cfetch -f
...
ERROR: sbom-cve-check-update-nvd-native-1.0-r0 do_fetch: Bitbake Fetcher Error: MalformedUrl('git:///path-to-premirror/git/github.com.fkie-cad.nvd-json-data-feeds.git;branch=main;protocol=file;destsuffix')
ERROR: Logfile of failure stored in: tmp/work/x86_64-linux/sbom-cve-check-update-nvd-native/1.0/temp/log.do_fetch.4135595
ERROR: Task (oe-core/meta/recipes-devtools/sbom-cve-check/sbom-cve-check-update-nvd-native.bb:do_fetch) failed with exit code '1'
...

In oe-core commit [1], destsuffix was configured to empty string through SRC_URI, but in bitbake commit [2], it removed `=' from destsuffix in which value is empty, and trigger MalformedUrl failure, see sbom-cve-check-update-nvd-native do_fetch log:

...log.do_fetch...
DEBUG: For url git://github.com/fkie-cad/nvd-json-data-feeds.git;branch=main;protocol=https;destsuffix= returning git:///path-to-premirror/git/github.com.fkie-cad.nvd-json-data-feeds.git;branch=main;protocol=file;destsuffix
...log.do_fetch...

This commit use function _query_str_join for query as usual (if a value is
None then it isn't a key-value pair, but a bare key.), and use function
_param_str_join for params to allow value is empty string and still key-value
pair, after applying this commit
...log.do_fetch...
DEBUG: For url git://github.com/fkie-cad/nvd-json-data-feeds.git;branch=main;protocol=https;destsuffix= returning git:///path-to-premirror/git/github.com.fkie-cad.nvd-json-data-feeds.git;branch=main;protocol=file;destsuffix=
...log.do_fetch...

$ bitbake-selftest -v bb.tests.fetch.URITest.test_uri
test_uri (bb.tests.fetch.URITest) ... ok

----------------------------------------------------------------------
Ran 1 test in 0.001s

OK

[1] https://github.com/openembedded/openembedded-core/commit/131e024a6688074347e08879718221fbfb69033f
[2] https://github.com/openembedded/bitbake/commit/eac583bd4c46f3bb9661852cb6a1448f16147ff1

(cherry picked from commit b3867e6d35ef57239c7ba961a00fa45577600301)
---
 lib/bb/fetch2/__init__.py | 7 +++++--
 lib/bb/tests/fetch.py     | 6 +++---
 2 files changed, 8 insertions(+), 5 deletions(-)
lib/bb/fetch2/__init__.py +5 -2
index d913d7511..e0494b3cb 100644
@@ -304,7 +304,7 @@ class URI(object):
 
     def _query_str(self):
         return (
-            ''.join(['?', self._param_str_join(self.query, "&")])
+            ''.join(['?', self._query_str_join(self.query, "&")])
             if self.query else '')
 
     def _param_str_split(self, string, elmdelim, kvdelim="="):
@@ -313,9 +313,12 @@ class URI(object):
             ret[k] = v
         return ret
 
-    def _param_str_join(self, dict_, elmdelim, kvdelim="="):
+    def _query_str_join(self, dict_, elmdelim, kvdelim="="):
         return elmdelim.join([kvdelim.join([k, v]) if v else k for k, v in dict_.items()])
 
+    def _param_str_join(self, dict_, elmdelim, kvdelim="="):
+        return elmdelim.join([kvdelim.join([k, v]) for k, v in dict_.items()])
+
     @property
     def hostport(self):
         if not self.port:
lib/bb/tests/fetch.py +3 -3
index cc133c1f5..e661ff0d8 100644
@@ -292,8 +292,8 @@ class URITest(unittest.TestCase):
             'query': {},
             'relative': True
         },
-        "https://www.innodisk.com/Download_file?9BE0BF6657;downloadfilename=EGPL-T101.zip": {
-            'uri': 'https://www.innodisk.com/Download_file?9BE0BF6657;downloadfilename=EGPL-T101.zip',
+        "https://www.innodisk.com/Download_file?9BE0BF6657;downloadfilename=EGPL-T101.zip;someparam=": {
+            'uri': 'https://www.innodisk.com/Download_file?9BE0BF6657;downloadfilename=EGPL-T101.zip;someparam=',
             'scheme': 'https',
             'hostname': 'www.innodisk.com',
             'port': None,
@@ -303,7 +303,7 @@ class URITest(unittest.TestCase):
             'userinfo': '',
             'username': '',
             'password': '',
-            'params': {"downloadfilename" : "EGPL-T101.zip"},
+            'params': {"downloadfilename" : "EGPL-T101.zip", "someparam" : ""},
             'query': {"9BE0BF6657": None},
             'relative': False
         },
#2 lore raw

[bitbake][wrynose][2.18][PATCH 4/6] fetch2/crate: skip yanked versions when reading cargo index

In reply to Yoann Congal

From: Thomas Perrot <[email protected]>

The cargo sparse index marks yanked crate versions with "yanked": true. Treat those the same way as non-existing versions so that version checking never promotes a yanked release as the latest one.

(cherry picked from commit 0d757e8dfff7c5d338a01437960d60312e9af490)
---
 lib/bb/fetch2/crate.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
lib/bb/fetch2/crate.py +2 -1
index b89817ab9..d84bae0bc 100644
@@ -178,7 +178,8 @@ class Crate(Wget):
         response = self._fetch_index(ud.versionsurl, ud, d)
         for line in response.splitlines():
             data = json.loads(line)
-            versions.append((0, data["vers"], ""))
+            if not data.get("yanked", False):
+                versions.append((0, data["vers"], ""))
 
         versions = sorted(versions, key=cmp_to_key(bb.utils.vercmp))
         return (versions[-1][1], "")
#3 lore raw

[bitbake][wrynose][2.18][PATCH 5/6] fetch2/crate: guard against empty version list

In reply to Yoann Congal

From: Thomas Perrot <[email protected]>

Both latest_versionstring() and latest_versionstring_from_index() would raise IndexError on versions[-1] if the fetched index returns no usable versions.
Return ("", "") in that case, consistent with what callers expect when no upstream version can be determined.

(cherry picked from commit ffdc2a02693379d7ead0f7b940111340843d49a4)
---
 lib/bb/fetch2/crate.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/bb/fetch2/crate.py +2 -2
index d84bae0bc..eb1fd5719 100644
@@ -164,7 +164,7 @@ class Crate(Wget):
         versions = [(0, i["num"], "") for i in json_data["versions"]]
         versions = sorted(versions, key=cmp_to_key(bb.utils.vercmp))
 
-        return (versions[-1][1], "")
+        return (versions[-1][1], "") if versions else ("", "")
 
     def latest_versionstring_from_index(self, ud, d):
         """
@@ -182,4 +182,4 @@ class Crate(Wget):
                 versions.append((0, data["vers"], ""))
 
         versions = sorted(versions, key=cmp_to_key(bb.utils.vercmp))
-        return (versions[-1][1], "")
+        return (versions[-1][1], "") if versions else ("", "")
#4 lore raw

[bitbake][wrynose][2.18][PATCH 3/6] layerindexlib: restapi.py: fix unbound variable

In reply to Yoann Congal

From: João Marcos Costa <[email protected]>

If the requested branch(es) is not found, a debugging message is displayed to list it, so the expected behavior is something like this:

$ bitbake-layers layerindex-fetch meta-firefox
NOTE: Starting bitbake server...
Loading https://layers.openembedded.org/layerindex/api/;branch=wrynose...
ERROR: Remote layer index ['https://layers.openembedded.org/layerindex/'] is empty for branches ['wrynose']

However, the variable currently used is unbound, and the error below comes up:

File "/src/bitbake/lib/layerindexlib/restapi.py", line 216, in load_index_web
logger.debug("No valid branches (%s) found at url %s." % (branch, url))
^^^^^^
UnboundLocalError: cannot access local variable 'branch' where it is not associated with a value

Replace 'branch' by 'branches' to fix this.

(cherry picked from commit df3295f016a74a1414b8af5adb9f2a3967c365b6)
---
 lib/layerindexlib/restapi.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/layerindexlib/restapi.py +1 -1
index 81d99b02e..65405cb7e 100644
@@ -213,7 +213,7 @@ class RestApiPlugin(layerindexlib.plugin.IndexPlugin):
         pindex['branches'] = _get_json_response(index.apilinks['branches'] + filter,
                                                     username=up.username, password=up.password)
         if not pindex['branches']:
-            logger.debug("No valid branches (%s) found at url %s." % (branch, url))
+            logger.debug("No valid branches (%s) found at url %s." % (branches, url))
             return index
         index.add_raw_element("branches", layerindexlib.Branch, pindex['branches'])
 
#5 lore raw

[bitbake][wrynose][2.18][PATCH 1/6] fetch2: reraise IOError during download

In reply to Yoann Congal

From: Anthony Squires <[email protected]>

Fixes [YOCTO #16268]

Adds a missing "raise" statement to download that ensures when there is an IOError/OSError that is is correctly reported and not silently discarded.

When an IOError is thrown in this case do_fetch silently passes which then leads to downstream failures in do_unpack when the file doesn't exist.

(cherry picked from commit 0460038e4705934e614b26ba5febc09293924cd4)
---
 lib/bb/fetch2/__init__.py | 1 +
 1 file changed, 1 insertion(+)
lib/bb/fetch2/__init__.py +1 -0
index 0e4f491ce..d913d7511 100644
@@ -1969,6 +1969,7 @@ class Fetch(object):
                 if e.errno in [errno.ESTALE]:
                     logger.error("Stale Error Observed %s." % u)
                     raise ChecksumError("Stale Error Detected")
+                raise
 
             except BBFetchException as e:
                 if isinstance(e, NoChecksumError):
#6 lore raw

[bitbake][wrynose][2.18][PATCH 2/6] bitbake: fix issue with varflag exclusion

In reply to Yoann Congal

From: Marcio Henriques <[email protected]>

This patch fixes an issue when checking if a varflag can be safely excluded.

BB_SIGNATURE_EXCLUDE_FLAGS lists variable flags that can be safely excluded from checksum and dependency data for keys in the datastore.

When bitbake checks if a varflag must be excluded it checks if the varflag name is part of the string stored in BB_SIGNATURE_EXCLUDE_FLAGS.

As an example, if the varflag 'filename' is in BB_SIGNATURE_EXCLUDE_FLAGS, the varflag 'name' will also be excluded because the check will return 'True' when checking if the varflag is part of the string with the varflags to exclude.

To fix this issue the string from BB_SIGNATURE_EXCLUDE_FLAGS is converted to a list before checking if a varflag is part of it.

(cherry picked from commit 8ab71d0ce302521da6a7e18c887cd85d9a94e8ee)
---
 lib/bb/data.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bb/data.py +1 -1
index 5fdcdb04a..b12972c03 100644
@@ -378,7 +378,7 @@ def generate_dependencies(d, ignored_vars):
     mod_funcs = set(bb.codeparser.modulecode_deps.keys())
     keys = set(key for key in d if not key.startswith("__")) | mod_funcs
     shelldeps = set(key for key in d.getVar("__exportlist", False) if bb.utils.to_boolean(d.getVarFlag(key, "export")) and not bb.utils.to_boolean(d.getVarFlag(key, "unexport")))
-    varflagsexcl = d.getVar('BB_SIGNATURE_EXCLUDE_FLAGS')
+    varflagsexcl = (d.getVar('BB_SIGNATURE_EXCLUDE_FLAGS') or "").split()
 
     codeparserd = d.createCopy()
     for forced in (d.getVar('BB_HASH_CODEPARSER_VALS') or "").split():