1 |
Author: grobian |
2 |
Date: 2008-11-22 11:29:10 +0000 (Sat, 22 Nov 2008) |
3 |
New Revision: 12036 |
4 |
|
5 |
Modified: |
6 |
main/branches/prefix/bin/repoman |
7 |
main/branches/prefix/pym/portage/__init__.py |
8 |
Log: |
9 |
Merged from trunk -r11964:11982 |
10 |
|
11 |
| 11966 | Only show the "--without-mask" suggestion when packages are | |
12 |
| zmedico | actually masked by package.mask (rather than just keywords). | |
13 |
|
14 |
| 11968 | Suggest to use the new --include-dev (-d) option in cases | |
15 |
| zmedico | when some ebuilds have keywords from 'dev' profiles. This | |
16 |
| | should help avoid confusion about 'dev' profiles no longer | |
17 |
| | being checked by default. | |
18 |
|
19 |
| 11970 | Trigger the --include-dev suggestion for any keywords from | |
20 |
| zmedico | dev profiles, even if those keywords also belong to stable | |
21 |
| | profiles. | |
22 |
|
23 |
| 11972 | Add a QA Notice for 'jobserver unavailable' from make in the | |
24 |
| zmedico | build log. Thanks to Diego 'Flameeyes' Petten?\195?\178 | |
25 |
| | <flameeyes@g.o> for the suggestion. | |
26 |
|
27 |
| 11974 | Fix the 'jobserver unavailable' regex to match gmake. | |
28 |
| zmedico | | |
29 |
|
30 |
| 11976 | Add missing -a option for git commits. | |
31 |
| zmedico | | |
32 |
|
33 |
| 11978 | Bug #246667 - Add REPOMAN_VCS_LOCAL_OPTS and | |
34 |
| zmedico | REPOMAN_VCS_GLOBAL_OPTS variables that allow vcs options to | |
35 |
| | be passed in for commit commands. | |
36 |
|
37 |
| 11980 | When committing manifests, specify the manifest paths | |
38 |
| zmedico | instead of using git commit -a, since we may not want to | |
39 |
| | commit all dirty files in the whole repo. Thanks to Robin | |
40 |
| | Johnson <robbat2@g.o> for reporting. | |
41 |
|
42 |
| 11982 | When parsing `git diff` output, filter paths that are not | |
43 |
| zmedico | descended from the current directory. | |
44 |
|
45 |
|
46 |
Modified: main/branches/prefix/bin/repoman |
47 |
=================================================================== |
48 |
--- main/branches/prefix/bin/repoman 2008-11-22 11:26:59 UTC (rev 12035) |
49 |
+++ main/branches/prefix/bin/repoman 2008-11-22 11:29:10 UTC (rev 12036) |
50 |
@@ -496,6 +496,15 @@ |
51 |
elif os.path.isdir(os.path.join(portdir_overlay, ".git")): |
52 |
vcs = "git" |
53 |
|
54 |
+vcs_local_opts = repoman_settings.get("REPOMAN_VCS_LOCAL_OPTS", "").split() |
55 |
+vcs_global_opts = repoman_settings.get("REPOMAN_VCS_GLOBAL_OPTS") |
56 |
+if vcs_global_opts is None: |
57 |
+ if vcs != "git": |
58 |
+ vcs_global_opts = "-q" |
59 |
+ else: |
60 |
+ vcs_global_opts = "" |
61 |
+vcs_global_opts = vcs_global_opts.split() |
62 |
+ |
63 |
if vcs == "cvs" and \ |
64 |
"commit" == options.mode and \ |
65 |
"RMD160" not in portage.checksum.hashorigin_map: |
66 |
@@ -612,6 +621,7 @@ |
67 |
continue |
68 |
if os.path.isdir(startdir+"/"+x): |
69 |
scanlist.append(catdir+"/"+x) |
70 |
+ repo_subdir = catdir + os.sep |
71 |
elif repolevel==1: |
72 |
for x in repoman_settings.categories: |
73 |
if not os.path.isdir(startdir+"/"+x): |
74 |
@@ -621,11 +631,14 @@ |
75 |
continue |
76 |
if os.path.isdir(startdir+"/"+x+"/"+y): |
77 |
scanlist.append(x+"/"+y) |
78 |
+ repo_subdir = "" |
79 |
elif repolevel==3: |
80 |
catdir = reposplit[-2] |
81 |
if catdir not in repoman_settings.categories: |
82 |
caterror(catdir) |
83 |
scanlist.append(catdir+"/"+reposplit[-1]) |
84 |
+ repo_subdir = scanlist[-1] + os.sep |
85 |
+repo_subdir_len = len(repo_subdir) |
86 |
scanlist.sort() |
87 |
|
88 |
logging.debug("Found the following packages to scan:\n%s" % '\n'.join(scanlist)) |
89 |
@@ -671,7 +684,28 @@ |
90 |
print |
91 |
sys.exit(1) |
92 |
|
93 |
+def dev_keywords(profiles): |
94 |
+ """ |
95 |
+ Create a set of KEYWORDS values that exist in 'dev' |
96 |
+ profiles. These are used |
97 |
+ to trigger a message notifying the user when they might |
98 |
+ want to add the --include-dev option. |
99 |
+ """ |
100 |
+ type_arch_map = {} |
101 |
+ for arch, arch_profiles in profiles.iteritems(): |
102 |
+ for profile_path, profile_type in arch_profiles: |
103 |
+ arch_set = type_arch_map.get(profile_type) |
104 |
+ if arch_set is None: |
105 |
+ arch_set = set() |
106 |
+ type_arch_map[profile_type] = arch_set |
107 |
+ arch_set.add(arch) |
108 |
|
109 |
+ dev_keywords = type_arch_map.get('dev', set()) |
110 |
+ dev_keywords.update(['~' + arch for arch in dev_keywords]) |
111 |
+ return frozenset(dev_keywords) |
112 |
+ |
113 |
+dev_keywords = dev_keywords(profiles) |
114 |
+ |
115 |
stats={} |
116 |
fails={} |
117 |
|
118 |
@@ -753,7 +787,6 @@ |
119 |
mychanged = [] |
120 |
mynew = [] |
121 |
myremoved = [] |
122 |
-path_lstrip_re = re.compile(r'.*/') |
123 |
|
124 |
if vcs == "cvs": |
125 |
mycvstree = cvstree.getentries("./", recursive=1) |
126 |
@@ -769,14 +802,16 @@ |
127 |
mynew = os.popen("git diff --cached --name-only --diff-filter=A").readlines() |
128 |
strip_levels = repolevel - 1 |
129 |
if strip_levels: |
130 |
- mynew = [path_lstrip_re.sub("", elem, strip_levels) for elem in mynew] |
131 |
+ mynew = [elem[repo_subdir_len:] for elem in mynew \ |
132 |
+ if elem[:repo_subdir_len] == repo_subdir] |
133 |
mynew = ["./" + elem[:-1] for elem in mynew] |
134 |
if vcs: |
135 |
new_ebuilds.update(x for x in mynew if x.endswith(".ebuild")) |
136 |
modified_changelogs.update(x for x in chain(mychanged, mynew) \ |
137 |
if os.path.basename(x) == "ChangeLog") |
138 |
|
139 |
-have_masked = False |
140 |
+have_pmasked = False |
141 |
+have_dev_keywords = False |
142 |
dofail = 0 |
143 |
arch_caches={} |
144 |
arch_xmatch_caches = {} |
145 |
@@ -1508,7 +1543,9 @@ |
146 |
ismasked = os.path.join(catdir, y) not in \ |
147 |
portdb.xmatch("list-visible", x) |
148 |
if ismasked: |
149 |
- have_masked = True |
150 |
+ if not have_pmasked: |
151 |
+ have_pmasked = bool(dep_settings._getMaskAtom( |
152 |
+ pkg.cpv, pkg.metadata)) |
153 |
if options.ignore_masked: |
154 |
continue |
155 |
#we are testing deps for a masked package; give it some lee-way |
156 |
@@ -1517,7 +1554,11 @@ |
157 |
else: |
158 |
suffix="" |
159 |
matchmode = "minimum-visible" |
160 |
- |
161 |
+ |
162 |
+ if not have_dev_keywords: |
163 |
+ have_dev_keywords = \ |
164 |
+ bool(dev_keywords.intersection(keywords)) |
165 |
+ |
166 |
if prof[1] == "dev": |
167 |
suffix=suffix+"indev" |
168 |
|
169 |
@@ -1634,10 +1675,14 @@ |
170 |
mygroups[xs[0]]+=[seperator.join(xs[1:])] |
171 |
return mygroups |
172 |
|
173 |
-if have_masked and not (options.without_mask or options.ignore_masked): |
174 |
+if have_pmasked and not (options.without_mask or options.ignore_masked): |
175 |
print bold("Note: use --without-mask to check " + \ |
176 |
"KEYWORDS on dependencies of masked packages") |
177 |
|
178 |
+if have_dev_keywords and not options.include_dev: |
179 |
+ print bold("Note: use --include-dev (-d) to check " + \ |
180 |
+ "dependencies for 'dev' profiles") |
181 |
+ |
182 |
if options.mode != 'commit': |
183 |
if dofull: |
184 |
print bold("Note: type \"repoman full\" for a complete listing.") |
185 |
@@ -1765,11 +1810,13 @@ |
186 |
mynew = os.popen("git diff --cached --name-only --diff-filter=A").readlines() |
187 |
strip_levels = repolevel - 1 |
188 |
if strip_levels: |
189 |
- mynew = [path_lstrip_re.sub("", elem, strip_levels) for elem in mynew] |
190 |
+ mynew = [elem[repo_subdir_len:] for elem in mynew \ |
191 |
+ if elem[:repo_subdir_len] == repo_subdir] |
192 |
mynew = ["./" + elem[:-1] for elem in mynew] |
193 |
myremoved = os.popen("git diff --cached --name-only --diff-filter=D").readlines() |
194 |
if strip_levels: |
195 |
- myremoved = [path_lstrip_re.sub("", elem, strip_levels) for elem in myremoved] |
196 |
+ myremoved = [elem[repo_subdir_len:] for elem in myremoved \ |
197 |
+ if elem[:repo_subdir_len] == repo_subdir] |
198 |
myremoved = ["./" + elem[:-1] for elem in myremoved] |
199 |
|
200 |
if vcs: |
201 |
@@ -1890,38 +1937,28 @@ |
202 |
# so strip the prefix. |
203 |
myfiles = [f.lstrip("./") for f in myfiles] |
204 |
|
205 |
- retval = None |
206 |
- if options.pretend: |
207 |
- if vcs == "cvs": |
208 |
- print "(cvs -q commit -F %s %s)" % \ |
209 |
- (commitmessagefile, " ".join(myfiles)) |
210 |
- if vcs == "svn": |
211 |
- print "(svn commit -F %s %s)" % \ |
212 |
- (commitmessagefile, " ".join(myfiles)) |
213 |
- elif vcs == "git": |
214 |
- print "(git commit -F %s %s)" % \ |
215 |
- (commitmessagefile, " ".join(myfiles)) |
216 |
- else: |
217 |
- if vcs == "cvs": |
218 |
- retval = spawn(["cvs", "-q", "commit", |
219 |
- "-F", commitmessagefile] + myfiles, |
220 |
- env=os.environ) |
221 |
- if vcs == "svn": |
222 |
- retval = spawn(["svn", "commit", |
223 |
- "-F", commitmessagefile] + myfiles, |
224 |
- env=os.environ) |
225 |
- elif vcs == "git": |
226 |
- retval = spawn(["git", "commit", "-F", |
227 |
- commitmessagefile] + myfiles, |
228 |
- env=os.environ) |
229 |
+ commit_cmd = [vcs] |
230 |
+ commit_cmd.extend(vcs_global_opts) |
231 |
+ commit_cmd.append("commit") |
232 |
+ commit_cmd.extend(vcs_local_opts) |
233 |
+ commit_cmd.extend(["-F", commitmessagefile]) |
234 |
+ commit_cmd.extend(myfiles) |
235 |
+ |
236 |
try: |
237 |
- os.unlink(commitmessagefile) |
238 |
- except OSError: |
239 |
- pass |
240 |
- if retval: |
241 |
- writemsg_level("!!! Exiting on %s (shell) error code: %s\n" % \ |
242 |
- (vcs, retval), level=logging.ERROR, noiselevel=-1) |
243 |
- sys.exit(retval) |
244 |
+ if options.pretend: |
245 |
+ print "(%s)" % (" ".join(commit_cmd),) |
246 |
+ else: |
247 |
+ retval = spawn(commit_cmd, env=os.environ) |
248 |
+ if retval != os.EX_OK: |
249 |
+ writemsg_level(("!!! Exiting on %s (shell) " + \ |
250 |
+ "error code: %s\n") % (vcs, retval), |
251 |
+ level=logging.ERROR, noiselevel=-1) |
252 |
+ sys.exit(retval) |
253 |
+ finally: |
254 |
+ try: |
255 |
+ os.unlink(commitmessagefile) |
256 |
+ except OSError: |
257 |
+ pass |
258 |
|
259 |
# Setup the GPG commands |
260 |
def gpgsign(filename): |
261 |
@@ -2019,33 +2056,35 @@ |
262 |
|
263 |
# Force an unsigned commit when more than one Manifest needs to be signed. |
264 |
if repolevel < 3 and "sign" in repoman_settings.features: |
265 |
- if options.pretend: |
266 |
- if vcs == "cvs": |
267 |
- print "(cvs -q commit -F commitmessagefile)" |
268 |
- if vcs == "svn": |
269 |
- print "(svn -q commit -F commitmessagefile)" |
270 |
- elif vcs == "git": |
271 |
- print "(git commit -F commitmessagefile)" |
272 |
- else: |
273 |
- fd, commitmessagefile = tempfile.mkstemp(".repoman.msg") |
274 |
- mymsg = os.fdopen(fd, "w") |
275 |
- mymsg.write(commitmessage) |
276 |
- mymsg.write("\n (Unsigned Manifest commit)") |
277 |
- mymsg.close() |
278 |
- if vcs == "cvs": |
279 |
- retval=os.system("cvs -q commit -F "+commitmessagefile) |
280 |
- if vcs == "svn": |
281 |
- retval=os.system("svn -q commit -F "+commitmessagefile) |
282 |
- elif vcs == "git": |
283 |
- retval=os.system("git commit -F "+commitmessagefile) |
284 |
+ |
285 |
+ fd, commitmessagefile = tempfile.mkstemp(".repoman.msg") |
286 |
+ mymsg = os.fdopen(fd, "w") |
287 |
+ mymsg.write(commitmessage) |
288 |
+ mymsg.write("\n (Unsigned Manifest commit)") |
289 |
+ mymsg.close() |
290 |
+ |
291 |
+ commit_cmd = [vcs] |
292 |
+ commit_cmd.extend(vcs_global_opts) |
293 |
+ commit_cmd.append("commit") |
294 |
+ commit_cmd.extend(vcs_local_opts) |
295 |
+ commit_cmd.extend(["-F", commitmessagefile]) |
296 |
+ commit_cmd.extend(f.lstrip("./") for f in mymanifests) |
297 |
+ |
298 |
+ try: |
299 |
+ if options.pretend: |
300 |
+ print "(%s)" % (" ".join(commit_cmd),) |
301 |
+ else: |
302 |
+ retval = spawn(commit_cmd, env=os.environ) |
303 |
+ if retval: |
304 |
+ writemsg_level(("!!! Exiting on %s (shell) " + \ |
305 |
+ "error code: %s\n") % (vcs, retval), |
306 |
+ level=logging.ERROR, noiselevel=-1) |
307 |
+ sys.exit(retval) |
308 |
+ finally: |
309 |
try: |
310 |
os.unlink(commitmessagefile) |
311 |
except OSError: |
312 |
pass |
313 |
- if retval: |
314 |
- writemsg_level("!!! Exiting on %s (shell) error code: %s\n" % \ |
315 |
- (vcs, retval), level=logging.ERROR, noiselevel=-1) |
316 |
- sys.exit(retval) |
317 |
manifest_commit_required = False |
318 |
|
319 |
signed = False |
320 |
@@ -2093,36 +2132,38 @@ |
321 |
signed = False |
322 |
|
323 |
if manifest_commit_required or signed: |
324 |
- if options.pretend: |
325 |
- if vcs == "cvs": |
326 |
- print "(cvs -q commit -F commitmessagefile)" |
327 |
- if vcs == "svn": |
328 |
- print "(svn -q commit -F commitmessagefile)" |
329 |
- elif vcs == "git": |
330 |
- print "(git commit -a -F commitmessagefile)" |
331 |
+ |
332 |
+ fd, commitmessagefile = tempfile.mkstemp(".repoman.msg") |
333 |
+ mymsg = os.fdopen(fd, "w") |
334 |
+ mymsg.write(commitmessage) |
335 |
+ if signed: |
336 |
+ mymsg.write("\n (Signed Manifest commit)") |
337 |
else: |
338 |
- fd, commitmessagefile = tempfile.mkstemp(".repoman.msg") |
339 |
- mymsg = os.fdopen(fd, "w") |
340 |
- mymsg.write(commitmessage) |
341 |
- if signed: |
342 |
- mymsg.write("\n (Signed Manifest commit)") |
343 |
+ mymsg.write("\n (Unsigned Manifest commit)") |
344 |
+ mymsg.close() |
345 |
+ |
346 |
+ commit_cmd = [vcs] |
347 |
+ commit_cmd.extend(vcs_global_opts) |
348 |
+ commit_cmd.append("commit") |
349 |
+ commit_cmd.extend(vcs_local_opts) |
350 |
+ commit_cmd.extend(["-F", commitmessagefile]) |
351 |
+ commit_cmd.extend(f.lstrip("./") for f in mymanifests) |
352 |
+ |
353 |
+ try: |
354 |
+ if options.pretend: |
355 |
+ print "(%s)" % (" ".join(commit_cmd),) |
356 |
else: |
357 |
- mymsg.write("\n (Unsigned Manifest commit)") |
358 |
- mymsg.close() |
359 |
- if vcs == "cvs": |
360 |
- retval=os.system("cvs -q commit -F "+commitmessagefile) |
361 |
- if vcs == "svn": |
362 |
- retval=os.system("svn -q commit -F "+commitmessagefile) |
363 |
- elif vcs == "git": |
364 |
- retval=os.system("git commit -a -F "+commitmessagefile) |
365 |
+ retval = spawn(commit_cmd, env=os.environ) |
366 |
+ if retval != os.EX_OK: |
367 |
+ writemsg_level(("!!! Exiting on %s (shell) " + \ |
368 |
+ "error code: %s\n") % (vcs, retval), |
369 |
+ level=logging.ERROR, noiselevel=-1) |
370 |
+ sys.exit(retval) |
371 |
+ finally: |
372 |
try: |
373 |
os.unlink(commitmessagefile) |
374 |
except OSError: |
375 |
pass |
376 |
- if retval: |
377 |
- writemsg_level("!!! Exiting on %s (shell) error code: %s\n" % \ |
378 |
- (vcs, retval), level=logging.ERROR, noiselevel=-1) |
379 |
- sys.exit(retval) |
380 |
|
381 |
print |
382 |
if vcs: |
383 |
|
384 |
Modified: main/branches/prefix/pym/portage/__init__.py |
385 |
=================================================================== |
386 |
--- main/branches/prefix/pym/portage/__init__.py 2008-11-22 11:26:59 UTC (rev 12035) |
387 |
+++ main/branches/prefix/pym/portage/__init__.py 2008-11-22 11:29:10 UTC (rev 12036) |
388 |
@@ -4539,6 +4539,11 @@ |
389 |
am_maintainer_mode_re = re.compile(r'.*/missing --run .*') |
390 |
am_maintainer_mode_exclude_re = \ |
391 |
re.compile(r'.*/missing --run (autoheader|makeinfo)') |
392 |
+ |
393 |
+ make_jobserver_re = \ |
394 |
+ re.compile(r'g?make\[\d+\]: warning: jobserver unavailable:') |
395 |
+ make_jobserver = [] |
396 |
+ |
397 |
try: |
398 |
for line in f: |
399 |
if am_maintainer_mode_re.search(line) is not None and \ |
400 |
@@ -4553,6 +4558,10 @@ |
401 |
|
402 |
if configure_opts_warn_re.match(line) is not None: |
403 |
configure_opts_warn.append(line.rstrip("\n")) |
404 |
+ |
405 |
+ if make_jobserver_re.match(line) is not None: |
406 |
+ make_jobserver.append(line.rstrip("\n")) |
407 |
+ |
408 |
finally: |
409 |
f.close() |
410 |
|
411 |
@@ -4599,6 +4608,12 @@ |
412 |
msg.extend("\t" + line for line in configure_opts_warn) |
413 |
_eqawarn(msg) |
414 |
|
415 |
+ if make_jobserver: |
416 |
+ msg = ["QA Notice: make jobserver unavailable:"] |
417 |
+ msg.append("") |
418 |
+ msg.extend("\t" + line for line in make_jobserver) |
419 |
+ _eqawarn(msg) |
420 |
+ |
421 |
def _post_src_install_uid_fix(mysettings): |
422 |
""" |
423 |
Files in $D with user and group bits that match the "portage" |