summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/oe-pkgdata-util154
1 files changed, 93 insertions, 61 deletions
diff --git a/scripts/oe-pkgdata-util b/scripts/oe-pkgdata-util
index e4ccf30308..040854f644 100755
--- a/scripts/oe-pkgdata-util
+++ b/scripts/oe-pkgdata-util
@@ -252,29 +252,72 @@ def lookup_pkg(args):
252 print('\n'.join(items)) 252 print('\n'.join(items))
253 253
254def lookup_recipe(args): 254def lookup_recipe(args):
255 def parse_pkgdatafile(pkgdatafile):
256 with open(pkgdatafile, 'r') as f:
257 found = False
258 for line in f:
259 if line.startswith('PN'):
260 print("%s" % line.split(':', 1)[1].strip())
261 found = True
262 break
263 if not found:
264 logger.error("Unable to find PN entry in %s" % pkgdatafile)
265 sys.exit(1)
266
255 # Handle both multiple arguments and multiple values within an arg (old syntax) 267 # Handle both multiple arguments and multiple values within an arg (old syntax)
256 pkgs = [] 268 pkgs = []
257 for pkgitem in args.pkg: 269 for pkgitem in args.pkg:
258 pkgs.extend(pkgitem.split()) 270 pkgs.extend(pkgitem.split())
259 271
260 for pkg in pkgs: 272 for pkg in pkgs:
273 providepkgpath = os.path.join(args.pkgdata_dir, "runtime-rprovides", pkg)
274 if os.path.exists(providepkgpath):
275 for f in os.listdir(providepkgpath):
276 if f != pkg:
277 print("%s is in the RPROVIDES of %s:" % (pkg, f))
278 pkgdatafile = os.path.join(args.pkgdata_dir, "runtime", f)
279 parse_pkgdatafile(pkgdatafile)
280 break
261 pkgdatafile = os.path.join(args.pkgdata_dir, 'runtime-reverse', pkg) 281 pkgdatafile = os.path.join(args.pkgdata_dir, 'runtime-reverse', pkg)
262 if os.path.exists(pkgdatafile): 282 if not os.path.exists(pkgdatafile):
263 with open(pkgdatafile, 'r') as f: 283 logger.error("The following packages could not be found: %s" % pkg)
264 found = False
265 for line in f:
266 if line.startswith('PN'):
267 print("\t%s" % line.split(':', 1)[1].strip())
268 found = True
269 break
270 if not found:
271 logger.error("Unable to find PN entry in %s" % pkgdatafile)
272 sys.exit(1)
273 else:
274 logger.error("Unable to find any built runtime package named %s" % pkg)
275 sys.exit(1) 284 sys.exit(1)
285 parse_pkgdatafile(pkgdatafile)
276 286
277def package_info(args): 287def package_info(args):
288 def parse_pkgdatafile(pkgdatafile):
289 with open(pkgdatafile, 'r') as f:
290 pkge = ''
291 pkgr = ''
292 pe = ''
293 pr = ''
294 for line in f:
295 if line.startswith('PKGV'):
296 pkg_version = line.split(':', 1)[1].strip()
297 elif line.startswith('PKGE'):
298 pkge = line.split(':', 1)[1].strip()
299 elif line.startswith('PKGR'):
300 pkgr = line.split(':', 1)[1].strip()
301 elif line.startswith('PN'):
302 recipe = line.split(':', 1)[1].strip()
303 elif line.startswith('PV'):
304 recipe_version = line.split(':', 1)[1].strip()
305 elif line.startswith('PE'):
306 pe = line.split(':', 1)[1].strip()
307 elif line.startswith('PR'):
308 pr = line.split(':', 1)[1].strip()
309 elif line.startswith('PKGSIZE'):
310 pkg_size = line.split(':', 1)[1].strip()
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))
320
278 # Handle both multiple arguments and multiple values within an arg (old syntax) 321 # Handle both multiple arguments and multiple values within an arg (old syntax)
279 packages = [] 322 packages = []
280 if args.file: 323 if args.file:
@@ -291,42 +334,19 @@ def package_info(args):
291 sys.exit(1) 334 sys.exit(1)
292 335
293 for pkg in packages: 336 for pkg in packages:
294 pkgdatafile = os.path.join(args.pkgdata_dir, 'runtime-reverse', pkg) 337 providepkgpath = os.path.join(args.pkgdata_dir, "runtime-rprovides", pkg)
295 if os.path.exists(pkgdatafile): 338 if os.path.exists(providepkgpath):
296 with open(pkgdatafile, 'r') as f: 339 for f in os.listdir(providepkgpath):
297 pkge = '' 340 if f != pkg:
298 pkgr = '' 341 print("%s is in the RPROVIDES of %s:" % (pkg, f))
299 pe = '' 342 pkgdatafile = os.path.join(args.pkgdata_dir, "runtime", f)
300 pr = '' 343 parse_pkgdatafile(pkgdatafile)
301 for line in f: 344 break
302 if line.startswith('PKGV'): 345 pkgdatafile = os.path.join(args.pkgdata_dir, "runtime-reverse", pkg)
303 pkg_version = line.split(':', 1)[1].strip() 346 if not os.path.exists(pkgdatafile):
304 elif line.startswith('PKGE'):
305 pkge = line.split(':', 1)[1].strip()
306 elif line.startswith('PKGR'):
307 pkgr = line.split(':', 1)[1].strip()
308 elif line.startswith('PN'):
309 recipe = line.split(':', 1)[1].strip()
310 elif line.startswith('PV'):
311 recipe_version = line.split(':', 1)[1].strip()
312 elif line.startswith('PE'):
313 pe = line.split(':', 1)[1].strip()
314 elif line.startswith('PR'):
315 pr = line.split(':', 1)[1].strip()
316 elif line.startswith('PKGSIZE'):
317 pkg_size = line.split(':', 1)[1].strip()
318 if pkge:
319 pkg_version = pkge + ":" + pkg_version
320 if pkgr:
321 pkg_version = pkg_version + "-" + pkgr
322 if pe:
323 recipe_version = pe + ":" + recipe_version
324 if pr:
325 recipe_version = recipe_version + "-" + pr
326 print("%s %s %s %s %s" % (pkg, pkg_version, recipe, recipe_version, pkg_size))
327 else:
328 logger.error("Unable to find any built runtime package named %s" % pkg) 347 logger.error("Unable to find any built runtime package named %s" % pkg)
329 sys.exit(1) 348 sys.exit(1)
349 parse_pkgdatafile(pkgdatafile)
330 350
331def get_recipe_pkgs(pkgdata_dir, recipe, unpackaged): 351def get_recipe_pkgs(pkgdata_dir, recipe, unpackaged):
332 recipedatafile = os.path.join(pkgdata_dir, recipe) 352 recipedatafile = os.path.join(pkgdata_dir, recipe)
@@ -415,6 +435,21 @@ def list_pkgs(args):
415 435
416def list_pkg_files(args): 436def list_pkg_files(args):
417 import json 437 import json
438 def parse_pkgdatafile(pkgdatafile):
439 with open(pkgdatafile, 'r') as f:
440 found = False
441 for line in f:
442 if line.startswith('FILES_INFO:'):
443 found = True
444 val = line.split(':', 1)[1].strip()
445 dictval = json.loads(val)
446 for fullpth in sorted(dictval):
447 print("\t%s" % fullpth)
448 break
449 if not found:
450 logger.error("Unable to find FILES_INFO entry in %s" % pkgdatafile)
451 sys.exit(1)
452
418 453
419 if args.recipe: 454 if args.recipe:
420 if args.pkg: 455 if args.pkg:
@@ -444,25 +479,22 @@ def list_pkg_files(args):
444 continue 479 continue
445 logger.error("Unable to find any built runtime package named %s" % pkg) 480 logger.error("Unable to find any built runtime package named %s" % pkg)
446 sys.exit(1) 481 sys.exit(1)
482 parse_pkgdatafile(pkgdatafile)
483
447 else: 484 else:
485 providepkgpath = os.path.join(args.pkgdata_dir, "runtime-rprovides", pkg)
486 if os.path.exists(providepkgpath):
487 for f in os.listdir(providepkgpath):
488 if f != pkg:
489 print("%s is in the RPROVIDES of %s:" % (pkg, f))
490 pkgdatafile = os.path.join(args.pkgdata_dir, "runtime", f)
491 parse_pkgdatafile(pkgdatafile)
492 continue
448 pkgdatafile = os.path.join(args.pkgdata_dir, "runtime", pkg) 493 pkgdatafile = os.path.join(args.pkgdata_dir, "runtime", pkg)
449 if not os.path.exists(pkgdatafile): 494 if not os.path.exists(pkgdatafile):
450 logger.error("Unable to find any built recipe-space package named %s" % pkg) 495 logger.error("Unable to find any built recipe-space package named %s" % pkg)
451 sys.exit(1) 496 sys.exit(1)
452 497 parse_pkgdatafile(pkgdatafile)
453 with open(pkgdatafile, 'r') as f:
454 found = False
455 for line in f:
456 if line.startswith('FILES_INFO:'):
457 found = True
458 val = line.split(':', 1)[1].strip()
459 dictval = json.loads(val)
460 for fullpth in sorted(dictval):
461 print("\t%s" % fullpth)
462 break
463 if not found:
464 logger.error("Unable to find FILES_INFO entry in %s" % pkgdatafile)
465 sys.exit(1)
466 498
467def find_path(args): 499def find_path(args):
468 import json 500 import json