summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/package_manager.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oe/package_manager.py')
-rw-r--r--meta/lib/oe/package_manager.py41
1 files changed, 39 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):
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
1334 cmd += " install " 1332 cmd += " install "
1335 cmd += " ".join(pkgs) 1333 cmd += " ".join(pkgs)
1336 1334
@@ -1399,6 +1397,45 @@ class OpkgPM(OpkgDpkgPM):
1399 def list_installed(self): 1397 def list_installed(self):
1400 return OpkgPkgsList(self.d, self.target_rootfs, self.config_file).list_pkgs() 1398 return OpkgPkgsList(self.d, self.target_rootfs, self.config_file).list_pkgs()
1401 1399
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
1402 def dummy_install(self, pkgs): 1439 def dummy_install(self, pkgs):
1403 """ 1440 """
1404 The following function dummy installs pkgs and returns the log of output. 1441 The following function dummy installs pkgs and returns the log of output.