]> code.ossystems Code Review - openembedded-core.git/commitdiff
yum: Add yum-install-recommends.py script to handle installing Recommends
authorRichard Purdie <richard@openedhand.com>
Mon, 8 Sep 2008 11:17:17 +0000 (11:17 +0000)
committerRichard Purdie <richard@openedhand.com>
Mon, 8 Sep 2008 11:17:17 +0000 (11:17 +0000)
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@5157 311d38ba-8fff-0310-9ca6-ca027cbcb966

meta/packages/yum/yum-native/yum-install-recommends.py [new file with mode: 0755]
meta/packages/yum/yum-native_3.2.18.bb

diff --git a/meta/packages/yum/yum-native/yum-install-recommends.py b/meta/packages/yum/yum-native/yum-install-recommends.py
new file mode 100755 (executable)
index 0000000..64716f2
--- /dev/null
@@ -0,0 +1,39 @@
+#!/usr/bin/env python
+import os, sys
+
+root = sys.argv[1]
+installcmd = sys.argv[2]
+
+#
+# Take an rpm image and look through for Recommends:. For each recommends 
+# found, try and install any matching packages including any Recommends for
+# packages installed by us.
+#
+
+
+def get_recommends():
+    deps = []
+    output = os.popen("rpm --root %s -aq --recommends" % (root))
+    lines = output.readlines()
+    for line in lines:
+        line = line.replace("(none)","")
+        if line:
+            deps.append(line.split()[0])
+    return deps
+
+processed = []
+
+while True:
+    toinstall = []
+    recommends = set(get_recommends())
+    for item in recommends:
+        if item not in processed:
+            toinstall.append(item)
+    if len(toinstall) != 0:
+        print "Installing %s" % " ".join(toinstall)
+        os.system("%s %s" % (installcmd, " ".join(toinstall)))
+    else:
+        break
+    processed.extend(toinstall)
+
+    
index 76e92b34a9b6ad334f29e0da393b9ff8ccc6ec50..60dafe3265859d667d0aa216903582d26ae36904 100644 (file)
@@ -3,8 +3,9 @@ HOMEPAGE = "http://linux.duke.edu/projects/yum/"
 SRC_URI = "http://linux.duke.edu/projects/yum/download/3.2/yum-${PV}.tar.gz \
            file://hacks.patch;patch=1 \
            file://paths.patch;patch=1 \
+          file://yum-install-recommends.py \
           file://extract-postinst.awk"
-PR = "r4"
+PR = "r5"
 
 DEPENDS = "rpm-native python-native python-iniparse-native python-urlgrabber-native yum-metadata-parser-native libxml2-native"
 
@@ -20,4 +21,5 @@ do_compile_append () {
 do_install_append () {
        install -d ${STAGING_BINDIR}/
        install ${WORKDIR}/extract-postinst.awk ${STAGING_BINDIR}/
+       install ${WORKDIR}/yum-install-recommends.py ${STAGING_BINDIR}/
 }