1 |
commit: 9a712ebe4e2495134421a3df88ebe9962b6fa50e |
2 |
Author: Gilles Dartiguelongue <eva <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Jun 24 14:39:56 2015 +0000 |
4 |
Commit: Gilles Dartiguelongue <eva <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Jun 25 12:46:23 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/gnome.git/commit/?id=9a712ebe |
7 |
|
8 |
scripts/gen_archlist: fix gen_cpv_kws to use arguments from command line |
9 |
|
10 |
* Change the cpv_kw format to a tuple, there is no point in using a list. |
11 |
* Move/edit some lines around to expose logic in a clearer way. |
12 |
* Retrieve arguments from command line. |
13 |
* Add some comments. |
14 |
|
15 |
scripts/gen_archlist.py | 47 ++++++++++++++++++++++++++++++++--------------- |
16 |
1 file changed, 32 insertions(+), 15 deletions(-) |
17 |
|
18 |
diff --git a/scripts/gen_archlist.py b/scripts/gen_archlist.py |
19 |
index 15d5b02..6e00ec1 100755 |
20 |
--- a/scripts/gen_archlist.py |
21 |
+++ b/scripts/gen_archlist.py |
22 |
@@ -63,7 +63,6 @@ STABLE = True |
23 |
############### |
24 |
# Preparation # |
25 |
############### |
26 |
-ALL_CPV_KWS = [] |
27 |
|
28 |
ARCHES = None |
29 |
if STABLE: |
30 |
@@ -299,10 +298,15 @@ def kws_wanted(current_kws, target_kws): |
31 |
return wanted |
32 |
|
33 |
|
34 |
-def gen_cpv_kws(cpv, kws_aim, depgraph): |
35 |
- depgraph.add(cpv) |
36 |
- cpv_kw_list = [[cpv, kws_wanted(get_kws(cpv, arches=ALL_ARCHES), kws_aim)]] |
37 |
- if not cpv_kw_list[0][1]: |
38 |
+def gen_cpv_kws(cpv, kws_aim, depgraph, check_dependencies, new_release): |
39 |
+ """Build a list of CPV-Keywords. |
40 |
+ |
41 |
+ If `check_dependencies` is True, append dependencies that need to be |
42 |
+ updated to the list. |
43 |
+ """ |
44 |
+ wanted = kws_wanted(get_kws(cpv, arches=ALL_ARCHES), kws_aim) |
45 |
+ |
46 |
+ if not wanted: |
47 |
# This happens when cpv has less keywords than kws_aim |
48 |
# Usually happens when a dep was an || dep, or under a USE-flag |
49 |
# which is masked in some profiles. We make all deps strict in |
50 |
@@ -313,23 +317,33 @@ def gen_cpv_kws(cpv, kws_aim, depgraph): |
51 |
debug('MEH') |
52 |
nothing_to_be_done(cpv, type='dep') |
53 |
return None |
54 |
+ |
55 |
wanted = get_kws(cpv, arches=make_unstable(kws_aim)) |
56 |
- cpv_kw_list = [[cpv, wanted]] |
57 |
- if CHECK_DEPS and not issystempackage(cpv): |
58 |
- deps = get_best_deps(cpv, cpv_kw_list[0][1], release=NEW_REL) |
59 |
+ |
60 |
+ cpv_kw_list = [(cpv, wanted)] |
61 |
+ |
62 |
+ if check_dependencies and not issystempackage(cpv): |
63 |
+ deps = get_best_deps(cpv, wanted, release=new_release) |
64 |
if EXTREME_DEBUG: |
65 |
debug('The deps of %s are %s' % (cpv, deps)) |
66 |
+ |
67 |
for dep in deps: |
68 |
if dep in depgraph: |
69 |
+ # XXX: assumes that `kws_aim` of previously added cpv is |
70 |
+ # larger than current |
71 |
continue |
72 |
+ |
73 |
depgraph.add(dep) |
74 |
- # Assumes that keyword deps are OK if STABLE |
75 |
- dep_deps = gen_cpv_kws(dep, cpv_kw_list[0][1], depgraph) |
76 |
+ # XXX: Assumes that dependencies are keyworded the same than cpv |
77 |
+ dep_deps = gen_cpv_kws(dep, wanted, depgraph, check_dependencies, |
78 |
+ new_release) |
79 |
dep_deps.reverse() |
80 |
- for i in dep_deps: |
81 |
- # Make sure we don't already have the same [cpv, [kws]] |
82 |
- if i not in ALL_CPV_KWS and i not in cpv_kw_list: |
83 |
- cpv_kw_list.append(i) |
84 |
+ |
85 |
+ for cpv_kw_tuple in dep_deps: |
86 |
+ # Make sure we don't already have the same [(cpv, kws)] |
87 |
+ if cpv_kw_tuple not in cpv_kw_list: |
88 |
+ cpv_kw_list.append(cpv_kw_tuple) |
89 |
+ |
90 |
cpv_kw_list.reverse() |
91 |
return cpv_kw_list |
92 |
|
93 |
@@ -533,7 +547,10 @@ def main(): |
94 |
nothing_to_be_done(cpv) |
95 |
continue |
96 |
|
97 |
- ALL_CPV_KWS += fix_nesting(gen_cpv_kws(cpv, kws_missing, set())) |
98 |
+ ALL_CPV_KWS += fix_nesting( |
99 |
+ gen_cpv_kws(cpv, kws_missing, set([cpv]), |
100 |
+ args.check_dependencies, args.new_version) |
101 |
+ ) |
102 |
if args.check_dependencies: |
103 |
ALL_CPV_KWS.append(LINE_SEP) |