[OE-core] [PATCH v2 22/33] package_manager/deb: implement BAD_RECOMMENDATIONS
Andreas Oberritter
obi at opendreambox.org
Thu Dec 8 21:47:46 UTC 2016
Signed-off-by: Andreas Oberritter <obi at opendreambox.org>
---
meta/classes/rootfs_deb.bbclass | 6 ------
meta/lib/oe/package_manager.py | 27 +++++++++++++++++++++++++++
meta/lib/oe/rootfs.py | 2 ++
3 files changed, 29 insertions(+), 6 deletions(-)
diff --git a/meta/classes/rootfs_deb.bbclass b/meta/classes/rootfs_deb.bbclass
index 332931e..bd8deaf 100644
--- a/meta/classes/rootfs_deb.bbclass
+++ b/meta/classes/rootfs_deb.bbclass
@@ -13,12 +13,6 @@ do_rootfs[vardeps] += "PACKAGE_FEED_URIS"
do_rootfs[lockfiles] += "${DEPLOY_DIR_DEB}/deb.lock"
do_populate_sdk[lockfiles] += "${DEPLOY_DIR_DEB}/deb.lock"
-python rootfs_deb_bad_recommendations() {
- if d.getVar("BAD_RECOMMENDATIONS", True):
- bb.warn("Debian package install does not support BAD_RECOMMENDATIONS")
-}
-do_rootfs[prefuncs] += "rootfs_deb_bad_recommendations"
-
DEB_POSTPROCESS_COMMANDS = ""
opkglibdir = "${localstatedir}/lib/opkg"
diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py
index b18148b..6c5b7ef 100644
--- a/meta/lib/oe/package_manager.py
+++ b/meta/lib/oe/package_manager.py
@@ -2198,6 +2198,33 @@ class DpkgPM(OpkgDpkgPM):
return tmp_dir
+ def handle_bad_recommendations(self):
+ bad_recommendations = (self.d.getVar("BAD_RECOMMENDATIONS", True) or "").strip()
+ if not bad_recommendations:
+ return
+
+ status_file = self.target_rootfs + "/var/lib/dpkg/status"
+
+ with open(status_file + ".tmp", "w") as status:
+ for pkg in bad_recommendations.split():
+ pkg_info = ('apt-cache', 'show', pkg)
+
+ try:
+ output = subprocess.check_output(pkg_info, stderr=subprocess.STDOUT).decode("utf-8")
+ except subprocess.CalledProcessError as e:
+ bb.fatal("Cannot get package info. Command '%s' "
+ "returned %d:\n%s" % (' '.join(pkg_info), e.returncode, e.output))
+
+ for line in output.splitlines():
+ if not line:
+ status.write("Status: hold ok not-installed\n\n")
+ break
+
+ if line.startswith(' ') or line.split(': ', 1)[0] not in ('Filename', 'Size', 'MD5sum', 'MSDOS-Filename'):
+ status.write(line + "\n")
+
+ os.rename(status_file + ".tmp", status_file)
+
def generate_index_files(d):
classes = d.getVar('PACKAGE_CLASSES', True).replace("package_", "").split()
diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py
index 4c82456..b2bb67b 100644
--- a/meta/lib/oe/rootfs.py
+++ b/meta/lib/oe/rootfs.py
@@ -663,6 +663,8 @@ class DpkgRootfs(DpkgOpkgRootfs):
self.pm.update()
+ self.pm.handle_bad_recommendations()
+
if self.progress_reporter:
self.progress_reporter.next_stage()
--
2.7.4
More information about the Openembedded-core
mailing list