aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArmin Kuster <akuster808@gmail.com>2019-10-17 08:21:40 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-10-17 16:45:19 +0100
commit5110080fbecd3f1cf43797c7eeb742951d88d1a8 (patch)
treef478e2327ea2355634f0cc064fe9547ebf54772f
parentbace400528115927ed0efa3cd941c9f9f128a555 (diff)
downloadopenembedded-core-contrib-5110080fbecd3f1cf43797c7eeb742951d88d1a8.tar.gz
Revert "OpkgPM: use --add-ignore-recommends to process BAD_RECOMMENDATIONS"
This reverts commit e8cd30ba6cec854d85c7ad47edc208107858a5d7. This backport introduced an issue not seen the AB QA. Issue can be seen if BAD_RECOMMENDATIONS_append = " udev-hwdb" is used Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oe/package_manager.py41
-rw-r--r--meta/lib/oe/rootfs.py2
2 files changed, 41 insertions, 2 deletions
diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py
index 7d8804811c..882e7c429f 100644
--- a/meta/lib/oe/package_manager.py
+++ b/meta/lib/oe/package_manager.py
@@ -1329,8 +1329,6 @@ class OpkgPM(OpkgDpkgPM):
cmd = "%s %s" % (self.opkg_cmd, self.opkg_args)
for exclude in (self.d.getVar("PACKAGE_EXCLUDE") or "").split():
cmd += " --add-exclude %s" % exclude
- for bad_recommendation in (self.d.getVar("BAD_RECOMMENDATIONS") or "").split():
- cmd += " --add-ignore-recommends %s" % bad_recommendation
cmd += " install "
cmd += " ".join(pkgs)
@@ -1399,6 +1397,45 @@ class OpkgPM(OpkgDpkgPM):
def list_installed(self):
return OpkgPkgsList(self.d, self.target_rootfs, self.config_file).list_pkgs()
+ def handle_bad_recommendations(self):
+ bad_recommendations = self.d.getVar("BAD_RECOMMENDATIONS") or ""
+ if bad_recommendations.strip() == "":
+ return
+
+ status_file = os.path.join(self.opkg_dir, "status")
+
+ # If status file existed, it means the bad recommendations has already
+ # been handled
+ if os.path.exists(status_file):
+ return
+
+ cmd = "%s %s info " % (self.opkg_cmd, self.opkg_args)
+
+ with open(status_file, "w+") as status:
+ for pkg in bad_recommendations.split():
+ pkg_info = cmd + pkg
+
+ try:
+ output = subprocess.check_output(pkg_info.split(), stderr=subprocess.STDOUT).strip().decode("utf-8")
+ except subprocess.CalledProcessError as e:
+ bb.fatal("Cannot get package info. Command '%s' "
+ "returned %d:\n%s" % (pkg_info, e.returncode, e.output.decode("utf-8")))
+
+ if output == "":
+ bb.note("Ignored bad recommendation: '%s' is "
+ "not a package" % pkg)
+ continue
+
+ for line in output.split('\n'):
+ if line.startswith("Status:"):
+ status.write("Status: deinstall hold not-installed\n")
+ else:
+ status.write(line + "\n")
+
+ # Append a blank line after each package entry to ensure that it
+ # is separated from the following entry
+ status.write("\n")
+
def dummy_install(self, pkgs):
"""
The following function dummy installs pkgs and returns the log of output.
diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py
index aa9fb2e0b5..e5512d09ef 100644
--- a/meta/lib/oe/rootfs.py
+++ b/meta/lib/oe/rootfs.py
@@ -879,6 +879,8 @@ class OpkgRootfs(DpkgOpkgRootfs):
self.pm.update()
+ self.pm.handle_bad_recommendations()
+
if self.progress_reporter:
self.progress_reporter.next_stage()