Gentoo Archives: gentoo-commits

From: "Paul Varner (fuzzyray)" <fuzzyray@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoolkit r662 - in trunk/gentoolkit: . bin
Date: Sat, 06 Jun 2009 02:54:23
Message-Id: E1MCm33-00032q-Kd@stork.gentoo.org
1 Author: fuzzyray
2 Date: 2009-06-06 02:54:19 +0000 (Sat, 06 Jun 2009)
3 New Revision: 662
4
5 Modified:
6 trunk/gentoolkit/ChangeLog
7 trunk/gentoolkit/bin/epkginfo
8 Log:
9 Add patch from Sebastian Mingramm to Make epkginfo slot aware and only print keywords for the highest visible versions in each slot. (Bug 232635)
10
11 Modified: trunk/gentoolkit/ChangeLog
12 ===================================================================
13 --- trunk/gentoolkit/ChangeLog 2009-06-04 23:28:51 UTC (rev 661)
14 +++ trunk/gentoolkit/ChangeLog 2009-06-06 02:54:19 UTC (rev 662)
15 @@ -1,3 +1,8 @@
16 +2009-06-05: Paul Varner <fuzzyray@g.o>
17 + * epkginfo: Add patch from Sebastian Mingramm to Make epkginfo slot
18 + aware and only print keywords for the highest visible versions in each
19 + slot. (Bug 232635)
20 +
21 2009-05-20: Paul Varner <fuzzyray@g.o>
22 * All: Convert from using /etc/gentoolkit-version to
23 /usr/share/gentoolkit/VERSION
24
25 Modified: trunk/gentoolkit/bin/epkginfo
26 ===================================================================
27 --- trunk/gentoolkit/bin/epkginfo 2009-06-04 23:28:51 UTC (rev 661)
28 +++ trunk/gentoolkit/bin/epkginfo 2009-06-06 02:54:19 UTC (rev 662)
29 @@ -21,16 +21,6 @@
30
31 version = open('/usr/share/gentoolkit/VERSION').read().strip()
32
33 -def getvar(pkg, var):
34 - file = open(pkg + ".ebuild")
35 - for line in file.readlines():
36 - line = line.rstrip()
37 - if re.match("^"+var+"=",line):
38 - vars = re.split("\"",line)[1]
39 - file.close
40 - return re.split(" ",vars)
41 - file.close()
42 -
43 def earch(workdir):
44 """Prints arch keywords for a given dir"""
45 portdir = portage.settings["PORTDIR"]
46 @@ -45,36 +35,81 @@
47
48 ebuildlist.sort(lambda x,y: portage.pkgcmp(portage.pkgsplit(x),portage.pkgsplit(y)))
49
50 - for pkg in ebuildlist:
51 - keywords = getvar(pkg, "KEYWORDS")
52 + slot_list = []
53 +
54 + for pkg in ebuildlist:
55 + portdb = portage.portdbapi(portdir)
56 + aux = portdb.aux_get(workdir.rsplit("/")[-2] + "/" + pkg, ['SLOT', 'KEYWORDS'])
57 +
58 + slot = aux[0]
59 + keywords = keywords = re.split(' ',aux[1])
60 +
61 + if not slot in slot_list:
62 + slot_list.append(slot)
63 +
64 for arch in keywords:
65 - if arch == "":
66 - arch = None
67 - archdict[arch] = pkg
68 + if arch in archdict:
69 + archdict[arch].append((pkg, slot))
70 + else:
71 + archdict[arch] = [ (pkg, slot) ]
72
73 archlist = archdict.keys();
74 archlist.sort()
75
76 - for pkg in ebuildlist:
77 - print darkgreen("Keywords: ") + pkg + ":",
78 - for value in archlist:
79 - if (value and archdict[value] == pkg):
80 - if value[0] == "-":
81 - print red(value),
82 - elif "~" == value[0]:
83 - print blue(value),
84 - else:
85 - print green(value),
86 - print ""
87 + slot_list.sort()
88
89 + for slot in slot_list:
90 + visible_stable = {}
91 + visible_unstable = {}
92 +
93 + for arch in archlist:
94 + visible_stable[arch] = None
95 + visible_unstable[arch] = None
96 +
97 + for pkg in ebuildlist:
98 + for arch in archlist:
99 + if (arch and (pkg, slot) in archdict[arch]):
100 + if arch[0] == "-":
101 + pass
102 + elif "~" == arch[0]:
103 + visible_unstable[arch] = pkg
104 + else:
105 + visible_unstable[arch] = None
106 + visible_stable[arch] = pkg
107 +
108 + for pkg in ebuildlist:
109 + found = False
110 + for arch in archlist:
111 + if (pkg, slot) in archdict[arch]:
112 + found = True
113 +
114 + if not found:
115 + continue
116 +
117 + if not pkg == ebuildlist[0]:
118 + print ""
119 +
120 + print darkgreen("Keywords: ") + pkg + "[" + slot + "]:",
121 +
122 + for arch in archlist:
123 + if (arch and (pkg, slot) in archdict[arch]):
124 + if arch[0] == "-":
125 + print red(arch),
126 + elif "~" == arch[0]:
127 + if visible_unstable[arch] == pkg:
128 + print blue(arch),
129 + else:
130 + if visible_stable[arch] == pkg:
131 + print green(arch),
132
133 +
134 class Metadata_XML(handler.ContentHandler):
135 _inside_herd="No"
136 _inside_maintainer="No"
137 _inside_email="No"
138 _inside_longdescription="No"
139
140 - _herd = ""
141 + _herd = []
142 _maintainers = []
143 _longdescription = ""
144
145 @@ -100,7 +135,7 @@
146
147 def characters(self, contents):
148 if self._inside_herd == "Yes":
149 - self._herd = contents
150 + self._herd.append(contents)
151
152 if self._inside_longdescription == "Yes":
153 self._longdescription = contents
154 @@ -110,7 +145,7 @@
155
156
157 def check_metadata(full_package):
158 - """Checks that the primary maintainer is still an active dev and list the hed the package belongs to"""
159 + """Checks that the primary maintainer is still an active dev and list the herd the package belongs to"""
160 metadata_file=portage.settings["PORTDIR"] + "/" + portage.pkgsplit(full_package)[0] + "/metadata.xml"
161 if not os.path.exists(metadata_file):
162 print darkgreen("Maintainer: ") + red("Error (Missing metadata.xml)")
163 @@ -122,16 +157,18 @@
164 parser.setContentHandler(handler)
165 parser.parse( metadata_file )
166
167 - if len(handler._herd) < 1:
168 + if handler._herd:
169 + herds = ", ".join(handler._herd)
170 + print darkgreen("Herd: ") + herds
171 + else:
172 print darkgreen("Herd: ") + red("Error (No Herd)")
173 return 1
174 - else:
175 - print darkgreen("Herd: ") + handler._herd
176
177 - if len(handler._maintainers) < 1:
178 - print darkgreen("Maintainer: ") + handler._herd
179 +
180 + if handler._maintainers:
181 + print darkgreen("Maintainer: ") + ", ".join(handler._maintainers)
182 else:
183 - print darkgreen("Maintainer: ") + ", ".join(handler._maintainers)
184 + print darkgreen("Maintainer: ") + "none"
185
186 if len(handler._longdescription) > 1:
187 print darkgreen("Description: ") + handler._longdescription