Gentoo Archives: gentoo-commits

From: Nirbheek Chauhan <nirbheek@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/gnome:master commit in: scripts/
Date: Sun, 01 Apr 2012 21:15:11
Message-Id: 1333314831.74d3c3fe11a25f7413bd4f734a6fa5c839040178.nirbheek@gentoo
1 commit: 74d3c3fe11a25f7413bd4f734a6fa5c839040178
2 Author: Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
3 AuthorDate: Sun Apr 1 21:13:49 2012 +0000
4 Commit: Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
5 CommitDate: Sun Apr 1 21:13:51 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gnome.git;a=commit;h=74d3c3fe
7
8 scripts/gen_archlist.py: implement what pacho actually wanted
9
10 * If the input has no SLOT information, use the latest cpv in *all* slots
11
12 ---
13 scripts/gen_archlist.py | 58 +++++++++++++++++++++++++++++-----------------
14 1 files changed, 36 insertions(+), 22 deletions(-)
15
16 diff --git a/scripts/gen_archlist.py b/scripts/gen_archlist.py
17 index 8f0e9a8..fa26b90 100755
18 --- a/scripts/gen_archlist.py
19 +++ b/scripts/gen_archlist.py
20 @@ -388,6 +388,16 @@ def consolidate_dupes(cpv_kws):
21
22 return deduped_cpv_kws
23
24 +def get_per_slot_cpvs(cpvs):
25 + "Classify the given cpvs into slots, and yield the best atom for each slot"
26 + slots = set()
27 + for cpv in cpvs:
28 + slot = portage.portage.portdb.aux_get(cpv, ['SLOT'])[0]
29 + if slot in slots:
30 + continue
31 + slots.add(slot)
32 + yield cpv
33 +
34 def append_slots(cpv_kws):
35 "Append slots at the end of cpv atoms"
36 slotifyed_cpv_kws = []
37 @@ -453,32 +463,36 @@ if __name__ == "__main__":
38 array = []
39
40 for i in open(CP_FILE).readlines():
41 - cpv = i[:-1]
42 - if cpv.startswith('#') or cpv.isspace() or not cpv:
43 - ALL_CPV_KWS.append(cpv)
44 + cp = i[:-1]
45 + if cp.startswith('#') or cp.isspace() or not cp:
46 + ALL_CPV_KWS.append(cp)
47 continue
48 - if cpv.find('#') is not -1:
49 + if cp.find('#') is not -1:
50 raise Exception('Inline comments are not supported')
51 - if not portage.catpkgsplit(cpv):
52 - # It's actually a cp
53 - cpv = match_wanted_atoms(cpv, release=NEW_REL)
54 - if not cpv or not cpv[0]:
55 + if portage.catpkgsplit(cp):
56 + # categ/pkg is already a categ/pkg-ver
57 + atoms = [cp]
58 + else:
59 + # Get all the atoms matching the given cp
60 + cpvs = match_wanted_atoms(cp, release=NEW_REL)
61 +
62 + for cpv in get_per_slot_cpvs(cpvs):
63 + if not cpv:
64 debug('%s: Invalid cpv' % cpv)
65 continue
66 - cpv = cpv[0]
67 - kws_missing = max_kws(cpv, release=OLD_REL)
68 - if kws_missing == []:
69 - # Current cpv has the max keywords => nothing to do
70 - nothing_to_be_done(cpv)
71 - continue
72 - elif kws_missing == None:
73 - debug ('No versions with stable keywords for %s' % cpv)
74 - # No cpv with stable keywords => select latest
75 - arches = make_unstable(ARCHES)
76 - kws_missing = [kw[1:] for kw in get_kws(cpv, arches)]
77 - ALL_CPV_KWS += fix_nesting(gen_cpv_kws(cpv, kws_missing, set()))
78 - if CHECK_DEPS:
79 - ALL_CPV_KWS.append(LINE_SEP)
80 + kws_missing = max_kws(cpv, release=OLD_REL)
81 + if kws_missing == []:
82 + # Current cpv has the max keywords => nothing to do
83 + nothing_to_be_done(cpv)
84 + continue
85 + elif kws_missing == None:
86 + debug ('No versions with stable keywords for %s' % cpv)
87 + # No cpv with stable keywords => select latest
88 + arches = make_unstable(ARCHES)
89 + kws_missing = [kw[1:] for kw in get_kws(cpv, arches)]
90 + ALL_CPV_KWS += fix_nesting(gen_cpv_kws(cpv, kws_missing, set()))
91 + if CHECK_DEPS:
92 + ALL_CPV_KWS.append(LINE_SEP)
93
94 ALL_CPV_KWS = consolidate_dupes(ALL_CPV_KWS)
95 if APPEND_SLOTS: