Skip to contentSkip to conversation

[2.0][PATCH 00/18] Patch review

bitbake Steve Sakoman 1 participant 19 messages May 10, 2022

lore
Share & tools
lore
#0 lore raw

Please review this set of patches for 2.0/kirkstone and have comments back by end of day Thursday.

Passed a-full on autobuilder:

https://autobuilder.yoctoproject.org/typhoon/#/builders/83/builds/3642

except for a known intermittent issue on the qemumips-alt test, which passed on subsequent retest:

https://autobuilder.yoctoproject.org/typhoon/#/builders/102/builds/3028
The following changes since commit c212b0f3b542efa19f15782421196b7f4b64b0b9:

fetch2/crate: fix logger.debug line (2022-04-15 09:41:19 +0100)

are available in the Git repository at:

git://git.openembedded.org/bitbake-contrib stable/2.0-nut
http://cgit.openembedded.org/bitbake-contrib/log/?h=stable/2.0-nut

Matt Madison (1):
providers: use local variable for packages_dynamic pattern

Richard Purdie (15):
tests/parse: Fix one test overwriting another server/process: Drop unused import ui/buildinfohelper: Drop unused import
cooker: Drop unused loop
msg: Drop unused local variable
buildinfohelper: Drop unused function
fetch2/crate: Drop unused import
siggen: Drop pointless break statement
ui/knotty: Drop pointless pass statement
persist_data: Use a valid exception for missing implementation
runqueue: Drop pointless variable assignment
buildinfohelper: Drop unused variables
fetch2/osc: Add missing parameter
runqueue: Fix sig file location when using multiconfig fetch/git : Use cat as pager

Robert Yang (1):
fetch2/ssh.py: decode path back for ssh

Roland Hieber (1):
cache: correctly handle file names containing colons

 lib/bb/cache.py              |  2 +-
 lib/bb/cooker.py             | 25 ++++++++++++-------------
 lib/bb/fetch2/crate.py       |  1 -
 lib/bb/fetch2/git.py         |  2 +-
 lib/bb/fetch2/osc.py         |  2 +-
 lib/bb/fetch2/ssh.py         |  6 ++++--
 lib/bb/msg.py                |  1 -
 lib/bb/persist_data.py       |  2 +-
 lib/bb/providers.py          |  6 +++---
 lib/bb/runqueue.py           |  3 +--
 lib/bb/server/process.py     |  1 -
 lib/bb/siggen.py             |  1 -
 lib/bb/tests/parse.py        |  2 +-
 lib/bb/ui/buildinfohelper.py | 27 +++------------------------
 lib/bb/ui/knotty.py          |  1 -
 15 files changed, 28 insertions(+), 54 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

[bitbake][kirkstone][2.0][PATCH 01/18] providers: use local variable for packages_dynamic pattern

From: Matt Madison <[email protected]>

During parsing, Python raises

RuntimeError: dictionary changed size during iteration

in getRuntimeProviders, if you happen to have a recipe with an explicit RDEPENDS on a dynamic package containing a '+' character, such as 'gtk+3-locale-en'.

This is because we're using the modified pattern as the key into the packages_dynamic dict to append to rproviders, and since that key doesn't exist, the dict is getting modified to add a new, empty, entry for it. So even without the runtime error, we'd be generating an incorrect result.

Fix this by using a local variable for modifying the pattern and using the original key to retrieve the value on a match.

(cherry picked from commit 07de375c3e57f17ab7b47569186f24ecd9896825)
---
 lib/bb/providers.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
lib/bb/providers.py +3 -3
index 8c1c31a5..e11a4637 100644
@@ -396,8 +396,8 @@ def getRuntimeProviders(dataCache, rdepend):
         return rproviders
 
     # Only search dynamic packages if we can't find anything in other variables
-    for pattern in dataCache.packages_dynamic:
-        pattern = pattern.replace(r'+', r"\+")
+    for pat_key in dataCache.packages_dynamic:
+        pattern = pat_key.replace(r'+', r"\+")
         if pattern in regexp_cache:
             regexp = regexp_cache[pattern]
         else:
@@ -408,7 +408,7 @@ def getRuntimeProviders(dataCache, rdepend):
                 raise
             regexp_cache[pattern] = regexp
         if regexp.match(rdepend):
-            rproviders += dataCache.packages_dynamic[pattern]
+            rproviders += dataCache.packages_dynamic[pat_key]
             logger.debug("Assuming %s is a dynamic package, but it may not exist" % rdepend)
 
     return rproviders
Signature · 1 line
2.25.1
#2 lore raw

