summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorPeter Kjellerstedt <peter.kjellerstedt@axis.com>2018-06-02 21:30:32 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-06-04 15:15:00 +0100
commit3e9b485ba9d43885c7625f00ba5f42a906832588 (patch)
tree8c01130a514751c723038af6b9a249e75fae76ad /scripts
parent762a3f229c42b734160334fb462beaf576353a58 (diff)
downloadpoky-3e9b485ba9d43885c7625f00ba5f42a906832588.tar.gz
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@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/oe-pkgdata-util46
1 files changed, 18 insertions, 28 deletions
diff --git a/scripts/oe-pkgdata-util b/scripts/oe-pkgdata-util
index 5dd9588224..a4e84138d7 100755
--- a/scripts/oe-pkgdata-util
+++ b/scripts/oe-pkgdata-util
@@ -286,36 +286,26 @@ def lookup_recipe(args):
286 286
287def package_info(args): 287def package_info(args):
288 def parse_pkgdatafile(pkgdatafile): 288 def parse_pkgdatafile(pkgdatafile):
289 vars = ['PKGV', 'PKGE', 'PKGR', 'PN', 'PV', 'PE', 'PR', 'PKGSIZE']
289 with open(pkgdatafile, 'r') as f: 290 with open(pkgdatafile, 'r') as f:
290 pkge = '' 291 vals = dict()
291 pkgr = ''
292 pe = ''
293 pr = ''
294 for line in f: 292 for line in f:
295 if line.startswith('PKGV:'): 293 for var in vars:
296 pkg_version = line.split(':', 1)[1].strip() 294 m = re.match(var + '(?:_\S+)?:\s*(.+?)\s*$', line)
297 elif line.startswith('PKGE:'): 295 if m:
298 pkge = line.split(':', 1)[1].strip() 296 vals[var] = m.group(1)
299 elif line.startswith('PKGR:'): 297 pkg_version = vals['PKGV'] or ''
300 pkgr = line.split(':', 1)[1].strip() 298 recipe = vals['PN'] or ''
301 elif line.startswith('PN:'): 299 recipe_version = vals['PV'] or ''
302 recipe = line.split(':', 1)[1].strip() 300 pkg_size = vals['PKGSIZE'] or ''
303 elif line.startswith('PV:'): 301 if 'PKGE' in vals:
304 recipe_version = line.split(':', 1)[1].strip() 302 pkg_version = vals['PKGE'] + ":" + pkg_version
305 elif line.startswith('PE:'): 303 if 'PKGR' in vals:
306 pe = line.split(':', 1)[1].strip() 304 pkg_version = pkg_version + "-" + vals['PKGR']
307 elif line.startswith('PR:'): 305 if 'PE' in vals:
308 pr = line.split(':', 1)[1].strip() 306 recipe_version = vals['PE'] + ":" + recipe_version
309 elif line.startswith('PKGSIZE'): 307 if 'PR' in vals:
310 pkg_size = line.split(':', 1)[1].strip() 308 recipe_version = recipe_version + "-" + vals['PR']
311 if pkge:
312 pkg_version = pkge + ":" + pkg_version
313 if pkgr:
314 pkg_version = pkg_version + "-" + pkgr
315 if pe:
316 recipe_version = pe + ":" + recipe_version
317 if pr:
318 recipe_version = recipe_version + "-" + pr
319 print("%s %s %s %s %s" % (pkg, pkg_version, recipe, recipe_version, pkg_size)) 309 print("%s %s %s %s %s" % (pkg, pkg_version, recipe, recipe_version, pkg_size))
320 310
321 # Handle both multiple arguments and multiple values within an arg (old syntax) 311 # Handle both multiple arguments and multiple values within an arg (old syntax)