[oe-commits] [openembedded-core] 03/06: oe-pkgdata-util: Make parse_pkgdatafile() support package suffixed vars

git at git.openembedded.org git at git.openembedded.org
Wed Aug 15 11:44:44 UTC 2018


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch sumo-next
in repository openembedded-core.

commit b750b310afacf298fc450e71d116ed20eef16428
Author: Peter Kjellerstedt <peter.kjellerstedt at axis.com>
AuthorDate: Sat Jun 2 21:30:32 2018 +0200

    oe-pkgdata-util: Make parse_pkgdatafile() support package suffixed vars
    
    Support for variables suffixed with package names, e.g., PKGV_foo, was
    removed in commit 3d2c87c4, which broke support for recipes that set
    other versions on their packages than what is in ${PV}.
    
    (From OE-Core rev: 38f8284212370999e1e7b0f6559f7cd786e80d1a)
    
    Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt at axis.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
    Signed-off-by: Armin Kuster <akuster808 at gmail.com>
---
 scripts/oe-pkgdata-util | 46 ++++++++++++++++++----------------------------
 1 file changed, 18 insertions(+), 28 deletions(-)

diff --git a/scripts/oe-pkgdata-util b/scripts/oe-pkgdata-util
index 5dd9588..a4e8413 100755
--- a/scripts/oe-pkgdata-util
+++ b/scripts/oe-pkgdata-util
@@ -286,36 +286,26 @@ def lookup_recipe(args):
 
 def package_info(args):
     def parse_pkgdatafile(pkgdatafile):
+        vars = ['PKGV', 'PKGE', 'PKGR', 'PN', 'PV', 'PE', 'PR', 'PKGSIZE']
         with open(pkgdatafile, 'r') as f:
-            pkge = ''
-            pkgr = ''
-            pe = ''
-            pr = ''
+            vals = dict()
             for line in f:
-                if line.startswith('PKGV:'):
-                    pkg_version = line.split(':', 1)[1].strip()
-                elif line.startswith('PKGE:'):
-                    pkge = line.split(':', 1)[1].strip()
-                elif line.startswith('PKGR:'):
-                    pkgr = line.split(':', 1)[1].strip()
-                elif line.startswith('PN:'):
-                    recipe = line.split(':', 1)[1].strip()
-                elif line.startswith('PV:'):
-                    recipe_version = line.split(':', 1)[1].strip()
-                elif line.startswith('PE:'):
-                    pe = line.split(':', 1)[1].strip()
-                elif line.startswith('PR:'):
-                    pr = line.split(':', 1)[1].strip()
-                elif line.startswith('PKGSIZE'):
-                    pkg_size = line.split(':', 1)[1].strip()
-            if pkge:
-                pkg_version = pkge + ":" + pkg_version
-            if pkgr:
-                pkg_version = pkg_version + "-" + pkgr
-            if pe:
-                recipe_version = pe + ":" + recipe_version
-            if pr:
-                recipe_version = recipe_version + "-" + pr
+                for var in vars:
+                    m = re.match(var + '(?:_\S+)?:\s*(.+?)\s*$', line)
+                    if m:
+                        vals[var] = m.group(1)
+            pkg_version = vals['PKGV'] or ''
+            recipe = vals['PN'] or ''
+            recipe_version = vals['PV'] or ''
+            pkg_size = vals['PKGSIZE'] or ''
+            if 'PKGE' in vals:
+                pkg_version = vals['PKGE'] + ":" + pkg_version
+            if 'PKGR' in vals:
+                pkg_version = pkg_version + "-" + vals['PKGR']
+            if 'PE' in vals:
+                recipe_version = vals['PE'] + ":" + recipe_version
+            if 'PR' in vals:
+                recipe_version = recipe_version + "-" + vals['PR']
             print("%s %s %s %s %s" % (pkg, pkg_version, recipe, recipe_version, pkg_size))
 
     # Handle both multiple arguments and multiple values within an arg (old syntax)

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list