summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro del Castillo <alejandro.delcastillo@ni.com>2019-06-11 16:46:48 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-07-29 23:50:43 +0100
commite8cd30ba6cec854d85c7ad47edc208107858a5d7 (patch)
tree77a33ed60c9583c99d214b8703bef06b48fe553f
parenteecc4121ad3efac4242b023245bccc21439ecc1f (diff)
downloadpoky-e8cd30ba6cec854d85c7ad47edc208107858a5d7.tar.gz
OpkgPM: use --add-ignore-recommends to process BAD_RECOMMENDATIONS
Currently, BAD_RECOMMENDATIONS on the opkg backed relies on editing the opkg status file (it sets BAD_RECOMMENDATIONS pkg want state to deinstalled and pinned). This is brittle, and not consistent across the different solver backends. Use new --add-ignore-recommends flag instead. (From OE-Core rev: 0d11e813ba9b4e8de9e6e5099ff85f5d914243bc) (From OE-Core rev: bfb0acb6bc6bc11e4aa2c9527916359e1a763e85) (From OE-Core rev: 13ba66338d16cc07cb0129de932f090d0edb7760) Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Armin Kuster <akuster808@gmail.com> 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, 2 insertions, 41 deletions
diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py
index 882e7c429f..7d8804811c 100644
--- a/meta/lib/oe/package_manager.py
+++ b/meta/lib/oe/package_manager.py
@@ -1329,6 +1329,8 @@ class OpkgPM(OpkgDpkgPM):
1329 cmd = "%s %s" % (self.opkg_cmd, self.opkg_args) 1329 cmd = "%s %s" % (self.opkg_cmd, self.opkg_args)
1330 for exclude in (self.d.getVar("PACKAGE_EXCLUDE") or "").split(): 1330 for exclude in (self.d.getVar("PACKAGE_EXCLUDE") or "").split():
1331 cmd += " --add-exclude %s" % exclude 1331 cmd += " --add-exclude %s" % exclude
1332 for bad_recommendation in (self.d.getVar("BAD_RECOMMENDATIONS") or "").split():
1333 cmd += " --add-ignore-recommends %s" % bad_recommendation
1332 cmd += " install " 1334 cmd += " install "
1333 cmd += " ".join(pkgs) 1335 cmd += " ".join(pkgs)
1334 1336
@@ -1397,45 +1399,6 @@ class OpkgPM(OpkgDpkgPM):
1397 def list_installed(self): 1399 def list_installed(self):
1398 return OpkgPkgsList(self.d, self.target_rootfs, self.config_file).list_pkgs() 1400 return OpkgPkgsList(self.d, self.target_rootfs, self.config_file).list_pkgs()
1399 1401
1400 def handle_bad_recommendations(self):
1401 bad_recommendations = self.d.getVar("BAD_RECOMMENDATIONS") or ""
1402 if bad_recommendations.strip() == "":
1403 return
1404
1405 status_file = os.path.join(self.opkg_dir, "status")
1406
1407 # If status file existed, it means the bad recommendations has already
1408 # been handled
1409 if os.path.exists(status_file):
1410 return
1411
1412 cmd = "%s %s info " % (self.opkg_cmd, self.opkg_args)
1413
1414 with open(status_file, "w+") as status:
1415 for pkg in bad_recommendations.split():
1416 pkg_info = cmd + pkg
1417
1418 try:
1419 output = subprocess.check_output(pkg_info.split(), stderr=subprocess.STDOUT).strip().decode("utf-8")
1420 except subprocess.CalledProcessError as e:
1421 bb.fatal("Cannot get package info. Command '%s' "
1422 "returned %d:\n%s" % (pkg_info, e.returncode, e.output.decode("utf-8")))
1423
1424 if output == "":
1425 bb.note("Ignored bad recommendation: '%s' is "
1426 "not a package" % pkg)
1427 continue
1428
1429 for line in output.split('\n'):
1430 if line.startswith("Status:"):
1431 status.write("Status: deinstall hold not-installed\n")
1432 else:
1433 status.write(line + "\n")
1434
1435 # Append a blank line after each package entry to ensure that it
1436 # is separated from the following entry
1437 status.write("\n")
1438
1439 def dummy_install(self, pkgs): 1402 def dummy_install(self, pkgs):
1440 """ 1403 """
1441 The following function dummy installs pkgs and returns the log of output. 1404 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 e5512d09ef..aa9fb2e0b5 100644
--- a/meta/lib/oe/rootfs.py
+++ b/meta/lib/oe/rootfs.py
@@ -879,8 +879,6 @@ class OpkgRootfs(DpkgOpkgRootfs):
879 879
880 self.pm.update() 880 self.pm.update()
881 881
882 self.pm.handle_bad_recommendations()
883
884 if self.progress_reporter: 882 if self.progress_reporter:
885 self.progress_reporter.next_stage() 883 self.progress_reporter.next_stage()
886 884