diff options
Diffstat (limited to 'meta/lib/oe/package_manager/__init__.py')
-rw-r--r-- | meta/lib/oe/package_manager/__init__.py | 78 |
1 files changed, 43 insertions, 35 deletions
diff --git a/meta/lib/oe/package_manager/__init__.py b/meta/lib/oe/package_manager/__init__.py index 88bc5ab195..b9a4218939 100644 --- a/meta/lib/oe/package_manager/__init__.py +++ b/meta/lib/oe/package_manager/__init__.py | |||
@@ -32,7 +32,7 @@ def create_index(arg): | |||
32 | 32 | ||
33 | def opkg_query(cmd_output): | 33 | def opkg_query(cmd_output): |
34 | """ | 34 | """ |
35 | This method parse the output from the package managerand return | 35 | This method parse the output from the package manager and return |
36 | a dictionary with the information of the packages. This is used | 36 | a dictionary with the information of the packages. This is used |
37 | when the packages are in deb or ipk format. | 37 | when the packages are in deb or ipk format. |
38 | """ | 38 | """ |
@@ -369,40 +369,48 @@ class PackageManager(object, metaclass=ABCMeta): | |||
369 | if globs: | 369 | if globs: |
370 | # we need to write the list of installed packages to a file because the | 370 | # we need to write the list of installed packages to a file because the |
371 | # oe-pkgdata-util reads it from a file | 371 | # oe-pkgdata-util reads it from a file |
372 | with tempfile.NamedTemporaryFile(mode="w+", prefix="installed-pkgs") as installed_pkgs: | 372 | with tempfile.NamedTemporaryFile(mode="w+", prefix="all-pkgs") as all_pkgs: |
373 | pkgs = self.list_installed() | 373 | with tempfile.NamedTemporaryFile(mode="w+", prefix="installed-pkgs") as installed_pkgs: |
374 | 374 | pkgs = self.list_installed() | |
375 | provided_pkgs = set() | 375 | |
376 | for pkg in pkgs.values(): | 376 | provided_pkgs = set() |
377 | provided_pkgs |= set(pkg.get('provs', [])) | 377 | for pkg in pkgs.values(): |
378 | 378 | provided_pkgs |= set(pkg.get('provs', [])) | |
379 | output = oe.utils.format_pkg_list(pkgs, "arch") | 379 | |
380 | installed_pkgs.write(output) | 380 | output = oe.utils.format_pkg_list(pkgs, "arch") |
381 | installed_pkgs.flush() | 381 | installed_pkgs.write(output) |
382 | 382 | installed_pkgs.flush() | |
383 | cmd = ["oe-pkgdata-util", | 383 | |
384 | "-p", self.d.getVar('PKGDATA_DIR'), "glob", installed_pkgs.name, | 384 | cmd = ["oe-pkgdata-util", |
385 | globs] | 385 | "-p", self.d.getVar('PKGDATA_DIR'), "glob", |
386 | exclude = self.d.getVar('PACKAGE_EXCLUDE_COMPLEMENTARY') | 386 | installed_pkgs.name, globs] |
387 | if exclude: | 387 | |
388 | cmd.extend(['--exclude=' + '|'.join(exclude.split())]) | 388 | if hasattr(self, "list_all"): |
389 | try: | 389 | output_allpkg = self.list_all() |
390 | bb.note('Running %s' % cmd) | 390 | all_pkgs.write(output_allpkg) |
391 | proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | 391 | all_pkgs.flush() |
392 | stdout, stderr = proc.communicate() | 392 | cmd.extend(["--allpkgs=%s" % all_pkgs.name]) |
393 | if stderr: bb.note(stderr.decode("utf-8")) | 393 | |
394 | complementary_pkgs = stdout.decode("utf-8") | 394 | exclude = self.d.getVar('PACKAGE_EXCLUDE_COMPLEMENTARY') |
395 | complementary_pkgs = set(complementary_pkgs.split()) | 395 | if exclude: |
396 | skip_pkgs = sorted(complementary_pkgs & provided_pkgs) | 396 | cmd.extend(['--exclude=' + '|'.join(exclude.split())]) |
397 | install_pkgs = sorted(complementary_pkgs - provided_pkgs) | 397 | try: |
398 | bb.note("Installing complementary packages ... %s (skipped already provided packages %s)" % ( | 398 | bb.note('Running %s' % cmd) |
399 | ' '.join(install_pkgs), | 399 | proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
400 | ' '.join(skip_pkgs))) | 400 | stdout, stderr = proc.communicate() |
401 | self.install(install_pkgs, hard_depends_only=True) | 401 | if stderr: bb.note(stderr.decode("utf-8")) |
402 | except subprocess.CalledProcessError as e: | 402 | complementary_pkgs = stdout.decode("utf-8") |
403 | bb.fatal("Could not compute complementary packages list. Command " | 403 | complementary_pkgs = set(complementary_pkgs.split()) |
404 | "'%s' returned %d:\n%s" % | 404 | skip_pkgs = sorted(complementary_pkgs & provided_pkgs) |
405 | (' '.join(cmd), e.returncode, e.output.decode("utf-8"))) | 405 | install_pkgs = sorted(complementary_pkgs - provided_pkgs) |
406 | bb.note("Installing complementary packages ... %s (skipped already provided packages %s)" % ( | ||
407 | ' '.join(install_pkgs), | ||
408 | ' '.join(skip_pkgs))) | ||
409 | self.install(install_pkgs, hard_depends_only=True) | ||
410 | except subprocess.CalledProcessError as e: | ||
411 | bb.fatal("Could not compute complementary packages list. Command " | ||
412 | "'%s' returned %d:\n%s" % | ||
413 | (' '.join(cmd), e.returncode, e.output.decode("utf-8"))) | ||
406 | 414 | ||
407 | if self.d.getVar('IMAGE_LOCALES_ARCHIVE') == '1': | 415 | if self.d.getVar('IMAGE_LOCALES_ARCHIVE') == '1': |
408 | target_arch = self.d.getVar('TARGET_ARCH') | 416 | target_arch = self.d.getVar('TARGET_ARCH') |