[Buildroot] [git commit branch/2021.02.x] support/pkg-stats: support values with an equal sign in them

Peter Korsgaard peter at korsgaard.com
Wed Nov 17 22:03:28 UTC 2021


commit: https://git.buildroot.net/buildroot/commit/?id=60c852d62700e8f36ffc7381b80d81e5966f86db
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/2021.02.x

The heuristic to extract the various variables of interest is pretty
crude: we filter on variables ending with certain suffixes (like
'%_VERSION' to get the version strings).

However, in doing so, we may dump variables that are not actual package
versions (especially with br2-external trees), and those may contain one
or more equal sign.  And anyway, an actual package version string may
very well contain an equal sign too.

But the current situation is that the output of 'printvars' is split on
all equal signs, which will not fit in the 2-tuple we assign the result,
thus causing an exception.

Fix that by limiting to a single split.

Reported-by: Thomas Petazzoni <thomas.petazzoni at bootlin.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998 at free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni at bootlin.com>
(cherry picked from commit b919d5dbbae136e08b6a7644c608ec61b6ad47af)
Signed-off-by: Peter Korsgaard <peter at korsgaard.com>
---
 support/scripts/pkg-stats | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats
index b182fce605..4e7f27c3a3 100755
--- a/support/scripts/pkg-stats
+++ b/support/scripts/pkg-stats
@@ -377,7 +377,7 @@ def package_init_make_info():
 
     for item in variable_list:
         # Get variable name and value
-        pkgvar, value = item.split("=")
+        pkgvar, value = item.split("=", maxsplit=1)
 
         # Strip the suffix according to the variable
         if pkgvar.endswith("_LICENSE"):


More information about the buildroot mailing list