diff options
Diffstat (limited to 'meta/lib/oe/package_manager.py')
-rw-r--r-- | meta/lib/oe/package_manager.py | 47 |
1 files changed, 22 insertions, 25 deletions
diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py index 78d2421421..a20bbd438a 100644 --- a/meta/lib/oe/package_manager.py +++ b/meta/lib/oe/package_manager.py | |||
@@ -570,15 +570,6 @@ class PackageManager(object, metaclass=ABCMeta): | |||
570 | installation | 570 | installation |
571 | """ | 571 | """ |
572 | def install_complementary(self, globs=None): | 572 | def install_complementary(self, globs=None): |
573 | # we need to write the list of installed packages to a file because the | ||
574 | # oe-pkgdata-util reads it from a file | ||
575 | installed_pkgs_file = os.path.join(self.d.getVar('WORKDIR', True), | ||
576 | "installed_pkgs.txt") | ||
577 | with open(installed_pkgs_file, "w+") as installed_pkgs: | ||
578 | pkgs = self.list_installed() | ||
579 | output = oe.utils.format_pkg_list(pkgs, "arch") | ||
580 | installed_pkgs.write(output) | ||
581 | |||
582 | if globs is None: | 573 | if globs is None: |
583 | globs = self.d.getVar('IMAGE_INSTALL_COMPLEMENTARY', True) | 574 | globs = self.d.getVar('IMAGE_INSTALL_COMPLEMENTARY', True) |
584 | split_linguas = set() | 575 | split_linguas = set() |
@@ -595,22 +586,28 @@ class PackageManager(object, metaclass=ABCMeta): | |||
595 | if globs is None: | 586 | if globs is None: |
596 | return | 587 | return |
597 | 588 | ||
598 | cmd = [bb.utils.which(os.getenv('PATH'), "oe-pkgdata-util"), | 589 | # we need to write the list of installed packages to a file because the |
599 | "-p", self.d.getVar('PKGDATA_DIR', True), "glob", installed_pkgs_file, | 590 | # oe-pkgdata-util reads it from a file |
600 | globs] | 591 | with tempfile.NamedTemporaryFile(mode="w+", prefix="installed-pkgs") as installed_pkgs: |
601 | exclude = self.d.getVar('PACKAGE_EXCLUDE_COMPLEMENTARY', True) | 592 | pkgs = self.list_installed() |
602 | if exclude: | 593 | output = oe.utils.format_pkg_list(pkgs, "arch") |
603 | cmd.extend(['--exclude=' + '|'.join(exclude.split())]) | 594 | installed_pkgs.write(output) |
604 | try: | 595 | |
605 | bb.note("Installing complementary packages ...") | 596 | cmd = [bb.utils.which(os.getenv('PATH'), "oe-pkgdata-util"), |
606 | bb.note('Running %s' % cmd) | 597 | "-p", self.d.getVar('PKGDATA_DIR', True), "glob", installed_pkgs.name, |
607 | complementary_pkgs = subprocess.check_output(cmd, stderr=subprocess.STDOUT).decode("utf-8") | 598 | globs] |
608 | except subprocess.CalledProcessError as e: | 599 | exclude = self.d.getVar('PACKAGE_EXCLUDE_COMPLEMENTARY', True) |
609 | bb.fatal("Could not compute complementary packages list. Command " | 600 | if exclude: |
610 | "'%s' returned %d:\n%s" % | 601 | cmd.extend(['--exclude=' + '|'.join(exclude.split())]) |
611 | (' '.join(cmd), e.returncode, e.output.decode("utf-8"))) | 602 | try: |
612 | self.install(complementary_pkgs.split(), attempt_only=True) | 603 | bb.note("Installing complementary packages ...") |
613 | os.remove(installed_pkgs_file) | 604 | bb.note('Running %s' % cmd) |
605 | complementary_pkgs = subprocess.check_output(cmd, stderr=subprocess.STDOUT).decode("utf-8") | ||
606 | except subprocess.CalledProcessError as e: | ||
607 | bb.fatal("Could not compute complementary packages list. Command " | ||
608 | "'%s' returned %d:\n%s" % | ||
609 | (' '.join(cmd), e.returncode, e.output.decode("utf-8"))) | ||
610 | self.install(complementary_pkgs.split(), attempt_only=True) | ||
614 | 611 | ||
615 | def deploy_dir_lock(self): | 612 | def deploy_dir_lock(self): |
616 | if self.deploy_dir is None: | 613 | if self.deploy_dir is None: |