summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/package_manager/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oe/package_manager/__init__.py')
-rw-r--r--meta/lib/oe/package_manager/__init__.py85
1 files changed, 43 insertions, 42 deletions
diff --git a/meta/lib/oe/package_manager/__init__.py b/meta/lib/oe/package_manager/__init__.py
index 6774cdb794..2100a97c12 100644
--- a/meta/lib/oe/package_manager/__init__.py
+++ b/meta/lib/oe/package_manager/__init__.py
@@ -365,45 +365,43 @@ class PackageManager(object, metaclass=ABCMeta):
365 for complementary_linguas in (self.d.getVar('IMAGE_LINGUAS_COMPLEMENTARY') or "").split(): 365 for complementary_linguas in (self.d.getVar('IMAGE_LINGUAS_COMPLEMENTARY') or "").split():
366 globs += (" " + complementary_linguas) % lang 366 globs += (" " + complementary_linguas) % lang
367 367
368 if globs is None: 368 if globs:
369 return 369 # we need to write the list of installed packages to a file because the
370 370 # oe-pkgdata-util reads it from a file
371 # we need to write the list of installed packages to a file because the 371 with tempfile.NamedTemporaryFile(mode="w+", prefix="installed-pkgs") as installed_pkgs:
372 # oe-pkgdata-util reads it from a file 372 pkgs = self.list_installed()
373 with tempfile.NamedTemporaryFile(mode="w+", prefix="installed-pkgs") as installed_pkgs: 373
374 pkgs = self.list_installed() 374 provided_pkgs = set()
375 375 for pkg in pkgs.values():
376 provided_pkgs = set() 376 provided_pkgs |= set(pkg.get('provs', []))
377 for pkg in pkgs.values(): 377
378 provided_pkgs |= set(pkg.get('provs', [])) 378 output = oe.utils.format_pkg_list(pkgs, "arch")
379 379 installed_pkgs.write(output)
380 output = oe.utils.format_pkg_list(pkgs, "arch") 380 installed_pkgs.flush()
381 installed_pkgs.write(output) 381
382 installed_pkgs.flush() 382 cmd = ["oe-pkgdata-util",
383 383 "-p", self.d.getVar('PKGDATA_DIR'), "glob", installed_pkgs.name,
384 cmd = ["oe-pkgdata-util", 384 globs]
385 "-p", self.d.getVar('PKGDATA_DIR'), "glob", installed_pkgs.name, 385 exclude = self.d.getVar('PACKAGE_EXCLUDE_COMPLEMENTARY')
386 globs] 386 if exclude:
387 exclude = self.d.getVar('PACKAGE_EXCLUDE_COMPLEMENTARY') 387 cmd.extend(['--exclude=' + '|'.join(exclude.split())])
388 if exclude: 388 try:
389 cmd.extend(['--exclude=' + '|'.join(exclude.split())]) 389 bb.note('Running %s' % cmd)
390 try: 390 proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
391 bb.note('Running %s' % cmd) 391 stdout, stderr = proc.communicate()
392 proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) 392 if stderr: bb.note(stderr.decode("utf-8"))
393 stdout, stderr = proc.communicate() 393 complementary_pkgs = stdout.decode("utf-8")
394 if stderr: bb.note(stderr.decode("utf-8")) 394 complementary_pkgs = set(complementary_pkgs.split())
395 complementary_pkgs = stdout.decode("utf-8") 395 skip_pkgs = sorted(complementary_pkgs & provided_pkgs)
396 complementary_pkgs = set(complementary_pkgs.split()) 396 install_pkgs = sorted(complementary_pkgs - provided_pkgs)
397 skip_pkgs = sorted(complementary_pkgs & provided_pkgs) 397 bb.note("Installing complementary packages ... %s (skipped already provided packages %s)" % (
398 install_pkgs = sorted(complementary_pkgs - provided_pkgs) 398 ' '.join(install_pkgs),
399 bb.note("Installing complementary packages ... %s (skipped already provided packages %s)" % ( 399 ' '.join(skip_pkgs)))
400 ' '.join(install_pkgs), 400 self.install(install_pkgs, hard_depends_only=True)
401 ' '.join(skip_pkgs))) 401 except subprocess.CalledProcessError as e:
402 self.install(install_pkgs, hard_depends_only=True) 402 bb.fatal("Could not compute complementary packages list. Command "
403 except subprocess.CalledProcessError as e: 403 "'%s' returned %d:\n%s" %
404 bb.fatal("Could not compute complementary packages list. Command " 404 (' '.join(cmd), e.returncode, e.output.decode("utf-8")))
405 "'%s' returned %d:\n%s" %
406 (' '.join(cmd), e.returncode, e.output.decode("utf-8")))
407 405
408 if self.d.getVar('IMAGE_LOCALES_ARCHIVE') == '1': 406 if self.d.getVar('IMAGE_LOCALES_ARCHIVE') == '1':
409 target_arch = self.d.getVar('TARGET_ARCH') 407 target_arch = self.d.getVar('TARGET_ARCH')
@@ -449,7 +447,7 @@ class PackageManager(object, metaclass=ABCMeta):
449 return res 447 return res
450 return _append(uris, base_paths) 448 return _append(uris, base_paths)
451 449
452def create_packages_dir(d, subrepo_dir, deploydir, taskname, filterbydependencies): 450def create_packages_dir(d, subrepo_dir, deploydir, taskname, filterbydependencies, include_self=False):
453 """ 451 """
454 Go through our do_package_write_X dependencies and hardlink the packages we depend 452 Go through our do_package_write_X dependencies and hardlink the packages we depend
455 upon into the repo directory. This prevents us seeing other packages that may 453 upon into the repo directory. This prevents us seeing other packages that may
@@ -486,14 +484,17 @@ def create_packages_dir(d, subrepo_dir, deploydir, taskname, filterbydependencie
486 bb.fatal("Couldn't find ourself in BB_TASKDEPDATA?") 484 bb.fatal("Couldn't find ourself in BB_TASKDEPDATA?")
487 pkgdeps = set() 485 pkgdeps = set()
488 start = [start] 486 start = [start]
489 seen = set(start) 487 if include_self:
488 seen = set()
489 else:
490 seen = set(start)
490 # Support direct dependencies (do_rootfs -> do_package_write_X) 491 # Support direct dependencies (do_rootfs -> do_package_write_X)
491 # or indirect dependencies within PN (do_populate_sdk_ext -> do_rootfs -> do_package_write_X) 492 # or indirect dependencies within PN (do_populate_sdk_ext -> do_rootfs -> do_package_write_X)
492 while start: 493 while start:
493 next = [] 494 next = []
494 for dep2 in start: 495 for dep2 in start:
495 for dep in taskdepdata[dep2][3]: 496 for dep in taskdepdata[dep2][3]:
496 if taskdepdata[dep][0] != pn: 497 if include_self or taskdepdata[dep][0] != pn:
497 if "do_" + taskname in dep: 498 if "do_" + taskname in dep:
498 pkgdeps.add(dep) 499 pkgdeps.add(dep)
499 elif dep not in seen: 500 elif dep not in seen: