Patchwork [2/5] package_manager.py: tweak handle_bad_recommendations for ipk incremental image generation

login
register
mail settings
Submitter Hongxu Jia
Date Feb. 18, 2014, 9:42 a.m.
Message ID <1e5d48e5fd1de1a728a69398182242c1b05ec229.1392716065.git.hongxu.jia@windriver.com>
Download mbox | patch
Permalink /patch/66899/
State New
Headers show

Comments

Hongxu Jia - Feb. 18, 2014, 9:42 a.m.
Let opkg_dir be configurable in handle_bad_recommendations,
so it could work on other root fs.

Invoke handle_bad_recommendations in dump_install_solution
which simulates package install on other root fs.

[YOCTO #1894]
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 meta/lib/oe/package_manager.py | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

Patch

diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py
index 4ea9677..3cfd4af 100644
--- a/meta/lib/oe/package_manager.py
+++ b/meta/lib/oe/package_manager.py
@@ -1157,12 +1157,19 @@  class OpkgPM(PackageManager):
 
         return output
 
-    def handle_bad_recommendations(self):
-        bad_recommendations = self.d.getVar("BAD_RECOMMENDATIONS", True)
-        if bad_recommendations is None:
+    def handle_bad_recommendations(self, opkg_dir=""):
+        bad_recommendations = self.d.getVar("BAD_RECOMMENDATIONS", True) or ""
+        if bad_recommendations.strip() == "":
             return
 
-        status_file = os.path.join(self.opkg_dir, "status")
+        if opkg_dir == "":
+            opkg_dir = self.opkg_dir
+        status_file = os.path.join(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)
 
@@ -1177,7 +1184,7 @@  class OpkgPM(PackageManager):
                              "returned %d:\n%s" % (pkg_info, e.returncode, e.output))
 
                 if output == "":
-                    bb.note("Requested ignored recommendation $i is "
+                    bb.note("Requested ignored recommendation %s is "
                             "not a package" % pkg)
                     continue
 
@@ -1204,6 +1211,7 @@  class OpkgPM(PackageManager):
         temp_rootfs = self.d.expand('${T}/opkg')
         temp_opkg_dir = os.path.join(temp_rootfs, 'var/lib/opkg')
         bb.utils.mkdirhier(temp_opkg_dir)
+        self.handle_bad_recommendations(temp_opkg_dir)
 
         opkg_args = "-f %s -o %s " % (self.config_file, temp_rootfs)
         opkg_args += self.d.getVar("OPKG_ARGS", True)