diff options
Diffstat (limited to 'meta/lib/oe/package_manager.py')
-rw-r--r-- | meta/lib/oe/package_manager.py | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py index 7c373715ad..e0b15dc9b4 100644 --- a/meta/lib/oe/package_manager.py +++ b/meta/lib/oe/package_manager.py | |||
@@ -40,8 +40,9 @@ def opkg_query(cmd_output): | |||
40 | ver = "" | 40 | ver = "" |
41 | filename = "" | 41 | filename = "" |
42 | dep = [] | 42 | dep = [] |
43 | prov = [] | ||
43 | pkgarch = "" | 44 | pkgarch = "" |
44 | for line in cmd_output.splitlines(): | 45 | for line in cmd_output.splitlines()+['']: |
45 | line = line.rstrip() | 46 | line = line.rstrip() |
46 | if ':' in line: | 47 | if ':' in line: |
47 | if line.startswith("Package: "): | 48 | if line.startswith("Package: "): |
@@ -64,6 +65,10 @@ def opkg_query(cmd_output): | |||
64 | dep.append("%s [REC]" % recommend) | 65 | dep.append("%s [REC]" % recommend) |
65 | elif line.startswith("PackageArch: "): | 66 | elif line.startswith("PackageArch: "): |
66 | pkgarch = line.split(": ")[1] | 67 | pkgarch = line.split(": ")[1] |
68 | elif line.startswith("Provides: "): | ||
69 | provides = verregex.sub('', line.split(": ")[1]) | ||
70 | for provide in provides.split(", "): | ||
71 | prov.append(provide) | ||
67 | 72 | ||
68 | # When there is a blank line save the package information | 73 | # When there is a blank line save the package information |
69 | elif not line: | 74 | elif not line: |
@@ -72,20 +77,15 @@ def opkg_query(cmd_output): | |||
72 | filename = "%s_%s_%s.ipk" % (pkg, ver, arch) | 77 | filename = "%s_%s_%s.ipk" % (pkg, ver, arch) |
73 | if pkg: | 78 | if pkg: |
74 | output[pkg] = {"arch":arch, "ver":ver, | 79 | output[pkg] = {"arch":arch, "ver":ver, |
75 | "filename":filename, "deps": dep, "pkgarch":pkgarch } | 80 | "filename":filename, "deps": dep, "pkgarch":pkgarch, "provs": prov} |
76 | pkg = "" | 81 | pkg = "" |
77 | arch = "" | 82 | arch = "" |
78 | ver = "" | 83 | ver = "" |
79 | filename = "" | 84 | filename = "" |
80 | dep = [] | 85 | dep = [] |
86 | prov = [] | ||
81 | pkgarch = "" | 87 | pkgarch = "" |
82 | 88 | ||
83 | if pkg: | ||
84 | if not filename: | ||
85 | filename = "%s_%s_%s.ipk" % (pkg, ver, arch) | ||
86 | output[pkg] = {"arch":arch, "ver":ver, | ||
87 | "filename":filename, "deps": dep } | ||
88 | |||
89 | return output | 89 | return output |
90 | 90 | ||
91 | def failed_postinsts_abort(pkgs, log_path): | 91 | def failed_postinsts_abort(pkgs, log_path): |
@@ -360,7 +360,7 @@ class DpkgPkgsList(PkgsList): | |||
360 | "--admindir=%s/var/lib/dpkg" % self.rootfs_dir, | 360 | "--admindir=%s/var/lib/dpkg" % self.rootfs_dir, |
361 | "-W"] | 361 | "-W"] |
362 | 362 | ||
363 | cmd.append("-f=Package: ${Package}\nArchitecture: ${PackageArch}\nVersion: ${Version}\nFile: ${Package}_${Version}_${Architecture}.deb\nDepends: ${Depends}\nRecommends: ${Recommends}\n\n") | 363 | cmd.append("-f=Package: ${Package}\nArchitecture: ${PackageArch}\nVersion: ${Version}\nFile: ${Package}_${Version}_${Architecture}.deb\nDepends: ${Depends}\nRecommends: ${Recommends}\nProvides: ${Provides}\n\n") |
364 | 364 | ||
365 | try: | 365 | try: |
366 | cmd_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT).strip().decode("utf-8") | 366 | cmd_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT).strip().decode("utf-8") |
@@ -578,6 +578,11 @@ class PackageManager(object, metaclass=ABCMeta): | |||
578 | # oe-pkgdata-util reads it from a file | 578 | # oe-pkgdata-util reads it from a file |
579 | with tempfile.NamedTemporaryFile(mode="w+", prefix="installed-pkgs") as installed_pkgs: | 579 | with tempfile.NamedTemporaryFile(mode="w+", prefix="installed-pkgs") as installed_pkgs: |
580 | pkgs = self.list_installed() | 580 | pkgs = self.list_installed() |
581 | |||
582 | provided_pkgs = set() | ||
583 | for pkg in pkgs.values(): | ||
584 | provided_pkgs |= set(pkg.get('provs', [])) | ||
585 | |||
581 | output = oe.utils.format_pkg_list(pkgs, "arch") | 586 | output = oe.utils.format_pkg_list(pkgs, "arch") |
582 | installed_pkgs.write(output) | 587 | installed_pkgs.write(output) |
583 | installed_pkgs.flush() | 588 | installed_pkgs.flush() |
@@ -589,10 +594,15 @@ class PackageManager(object, metaclass=ABCMeta): | |||
589 | if exclude: | 594 | if exclude: |
590 | cmd.extend(['--exclude=' + '|'.join(exclude.split())]) | 595 | cmd.extend(['--exclude=' + '|'.join(exclude.split())]) |
591 | try: | 596 | try: |
592 | bb.note("Installing complementary packages ...") | ||
593 | bb.note('Running %s' % cmd) | 597 | bb.note('Running %s' % cmd) |
594 | complementary_pkgs = subprocess.check_output(cmd, stderr=subprocess.STDOUT).decode("utf-8") | 598 | complementary_pkgs = subprocess.check_output(cmd, stderr=subprocess.STDOUT).decode("utf-8") |
595 | self.install(complementary_pkgs.split(), attempt_only=True) | 599 | complementary_pkgs = set(complementary_pkgs.split()) |
600 | skip_pkgs = sorted(complementary_pkgs & provided_pkgs) | ||
601 | install_pkgs = sorted(complementary_pkgs - provided_pkgs) | ||
602 | bb.note("Installing complementary packages ... %s (skipped already provided packages %s)" % ( | ||
603 | ' '.join(install_pkgs), | ||
604 | ' '.join(skip_pkgs))) | ||
605 | self.install(install_pkgs, attempt_only=True) | ||
596 | except subprocess.CalledProcessError as e: | 606 | except subprocess.CalledProcessError as e: |
597 | bb.fatal("Could not compute complementary packages list. Command " | 607 | bb.fatal("Could not compute complementary packages list. Command " |
598 | "'%s' returned %d:\n%s" % | 608 | "'%s' returned %d:\n%s" % |
@@ -1619,7 +1629,7 @@ class DpkgPM(OpkgDpkgPM): | |||
1619 | 1629 | ||
1620 | os.environ['APT_CONFIG'] = self.apt_conf_file | 1630 | os.environ['APT_CONFIG'] = self.apt_conf_file |
1621 | 1631 | ||
1622 | cmd = "%s %s install --force-yes --allow-unauthenticated %s" % \ | 1632 | cmd = "%s %s install --force-yes --allow-unauthenticated --no-remove %s" % \ |
1623 | (self.apt_get_cmd, self.apt_args, ' '.join(pkgs)) | 1633 | (self.apt_get_cmd, self.apt_args, ' '.join(pkgs)) |
1624 | 1634 | ||
1625 | try: | 1635 | try: |
@@ -1781,8 +1791,7 @@ class DpkgPM(OpkgDpkgPM): | |||
1781 | open(os.path.join(target_dpkg_dir, "available"), "w+").close() | 1791 | open(os.path.join(target_dpkg_dir, "available"), "w+").close() |
1782 | 1792 | ||
1783 | def remove_packaging_data(self): | 1793 | def remove_packaging_data(self): |
1784 | bb.utils.remove(os.path.join(self.target_rootfs, | 1794 | bb.utils.remove(self.target_rootfs + self.d.getVar('opkglibdir'), True) |
1785 | self.d.getVar('opkglibdir')), True) | ||
1786 | bb.utils.remove(self.target_rootfs + "/var/lib/dpkg/", True) | 1795 | bb.utils.remove(self.target_rootfs + "/var/lib/dpkg/", True) |
1787 | 1796 | ||
1788 | def fix_broken_dependencies(self): | 1797 | def fix_broken_dependencies(self): |