1 |
To match the new ordering on Bugzilla, order arches with pure ~arch |
2 |
keywords after those having stable keywords. The idea behind it is to |
3 |
make it easier to determine which arches to CC on stablereqs. |
4 |
|
5 |
The pure ~arch arch list is hardcoded for now to mips + *-* (fbsd, |
6 |
prefix). However, in the future it will be replaced by status defined |
7 |
by arches.desc once that GLEP is finalized. |
8 |
--- |
9 |
pym/gentoolkit/eshowkw/keywords_header.py | 31 +++++++++++++++++++++++++------ |
10 |
1 file changed, 25 insertions(+), 6 deletions(-) |
11 |
|
12 |
diff --git a/pym/gentoolkit/eshowkw/keywords_header.py b/pym/gentoolkit/eshowkw/keywords_header.py |
13 |
index f7a8340..9cda2f9 100644 |
14 |
--- a/pym/gentoolkit/eshowkw/keywords_header.py |
15 |
+++ b/pym/gentoolkit/eshowkw/keywords_header.py |
16 |
@@ -15,7 +15,7 @@ from portage.output import colorize |
17 |
from gentoolkit.eshowkw.display_pretty import colorize_string |
18 |
from gentoolkit.eshowkw.display_pretty import align_string |
19 |
|
20 |
-# Copied from ekeyword |
21 |
+# Copied from ekeyword, modified to support arch vs ~arch status |
22 |
def load_profile_data(portdir=None, repo='gentoo'): |
23 |
"""Load the list of known arches from the tree |
24 |
|
25 |
@@ -25,7 +25,7 @@ def load_profile_data(portdir=None, repo='gentoo'): |
26 |
|
27 |
Returns: |
28 |
A dict mapping the keyword to its preferred state: |
29 |
- {'x86': 'stable', 'mips': 'dev', ...} |
30 |
+ {'x86': ('stable', 'arch'), 'mips': ('dev', '~arch'), ...} |
31 |
""" |
32 |
if portdir is None: |
33 |
portdir = portage.db[portage.root]['vartree'].settings.repositories[repo].location |
34 |
@@ -71,16 +71,28 @@ def load_profile_data(portdir=None, repo='gentoo'): |
35 |
warning('could not read profile files: %s' % arch_list) |
36 |
warning('will not be able to verify args are correct') |
37 |
|
38 |
+ # TODO: support arches.desc once the GLEP is finalized |
39 |
+ # for now, we just hardcode ~mips + *-* (fbsd, prefix) |
40 |
+ for k, v in arch_status.items(): |
41 |
+ if k == 'mips' or '-' in k: |
42 |
+ arch_status[k] = (v, '~arch') |
43 |
+ else: |
44 |
+ arch_status[k] = (v, 'arch') |
45 |
+ |
46 |
return arch_status |
47 |
|
48 |
def gen_arch_list(status): |
49 |
_arch_status = load_profile_data() |
50 |
if status == "stable": |
51 |
- return [arch for arch in _arch_status if _arch_status[arch] == "stable"] |
52 |
+ return [arch for arch in _arch_status if _arch_status[arch][0] == "stable"] |
53 |
elif status == "dev": |
54 |
- return [arch for arch in _arch_status if _arch_status[arch] == "dev"] |
55 |
+ return [arch for arch in _arch_status if _arch_status[arch][0] == "dev"] |
56 |
elif status == "exp": |
57 |
- return [arch for arch in _arch_status if _arch_status[arch] == "exp"] |
58 |
+ return [arch for arch in _arch_status if _arch_status[arch][0] == "exp"] |
59 |
+ elif status == "arch": |
60 |
+ return [arch for arch in _arch_status if _arch_status[arch][1] == "arch"] |
61 |
+ elif status == "~arch": |
62 |
+ return [arch for arch in _arch_status if _arch_status[arch][1] == "~arch"] |
63 |
else: |
64 |
raise TypeError |
65 |
|
66 |
@@ -88,6 +100,7 @@ class keywords_header: |
67 |
__IMPARCHS = gen_arch_list("stable") |
68 |
__DEV_ARCHS = gen_arch_list("dev") |
69 |
__EXP_ARCHS = gen_arch_list("exp") |
70 |
+ __TESTING_KW_ARCHS = gen_arch_list("~arch") |
71 |
__ADDITIONAL_FIELDS = [ 'eapi', 'unused', 'slot' ] |
72 |
__EXTRA_FIELDS = [ 'repo' ] |
73 |
|
74 |
@@ -128,7 +141,13 @@ class keywords_header: |
75 |
levels[kw] = level |
76 |
break |
77 |
|
78 |
- normal.sort(key=lambda kw: (levels.get(kw, 99), kw.count('-'), kw)) |
79 |
+ # sort by, in order (to match Bugzilla): |
80 |
+ # 1. arch, then ~arch |
81 |
+ # 2. profile stability |
82 |
+ # 3. short keywords, then long (prefix, fbsd) |
83 |
+ # 4. keyword name |
84 |
+ normal.sort(key=lambda kw: (kw in self.__TESTING_KW_ARCHS, |
85 |
+ levels.get(kw, 99), kw.count('-'), kw)) |
86 |
return normal |
87 |
|
88 |
def __readAdditionalFields(self): |
89 |
-- |
90 |
2.16.1 |