[bitbake][kirkstone][2.0][PATCH 03/18] server/process: Drop unused import

In reply to Steve Sakoman

From: Richard Purdie <[email protected]>

(cherry picked from commit 543315e6463f15ca7ab2b4ef3e8ed41bb4207ccf)
---
 lib/bb/server/process.py | 1 -
 1 file changed, 1 deletion(-)
lib/bb/server/process.py +0 -1
index 19ef8398..613956f3 100644
@@ -20,7 +20,6 @@ import os
 import sys
 import time
 import select
-import signal
 import socket
 import subprocess
 import errno
Signature · 1 line
2.25.1
#3 lore raw

[bitbake][kirkstone][2.0][PATCH 04/18] ui/buildinfohelper: Drop unused import

In reply to Steve Sakoman

From: Richard Purdie <[email protected]>

(cherry picked from commit aca0ff85109f4b0f3c201c02c3f59cad7ee2e787)
---
 lib/bb/ui/buildinfohelper.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bb/ui/buildinfohelper.py +1 -1
index 0761f73b..9c4215f9 100644
@@ -45,7 +45,7 @@ from pprint import pformat
 import logging
 from datetime import datetime, timedelta
 
-from django.db import transaction, connection
+from django.db import transaction
 
 
 # pylint: disable=invalid-name
Signature · 1 line
2.25.1
#4 lore raw

[bitbake][kirkstone][2.0][PATCH 02/18] tests/parse: Fix one test overwriting another

In reply to Steve Sakoman

From: Richard Purdie <[email protected]>

Fix an issue where two tests have the same name with one overwriting the other.

(cherry picked from commit da812d938fd79e2cc7bdf355ccf5b0f9ead684c4)
---
 lib/bb/tests/parse.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bb/tests/parse.py +1 -1
