summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/package_manager.py
diff options
context:
space:
mode:
authorAlejandro del Castillo <alejandro.delcastillo@ni.com>2019-02-07 09:57:59 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-02-08 10:57:19 +0000
commitd8e12f2bfc4deaa0dc7530cf3af905e18e8037f6 (patch)
treefc91365b4cbe3f67cfa9e4f24849d2c9e95567f0 /meta/lib/oe/package_manager.py
parentdf31968a4cc0076bd2f7143b2c9286c45845207c (diff)
downloadpoky-d8e12f2bfc4deaa0dc7530cf3af905e18e8037f6.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) Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe/package_manager.py')
-rw-r--r--meta/lib/oe/package_manager.py41
1 files changed, 2 insertions, 39 deletions
diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py
index 955914bb48..f5cd7454d7 100644
--- a/meta/lib/oe/package_manager.py
+++ b/meta/lib/oe/package_manager.py
@@ -1336,6 +1336,8 @@ class OpkgPM(OpkgDpkgPM):
1336 cmd = "%s %s" % (self.opkg_cmd, self.opkg_args) 1336 cmd = "%s %s" % (self.opkg_cmd, self.opkg_args)
1337 for exclude in (self.d.getVar("PACKAGE_EXCLUDE") or "").split(): 1337 for exclude in (self.d.getVar("PACKAGE_EXCLUDE") or "").split():
1338 cmd += " --add-exclude %s" % exclude 1338 cmd += " --add-exclude %s" % exclude
1339 for bad_recommendation in (self.d.getVar("BAD_RECOMMENDATIONS") or "").split():
1340 cmd += " --add-ignore-recommends %s" % bad_recommendation
1339 cmd += " install " 1341 cmd += " install "
1340 cmd += " ".join(pkgs) 1342 cmd += " ".join(pkgs)
1341 1343
@@ -1404,45 +1406,6 @@ class OpkgPM(OpkgDpkgPM):
1404 def list_installed(self): 1406 def list_installed(self):
1405 return OpkgPkgsList(self.d, self.target_rootfs, self.config_file).list_pkgs() 1407 return OpkgPkgsList(self.d, self.target_rootfs, self.config_file).list_pkgs()
1406 1408
1407 def handle_bad_recommendations(self):
1408 bad_recommendations = self.d.getVar("BAD_RECOMMENDATIONS") or ""
1409 if bad_recommendations.strip() == "":
1410 return
1411
1412 status_file = os.path.join(self.opkg_dir, "status")
1413
1414 # If status file existed, it means the bad recommendations has already
1415 # been handled
1416 if os.path.exists(status_file):
1417 return
1418
1419 cmd = "%s %s info " % (self.opkg_cmd, self.opkg_args)
1420
1421 with open(status_file, "w+") as status:
1422 for pkg in bad_recommendations.split():
1423 pkg_info = cmd + pkg
1424
1425 try:
1426 output = subprocess.check_output(pkg_info.split(), stderr=subprocess.STDOUT).strip().decode("utf-8")
1427 except subprocess.CalledProcessError as e:
1428 bb.fatal("Cannot get package info. Command '%s' "
1429 "returned %d:\n%s" % (pkg_info, e.returncode, e.output.decode("utf-8")))
1430
1431 if output == "":
1432 bb.note("Ignored bad recommendation: '%s' is "
1433 "not a package" % pkg)
1434 continue
1435
1436 for line in output.split('\n'):
1437 if line.startswith("Status:"):
1438 status.write("Status: deinstall hold not-installed\n")
1439 else:
1440 status.write(line + "\n")
1441
1442 # Append a blank line after each package entry to ensure that it
1443 # is separated from the following entry
1444 status.write("\n")
1445
1446 def dummy_install(self, pkgs): 1409 def dummy_install(self, pkgs):
1447 """ 1410 """
1448 The following function dummy installs pkgs and returns the log of output. 1411 The following function dummy installs pkgs and returns the log of output.