diff options
| -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 60d6e52a58..f7190cf0b9 100644 --- a/meta/lib/oe/package_manager.py +++ b/meta/lib/oe/package_manager.py | |||
| @@ -377,15 +377,6 @@ class PackageManager(object, metaclass=ABCMeta): | |||
| 377 | installation | 377 | installation |
| 378 | """ | 378 | """ |
| 379 | def install_complementary(self, globs=None): | 379 | def install_complementary(self, globs=None): |
| 380 | # we need to write the list of installed packages to a file because the | ||
| 381 | # oe-pkgdata-util reads it from a file | ||
| 382 | installed_pkgs_file = os.path.join(self.d.getVar('WORKDIR'), | ||
| 383 | "installed_pkgs.txt") | ||
| 384 | with open(installed_pkgs_file, "w+") as installed_pkgs: | ||
| 385 | pkgs = self.list_installed() | ||
| 386 | output = oe.utils.format_pkg_list(pkgs, "arch") | ||
| 387 | installed_pkgs.write(output) | ||
| 388 | |||
| 389 | if globs is None: | 380 | if globs is None: |
| 390 | globs = self.d.getVar('IMAGE_INSTALL_COMPLEMENTARY') | 381 | globs = self.d.getVar('IMAGE_INSTALL_COMPLEMENTARY') |
| 391 | split_linguas = set() | 382 | split_linguas = set() |
| @@ -402,22 +393,28 @@ class PackageManager(object, metaclass=ABCMeta): | |||
| 402 | if globs is None: | 393 | if globs is None: |
| 403 | return | 394 | return |
| 404 | 395 | ||
| 405 | cmd = [bb.utils.which(os.getenv('PATH'), "oe-pkgdata-util"), | 396 | # we need to write the list of installed packages to a file because the |
| 406 | "-p", self.d.getVar('PKGDATA_DIR'), "glob", installed_pkgs_file, | 397 | # oe-pkgdata-util reads it from a file |
| 407 | globs] | 398 | with tempfile.NamedTemporaryFile(mode="w+", prefix="installed-pkgs") as installed_pkgs: |
| 408 | exclude = self.d.getVar('PACKAGE_EXCLUDE_COMPLEMENTARY') | 399 | pkgs = self.list_installed() |
| 409 | if exclude: | 400 | output = oe.utils.format_pkg_list(pkgs, "arch") |
| 410 | cmd.extend(['--exclude=' + '|'.join(exclude.split())]) | 401 | installed_pkgs.write(output) |
| 411 | try: | 402 | |
| 412 | bb.note("Installing complementary packages ...") | 403 | cmd = [bb.utils.which(os.getenv('PATH'), "oe-pkgdata-util"), |
| 413 | bb.note('Running %s' % cmd) | 404 | "-p", self.d.getVar('PKGDATA_DIR'), "glob", installed_pkgs.name, |
| 414 | complementary_pkgs = subprocess.check_output(cmd, stderr=subprocess.STDOUT).decode("utf-8") | 405 | globs] |
| 415 | except subprocess.CalledProcessError as e: | 406 | exclude = self.d.getVar('PACKAGE_EXCLUDE_COMPLEMENTARY') |
| 416 | bb.fatal("Could not compute complementary packages list. Command " | 407 | if exclude: |
| 417 | "'%s' returned %d:\n%s" % | 408 | cmd.extend(['--exclude=' + '|'.join(exclude.split())]) |
| 418 | (' '.join(cmd), e.returncode, e.output.decode("utf-8"))) | 409 | try: |
| 419 | self.install(complementary_pkgs.split(), attempt_only=True) | 410 | bb.note("Installing complementary packages ...") |
| 420 | os.remove(installed_pkgs_file) | 411 | bb.note('Running %s' % cmd) |
| 412 | complementary_pkgs = subprocess.check_output(cmd, stderr=subprocess.STDOUT).decode("utf-8") | ||
| 413 | except subprocess.CalledProcessError as e: | ||
| 414 | bb.fatal("Could not compute complementary packages list. Command " | ||
| 415 | "'%s' returned %d:\n%s" % | ||
| 416 | (' '.join(cmd), e.returncode, e.output.decode("utf-8"))) | ||
| 417 | self.install(complementary_pkgs.split(), attempt_only=True) | ||
| 421 | 418 | ||
| 422 | def deploy_dir_lock(self): | 419 | def deploy_dir_lock(self): |
| 423 | if self.deploy_dir is None: | 420 | if self.deploy_dir is None: |
