Skip to contentSkip to conversation

scripts/oe-package-browser: Fix after overrides change

PATCH New Richard Purdie 1 participant 2 messages Nov 11, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 scripts/oe-package-browser: Fix after overrides change

After the overrides change, the format of pkgdata changed and this usage of configparser no longer works. This change is a bandaid to make things work but the pkgdata format isn't very similar to ini files so this may need to be reimplmented in a better way in the long run.

[YOCTO #14619]

---
 scripts/oe-pkgdata-browser | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/oe-pkgdata-browser +3 -3
index 8d223185a43..e07005b8070 100755
@@ -49,11 +49,11 @@ def load(filename, suffix=None):
     from configparser import ConfigParser
     from itertools import chain
 
-    parser = ConfigParser()
+    parser = ConfigParser(delimiters=('='))
     if suffix:
-        parser.optionxform = lambda option: option.replace("_" + suffix, "")
+        parser.optionxform = lambda option: option.replace(":" + suffix, "")
     with open(filename) as lines:
-        lines = chain(("[fake]",), lines)
+        lines = chain(("[fake]",), (line.replace(": ", " = ", 1) for line in lines))
         parser.read_file(lines)
 
     # TODO extract the data and put it into a real dict so we can transform some
Signature · 1 line
2.32.0
#1 lore raw

PATCH 2/2 scripts/oe-package-browser: Handle no packages being built

Give the user a proper error message if there aren't packages built, rather than a less friendly traceback.

[YOCTO #14619]

---
 scripts/oe-pkgdata-browser | 2 ++
 1 file changed, 2 insertions(+)
scripts/oe-pkgdata-browser +2 -0
index e07005b8070..a3a381923b7 100755
@@ -236,6 +236,8 @@ class PkgUi():
         update_deps("RPROVIDES", "Provides: ", self.provides_label, clickable=False)
 
     def load_recipes(self):
+        if not os.path.exists(pkgdata):
+            sys.exit("Error: Please ensure %s exists by generating packages before using this tool." % pkgdata)
         for recipe in sorted(os.listdir(pkgdata)):
             if os.path.isfile(os.path.join(pkgdata, recipe)):
                 self.recipe_iters[recipe] = self.recipe_store.append([recipe])
Signature · 1 line
2.32.0