summaryrefslogtreecommitdiffstats
path: root/meta/packages/yum/yum-native/yum-install-recommends.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/packages/yum/yum-native/yum-install-recommends.py')
-rwxr-xr-xmeta/packages/yum/yum-native/yum-install-recommends.py39
1 files changed, 39 insertions, 0 deletions
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
index 0000000000..64716f2c3e
--- /dev/null
+++ b/meta/packages/yum/yum-native/yum-install-recommends.py
@@ -0,0 +1,39 @@
1#!/usr/bin/env python
2import os, sys
3
4root = sys.argv[1]
5installcmd = sys.argv[2]
6
7#
8# Take an rpm image and look through for Recommends:. For each recommends
9# found, try and install any matching packages including any Recommends for
10# packages installed by us.
11#
12
13
14def get_recommends():
15 deps = []
16 output = os.popen("rpm --root %s -aq --recommends" % (root))
17 lines = output.readlines()
18 for line in lines:
19 line = line.replace("(none)","")
20 if line:
21 deps.append(line.split()[0])
22 return deps
23
24processed = []
25
26while True:
27 toinstall = []
28 recommends = set(get_recommends())
29 for item in recommends:
30 if item not in processed:
31 toinstall.append(item)
32 if len(toinstall) != 0:
33 print "Installing %s" % " ".join(toinstall)
34 os.system("%s %s" % (installcmd, " ".join(toinstall)))
35 else:
36 break
37 processed.extend(toinstall)
38
39