]>
Commit | Line | Data |
---|---|---|
deda9a51 MM |
1 | import re |
2 | import string | |
3 | ||
4 | import chroot | |
5 | ||
6 | def install_br(r, b): | |
7 | cmd = "cd rpm/SPECS; TMPDIR=$HOME/%s rpmbuild --nobuild %s %s 2>&1" \ | |
8 | % (b.b_id, b.bconds_string(), b.spec) | |
9 | f = chroot.popen(cmd) | |
aeeda744 | 10 | rx = re.compile(r"^\s*([^\s]+) .*is needed by") |
deda9a51 | 11 | needed = {} |
c901112f | 12 | b.log_line("checking BR") |
deda9a51 | 13 | for l in f.xreadlines(): |
c901112f | 14 | b.log_line("rpm: %s" % l) |
deda9a51 MM |
15 | m = rx.search(l) |
16 | if m: needed[m.group(1)] = 1 | |
17 | f.close() | |
18 | if len(needed) == 0: | |
c901112f | 19 | b.log_line("no BR needed") |
deda9a51 | 20 | return |
87af8ed6 AM |
21 | nbr = "" |
22 | for bre in needed.keys(): | |
23 | nbr = nbr + " " + re.escape(bre) | |
24 | br = string.strip(nbr) | |
deda9a51 | 25 | b.log_line("installing BR: %s" % br) |
87af8ed6 | 26 | res = chroot.run("poldek --up; poldek --upa; poldek --unique-pkg-names -v --upgrade %s" % br, |
deda9a51 MM |
27 | user = "root", |
28 | logfile = b.logfile) | |
29 | if res != 0: | |
30 | b.log_line("error: BR installation failed") | |
8410bf58 | 31 | return res |