index 4d17f82e..2898f9bb 100644
@@ -119,7 +119,7 @@ EXTRA_OECONF:class-target = "b"
 EXTRA_OECONF:append = " c"
 """
 
-    def test_parse_overrides(self):
+    def test_parse_overrides2(self):
         f = self.parsehelper(self.overridetest2)
         d = bb.parse.handle(f.name, self.d)['']
         d.appendVar("EXTRA_OECONF", " d")
Signature · 1 line
2.25.1
#5 lore raw

[bitbake][kirkstone][2.0][PATCH 07/18] buildinfohelper: Drop unused function

In reply to Steve Sakoman

From: Richard Purdie <[email protected]>

The function has a loop where the variable is never used which I was going to fix but the entire function never seems to be called so remove it entirely.

(cherry picked from commit 3bcb20f025907f4e88bbe3d14f5638d5f01010cb)
---
 lib/bb/ui/buildinfohelper.py | 21 ---------------------
 1 file changed, 21 deletions(-)
lib/bb/ui/buildinfohelper.py +0 -21
index 9c4215f9..c4ca2677 100644
@@ -1062,27 +1062,6 @@ class BuildInfoHelper(object):
 
         return recipe_info
 
-    def _get_path_information(self, task_object):
-        self._ensure_build()
-
-        assert isinstance(task_object, Task)
-        build_stats_format = "{tmpdir}/buildstats/{buildname}/{package}/"
-        build_stats_path = []
-
-        for t in self.internal_state['targets']:
-            buildname = self.internal_state['build'].build_name
-            pe, pv = task_object.recipe.version.split(":",1)
-            if pe:
-                package = task_object.recipe.name + "-" + pe + "_" + pv
-            else:
-                package = task_object.recipe.name + "-" + pv
-
-            build_stats_path.append(build_stats_format.format(tmpdir=self.tmp_dir,
-                                                     buildname=buildname,
-                                                     package=package))
-
-        return build_stats_path
-
 
     ################################
     ## external available methods to store information
Signature · 1 line
2.25.1
#6 lore raw

[bitbake][kirkstone][2.0][PATCH 08/18] fetch2/crate: Drop unused import

In reply to Steve Sakoman

From: Richard Purdie <[email protected]>

(cherry picked from commit 879f17ecd5ba09e217cef74f6a51339b145e8ef5)
---
 lib/bb/fetch2/crate.py | 1 -
 1 file changed, 1 deletion(-)
lib/bb/fetch2/crate.py +0 -1
index aac1221c..f4ddc782 100644
@@ -13,7 +13,6 @@ BitBake 'Fetch' implementation for crates.io
 import hashlib
 import json
 import os
-import shutil
 import subprocess
 import bb
 from   bb.fetch2 import logger, subprocess_setup, UnpackError
Signature · 1 line
2.25.1
#7 lore raw

[bitbake][kirkstone][2.0][PATCH 06/18] msg: Drop unused local variable

In reply to Steve Sakoman

From: Richard Purdie <[email protected]>

(cherry picked from commit 140929b404ee1e2f5e0e1a3a1d3aa49fb3759ade)
---
 lib/bb/msg.py | 1 -
 1 file changed, 1 deletion(-)
lib/bb/msg.py +0 -1
index c95a874b..93575d89 100644
@@ -133,7 +133,6 @@ class LogFilterShowOnce(logging.Filter):
         self.seen_errors = set()
 
     def filter(self, record):
-        msg = record.msg
         if record.levelno == bb.msg.BBLogFormatter.WARNONCE:
             if record.msg in self.seen_warnings:
                 return False
Signature · 1 line
2.25.1
#8 lore raw

[bitbake][kirkstone][2.0][PATCH 05/18] cooker: Drop unused loop

In reply to Steve Sakoman

From: Richard Purdie <[email protected]>

(cherry picked from commit 1c811ad6f10560e7a7fb6830cf83707551ba04bd)
---
 lib/bb/cooker.py | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)
lib/bb/cooker.py +12 -13
index 08593d11..6da9291f 100644
@@ -744,19 +744,18 @@ class BBCooker:
                     taskdata[mc].add_unresolved(localdata[mc], self.recipecaches[mc])
                     mcdeps |= set(taskdata[mc].get_mcdepends())
                 new = False
-                for mc in self.multiconfigs:
-                    for k in mcdeps:
-                        if k in seen:
-                            continue
-                        l = k.split(':')
-                        depmc = l[2]
-                        if depmc not in self.multiconfigs:
-                            bb.fatal("Multiconfig dependency %s depends on nonexistent multiconfig configuration named configuration %s" % (k,depmc))
-                        else:
-                            logger.debug("Adding providers for multiconfig dependency %s" % l[3])
-                            taskdata[depmc].add_provider(localdata[depmc], self.recipecaches[depmc], l[3])
-                            seen.add(k)
-                            new = True
+                for k in mcdeps:
+                    if k in seen:
+                        continue
+                    l = k.split(':')
+                    depmc = l[2]
+                    if depmc not in self.multiconfigs:
+                        bb.fatal("Multiconfig dependency %s depends on nonexistent multiconfig configuration named configuration %s" % (k,depmc))
+                    else:
+                        logger.debug("Adding providers for multiconfig dependency %s" % l[3])
+                        taskdata[depmc].add_provider(localdata[depmc], self.recipecaches[depmc], l[3])
+                        seen.add(k)
+                        new = True
 
         for mc in self.multiconfigs:
             taskdata[mc].add_unresolved(localdata[mc], self.recipecaches[mc])
Signature · 1 line
2.25.1
#9 lore raw

[bitbake][kirkstone][2.0][PATCH 09/18] siggen: Drop pointless break statement

In reply to Steve Sakoman

From: Richard Purdie <[email protected]>

(cherry picked from commit 42809f6acb79e39042e81d54c28efb92b7481e44)
---
 lib/bb/siggen.py | 1 -
 1 file changed, 1 deletion(-)
lib/bb/siggen.py +0 -1
index 130b38d8..9fa568f6 100644
@@ -40,7 +40,6 @@ def init(d):
     for sg in siggens:
         if desired == sg.name:
             return sg(d)
-            break
     else:
         logger.error("Invalid signature generator '%s', using default 'noop'\n"
                      "Available generators: %s", desired,
Signature · 1 line
2.25.1
#10 lore raw

[bitbake][kirkstone][2.0][PATCH 10/18] ui/knotty: Drop pointless pass statement

In reply to Steve Sakoman

From: Richard Purdie <[email protected]>

(cherry picked from commit 625565087d8c9e7a6a79b0b4f3e5be2d77d5f100)
---
 lib/bb/ui/knotty.py | 1 -
 1 file changed, 1 deletion(-)
lib/bb/ui/knotty.py +0 -1
index 3f410fd5..61cf0a37 100644
@@ -877,7 +877,6 @@ def main(server, eventHandler, params, tf = TerminalFilter):
                     state_force_shutdown()
 
             main.shutdown = main.shutdown + 1
-            pass
         except Exception as e:
             import traceback
             sys.stderr.write(traceback.format_exc())
Signature · 1 line
2.25.1
#11 lore raw

[bitbake][kirkstone][2.0][PATCH 11/18] persist_data: Use a valid exception for missing implementation

In reply to Steve Sakoman

From: Richard Purdie <[email protected]>

(cherry picked from commit 7254eb6b3e8ef504ef2274541dcc55f1d42238c6)
---
 lib/bb/persist_data.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bb/persist_data.py +1 -1
index 9e20a837..ce84a158 100644
@@ -208,7 +208,7 @@ class SQLTable(collections.abc.MutableMapping):
 
     def __lt__(self, other):
         if not isinstance(other, Mapping):
-            raise NotImplemented
+            raise NotImplementedError()
 
         return len(self) < len(other)
 
Signature · 1 line
2.25.1
#12 lore raw

[bitbake][kirkstone][2.0][PATCH 12/18] runqueue: Drop pointless variable assignment

In reply to Steve Sakoman

From: Richard Purdie <[email protected]>

This is set at the start of the loop anyway so it does nothing. Drop the pointless code.

(cherry picked from commit e6a3173c9cdf349ccbd4cf612868f92cce8717c8)
---
 lib/bb/runqueue.py | 1 -
 1 file changed, 1 deletion(-)
lib/bb/runqueue.py +0 -1
index a7a84630..a4e82f37 100644
@@ -2664,7 +2664,6 @@ def build_scenequeue_data(sqdata, rqdata, rq, cooker, stampcache, sqrq):
             sq_revdeps_squash[point] = set()
             if point in rqdata.runq_setscene_tids:
                 sq_revdeps_squash[point] = tasks
-                tasks = set()
                 continue
             for dep in rqdata.runtaskentries[point].depends:
                 if point in sq_revdeps[dep]:
Signature · 1 line
2.25.1
#13 lore raw

[bitbake][kirkstone][2.0][PATCH 13/18] buildinfohelper: Drop unused variables

In reply to Steve Sakoman

From: Richard Purdie <[email protected]>

(cherry picked from commit d720dfa40620e64a557edef527148d58fcb1d858)
---
 lib/bb/ui/buildinfohelper.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/bb/ui/buildinfohelper.py +2 -2
index c4ca2677..129bb329 100644
@@ -496,7 +496,7 @@ class ORMWrapper(object):
             if not parent_path:
                 parent_path = "/"
             parent_obj = self._cached_get(Target_File, target = target_obj, path = parent_path, inodetype = Target_File.ITYPE_DIRECTORY)
-            tf_obj = Target_File.objects.create(
+            Target_File.objects.create(
                         target = target_obj,
                         path = path,
                         size = size,
@@ -561,7 +561,7 @@ class ORMWrapper(object):
 
             parent_obj = Target_File.objects.get(target = target_obj, path = parent_path, inodetype = Target_File.ITYPE_DIRECTORY)
 
-            tf_obj = Target_File.objects.create(
+            Target_File.objects.create(
                         target = target_obj,
                         path = path,
                         size = size,
Signature · 1 line
2.25.1
#14 lore raw

[bitbake][kirkstone][2.0][PATCH 15/18] fetch2/ssh.py: decode path back for ssh

In reply to Steve Sakoman

From: Robert Yang <[email protected]>

The path has been encoded by urllib.parse.quote(), so decode it back for ssh.

Fixed when fetch from PREMIRRORS via ssh:

$ bitbake bonnie++ libsigc++-2.0 -cfetch

scp: /path/to/downloads/libsigc%2B%2B-2.10.7.tar.xz: No such file or directory

(cherry picked from commit c1c8fc678eb4783cea3974328a5fa8d1b79f1266)
---
 lib/bb/fetch2/ssh.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
lib/bb/fetch2/ssh.py +4 -2
index 48445308..8d082b38 100644
@@ -32,6 +32,7 @@ IETF secsh internet draft:
 
 import re, os
 from bb.fetch2 import check_network_access, FetchMethod, ParameterError, runfetchcmd
+import urllib
 
 
 __pattern__ = re.compile(r'''
@@ -70,6 +71,7 @@ class SSH(FetchMethod):
                 "git:// prefix with protocol=ssh", urldata.url)
         m = __pattern__.match(urldata.url)
         path = m.group('path')
+        path = urllib.parse.unquote(path)
         host = m.group('host')
         urldata.localpath = os.path.join(d.getVar('DL_DIR'),
                 os.path.basename(os.path.normpath(path)))
@@ -99,7 +101,7 @@ class SSH(FetchMethod):
 
         if path[0] != '~':
             path = '/%s' % path
-        path = path.replace("%3A", ":")
+        path = urllib.parse.unquote(path)
 
         fr += ':%s' % path
 
@@ -139,7 +141,7 @@ class SSH(FetchMethod):
 
         if path[0] != '~':
             path = '/%s' % path
-        path = path.replace("%3A", ":")
+        path = urllib.parse.unquote(path)
 
         cmd = 'ssh -o BatchMode=true %s %s [ -f %s ]' % (
             portarg,
Signature · 1 line
2.25.1
#15 lore raw

[bitbake][kirkstone][2.0][PATCH 14/18] fetch2/osc: Add missing parameter

In reply to Steve Sakoman

From: Richard Purdie <[email protected]>

This probably means the osc fetcher isn't being used but fix the missing parameter.

(cherry picked from commit a23c201cb6efc5c0abf763c26f905442f0eebb68)
---
 lib/bb/fetch2/osc.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bb/fetch2/osc.py +1 -1
index d9ce4439..99a529e5 100644
@@ -43,7 +43,7 @@ class Osc(FetchMethod):
             ud.revision = ud.parm['rev']
         else:
             pv = d.getVar("PV", False)
-            rev = bb.fetch2.srcrev_internal_helper(ud, d)
+            rev = bb.fetch2.srcrev_internal_helper(ud, d, '')
             if rev:
                 ud.revision = rev
             else:
Signature · 1 line
2.25.1
#16 lore raw

[bitbake][kirkstone][2.0][PATCH 17/18] cache: correctly handle file names containing colons

In reply to Steve Sakoman

From: Roland Hieber <[email protected]>

File names containing colons cause split() to return a list with more than two elements, which will lead to a stack trace ending in:

ValueError: too many values to unpack (expected 2)

Split only once at the last colon, thereby making sure that only two elements are returned.

(cherry picked from commit a70a7376a8708bde07959deb5d5842d7f84ee5f8)
---
 lib/bb/cache.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bb/cache.py +1 -1
index fcb15796..92e9a3ce 100644
@@ -619,7 +619,7 @@ class Cache(NoCache):
                 for f in flist:
                     if not f:
                         continue
-                    f, exist = f.split(":")
+                    f, exist = f.rsplit(":", 1)
                     if (exist == "True" and not os.path.exists(f)) or (exist == "False" and os.path.exists(f)):
                         self.logger.debug2("%s's file checksum list file %s changed",
                                              fn, f)
Signature · 1 line
2.25.1
#17 lore raw

[bitbake][kirkstone][2.0][PATCH 16/18] runqueue: Fix sig file location when using multiconfig

In reply to Steve Sakoman

From: Richard Purdie <[email protected]>

We're using the wrong data store when trying to locate siginfo files, fix this. Thanks to Gregory Lumen <[email protected]> for spotting.

[YOCTO #14774]

(cherry picked from commit 0ed800e19a3197f8e622c8d3b630aae384e60aba)
---
 lib/bb/runqueue.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bb/runqueue.py +1 -1
index a4e82f37..f34f1568 100644
@@ -1674,7 +1674,7 @@ class RunQueue:
             (mc, fn, taskname, taskfn) = split_tid_mcfn(tid)
             pn = self.rqdata.dataCaches[mc].pkg_fn[taskfn]
             h = self.rqdata.runtaskentries[tid].hash
-            matches = bb.siggen.find_siginfo(pn, taskname, [], self.cfgData)
+            matches = bb.siggen.find_siginfo(pn, taskname, [], self.cooker.databuilder.mcdata[mc])
             match = None
             for m in matches:
                 if h in m:
Signature · 1 line
2.25.1
#18 lore raw

[bitbake][kirkstone][2.0][PATCH 18/18] fetch/git : Use cat as pager

In reply to Steve Sakoman

From: Richard Purdie <[email protected]>

We don't have less in HOSTTOOLS in OE and this can confuse git. Force the pager to cat to be consistent and minimal everywhere.

(cherry picked from commit d3d406e8552fdd865dc58b419a84411736475ad2)
---
 lib/bb/fetch2/git.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bb/fetch2/git.py +1 -1
index b3eb8248..f0df6fb6 100644
@@ -240,7 +240,7 @@ class Git(FetchMethod):
             for name in ud.names:
                 ud.unresolvedrev[name] = 'HEAD'
 
-        ud.basecmd = d.getVar("FETCHCMD_git") or "git -c core.fsyncobjectfiles=0 -c gc.autoDetach=false"
+        ud.basecmd = d.getVar("FETCHCMD_git") or "git -c core.fsyncobjectfiles=0 -c gc.autoDetach=false -c core.pager=cat"
 
         write_tarballs = d.getVar("BB_GENERATE_MIRROR_TARBALLS") or "0"
         ud.write_tarballs = write_tarballs != "0" or ud.rebaseable
Signature · 1 line
2.25.1