diff options
author | Jan Luebbe <jlu@pengutronix.de> | 2020-04-01 16:58:04 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-04-02 15:24:59 +0100 |
commit | cb180dc45fbd8ad11658348e856e5f6b9d8dc2e8 (patch) | |
tree | d2bb3ef020cc9d66dd6f8e84b3df94c9437eb986 /meta/lib/oe | |
parent | 28642102360776c80909fbe5d6d979db541a60de (diff) | |
download | poky-cb180dc45fbd8ad11658348e856e5f6b9d8dc2e8.tar.gz |
lib/oe/package_manager: avoid installing provided packages via apt
If there already is a package providing (and conflicting against)
packages what should be installed, apt will try remove the conflicting
package (target-sdk-provides-dummy) and any that depend on it (like apt
and dpkg). This usually fails because of the protection of essential
packages. In that case, no -dev/-dbg packages are installed to the SDK.
Avoid this problem by checking which packages are already provided and
removing them from the list to be installed. Also sort the list to make
it easier to read when debugging.
(From OE-Core rev: 3ffb339dd55f8ca7c952fd3390608510f772e19f)
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe')
-rw-r--r-- | meta/lib/oe/package_manager.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py index e862915b1b..2a5d7ef539 100644 --- a/meta/lib/oe/package_manager.py +++ b/meta/lib/oe/package_manager.py | |||
@@ -581,6 +581,11 @@ class PackageManager(object, metaclass=ABCMeta): | |||
581 | # oe-pkgdata-util reads it from a file | 581 | # oe-pkgdata-util reads it from a file |
582 | with tempfile.NamedTemporaryFile(mode="w+", prefix="installed-pkgs") as installed_pkgs: | 582 | with tempfile.NamedTemporaryFile(mode="w+", prefix="installed-pkgs") as installed_pkgs: |
583 | pkgs = self.list_installed() | 583 | pkgs = self.list_installed() |
584 | |||
585 | provided_pkgs = set() | ||
586 | for pkg in pkgs.values(): | ||
587 | provided_pkgs |= set(pkg.get('provs', [])) | ||
588 | |||
584 | output = oe.utils.format_pkg_list(pkgs, "arch") | 589 | output = oe.utils.format_pkg_list(pkgs, "arch") |
585 | installed_pkgs.write(output) | 590 | installed_pkgs.write(output) |
586 | installed_pkgs.flush() | 591 | installed_pkgs.flush() |
@@ -592,10 +597,15 @@ class PackageManager(object, metaclass=ABCMeta): | |||
592 | if exclude: | 597 | if exclude: |
593 | cmd.extend(['--exclude=' + '|'.join(exclude.split())]) | 598 | cmd.extend(['--exclude=' + '|'.join(exclude.split())]) |
594 | try: | 599 | try: |
595 | bb.note("Installing complementary packages ...") | ||
596 | bb.note('Running %s' % cmd) | 600 | bb.note('Running %s' % cmd) |
597 | complementary_pkgs = subprocess.check_output(cmd, stderr=subprocess.STDOUT).decode("utf-8") | 601 | complementary_pkgs = subprocess.check_output(cmd, stderr=subprocess.STDOUT).decode("utf-8") |
598 | self.install(complementary_pkgs.split(), attempt_only=True) | 602 | complementary_pkgs = set(complementary_pkgs.split()) |
603 | skip_pkgs = sorted(complementary_pkgs & provided_pkgs) | ||
604 | install_pkgs = sorted(complementary_pkgs - provided_pkgs) | ||
605 | bb.note("Installing complementary packages ... %s (skipped already provided packages %s)" % ( | ||
606 | ' '.join(install_pkgs), | ||
607 | ' '.join(skip_pkgs))) | ||
608 | self.install(install_pkgs, attempt_only=True) | ||
599 | except subprocess.CalledProcessError as e: | 609 | except subprocess.CalledProcessError as e: |
600 | bb.fatal("Could not compute complementary packages list. Command " | 610 | bb.fatal("Could not compute complementary packages list. Command " |
601 | "'%s' returned %d:\n%s" % | 611 | "'%s' returned %d:\n%s" % |