1 |
Author: fuzzyray |
2 |
Date: 2009-04-30 21:08:44 +0000 (Thu, 30 Apr 2009) |
3 |
New Revision: 557 |
4 |
|
5 |
Added: |
6 |
branches/gentoolkit-0.2.4/src/echangelog/test/ |
7 |
Modified: |
8 |
branches/gentoolkit-0.2.4/ChangeLog |
9 |
branches/gentoolkit-0.2.4/src/echangelog/echangelog |
10 |
branches/gentoolkit-0.2.4/src/echangelog/echangelog.1 |
11 |
branches/gentoolkit-0.2.4/src/ekeyword/ChangeLog |
12 |
branches/gentoolkit-0.2.4/src/ekeyword/ekeyword |
13 |
branches/gentoolkit-0.2.4/src/equery/equery |
14 |
branches/gentoolkit-0.2.4/src/gentoolkit/helpers.py |
15 |
branches/gentoolkit-0.2.4/src/gentoolkit/package.py |
16 |
branches/gentoolkit-0.2.4/src/gentoolkit/pprinter.py |
17 |
branches/gentoolkit-0.2.4/src/glsa-check/glsa-check |
18 |
branches/gentoolkit-0.2.4/src/revdep-rebuild/revdep-rebuild |
19 |
branches/gentoolkit-0.2.4/src/revdep-rebuild/revdep-rebuild.1 |
20 |
Log: |
21 |
Merge changes from trunk to fix issues in 0.2.4 |
22 |
|
23 |
Modified: branches/gentoolkit-0.2.4/ChangeLog |
24 |
=================================================================== |
25 |
--- branches/gentoolkit-0.2.4/ChangeLog 2009-04-30 15:06:15 UTC (rev 556) |
26 |
+++ branches/gentoolkit-0.2.4/ChangeLog 2009-04-30 21:08:44 UTC (rev 557) |
27 |
@@ -1,3 +1,23 @@ |
28 |
+2009-04-30: Paul Varner <fuzzyray@g.o> |
29 |
+ * revdep-rebuild: Add patch from loki_val to check -l dependencies in |
30 |
+ .la files (Bug #267898) |
31 |
+ |
32 |
+2009-04-24: Paul Varner <fuzzyray@g.o> |
33 |
+ * ekeyword: Fix to handle multiline KEYWORDS (Bug #267250) |
34 |
+ |
35 |
+2009-01-08: Paul Varner <fuzzyray@g.o> |
36 |
+ * equery: Fix package.py to account for PORTDIR being a symbolic link |
37 |
+ when checking if a package is in an overlay. (Bug #253968) |
38 |
+ |
39 |
+2008-11-25: Paul Varner <fuzzyray@g.o> |
40 |
+ * revdep-rebuild: Fixes for non-linux Gentoo systems. Add patch from |
41 |
+ igli to fix find command to comply with POSIX. Change awk calls to |
42 |
+ gawk. |
43 |
+ |
44 |
+2008-11-11: Paul Varner <fuzzyray@g.o> |
45 |
+ * echangelog: Add --strict option (Bug 246242). |
46 |
+ * echangelog: Fix processing of virtual category (Bug 179530) |
47 |
+ |
48 |
2008-09-17: Paul Varner <fuzzyray@g.o> |
49 |
* euse: Fix check_sanity function to use get_all_make_defaults |
50 |
function when checking for the make.defaults files in the profile. |
51 |
|
52 |
Modified: branches/gentoolkit-0.2.4/src/echangelog/echangelog |
53 |
=================================================================== |
54 |
--- branches/gentoolkit-0.2.4/src/echangelog/echangelog 2009-04-30 15:06:15 UTC (rev 556) |
55 |
+++ branches/gentoolkit-0.2.4/src/echangelog/echangelog 2009-04-30 21:08:44 UTC (rev 557) |
56 |
@@ -11,6 +11,7 @@ |
57 |
use strict; |
58 |
use POSIX qw(strftime getcwd setlocale); |
59 |
use File::Find; |
60 |
+use Getopt::Long; |
61 |
|
62 |
# Fix bug 21022 by restricting to C locale |
63 |
setlocale(&POSIX::LC_ALL, "C"); |
64 |
@@ -21,121 +22,172 @@ |
65 |
|
66 |
# Global variables |
67 |
my (@files, @ebuilds, @conflicts, @trivial, @unknown, @new_versions, %actions); |
68 |
-my ($input, $editor, $entry, $user, $date, $text, $version, $year, $vcs); |
69 |
+my ($input, $editor, $entry, $user, $date, $text, $year, $vcs); |
70 |
+my ($opt_help, $opt_strict, $opt_version); |
71 |
|
72 |
-my %vcs = ( cvs => { diff => "cvs -f diff -U0", |
73 |
- status => "cvs -fn up", |
74 |
- add => "cvs -f add", |
75 |
- skip => 6, |
76 |
- regex => qr/^Index: ()(([^\/]*?)\.ebuild)\s*$/ }, |
77 |
- svn => { diff => "svn diff -N", |
78 |
- status => "svn status", |
79 |
- add => "svn add", |
80 |
- skip => 6, |
81 |
- regex => qr/^Index: ()(([^\/]*?)\.ebuild)\s*$/ }, |
82 |
- git => { diff => "git diff", |
83 |
- status => "git diff-index HEAD --name-status", |
84 |
- add => "git add", |
85 |
- skip => 4, |
86 |
- regex => qr/^diff \-\-git \S*\/((\S*)\.ebuild)/ } |
87 |
+$opt_help = 0; |
88 |
+$opt_strict = 0; |
89 |
+$opt_version = 0; |
90 |
|
91 |
+my %vcs = ( |
92 |
+ cvs => { |
93 |
+ diff => "cvs -f diff -U0", |
94 |
+ status => "cvs -fn up", |
95 |
+ add => "cvs -f add", |
96 |
+ skip => 6, |
97 |
+ regex => qr/^Index: (([^\/]*?)\.ebuild)\s*$/ |
98 |
+ }, |
99 |
+ svn => { |
100 |
+ diff => "svn diff -N", |
101 |
+ status => "svn status", |
102 |
+ add => "svn add", |
103 |
+ skip => 4, |
104 |
+ regex => qr/^Index: (([^\/]*?)\.ebuild)\s*$/ |
105 |
+ }, |
106 |
+ git => { |
107 |
+ diff => "git diff", |
108 |
+ status => "git diff-index HEAD --name-status", |
109 |
+ add => "git add", |
110 |
+ # This value should usually be 3 but on new file mode we need skip+1. |
111 |
+ # So 4 should be fine anyway. |
112 |
+ skip => 4, |
113 |
+ regex => qr/^diff \-\-git \S*\/((\S*)\.ebuild)/ |
114 |
+ }, |
115 |
); |
116 |
|
117 |
+sub usage { |
118 |
+ (my $usage = <<" EOF") =~ s/^\t//gm; |
119 |
+ Usage: echangelog [options] <changelog message> |
120 |
+ |
121 |
+ Options: |
122 |
+ --help err, this screen ... |
123 |
+ --strict abort on trivial/no changes |
124 |
+ --version show version info |
125 |
+ EOF |
126 |
+ print $usage; |
127 |
+ exit 0; |
128 |
+} |
129 |
+ |
130 |
+sub version { |
131 |
+ my $Revision = "Last svn change rev"; |
132 |
+ my $Date = "Last svn change date"; |
133 |
+ my $foo = ""; |
134 |
+ print "echangelog\n$Revision$foo \n$Date$foo\n"; |
135 |
+ exit 0; |
136 |
+} |
137 |
+ |
138 |
+GetOptions( |
139 |
+ 'help' => \$opt_help, |
140 |
+ 'strict' => \$opt_strict, |
141 |
+ 'version' => \$opt_version, |
142 |
+); |
143 |
+ |
144 |
+usage() if $opt_help; |
145 |
+version() if $opt_version; |
146 |
+ |
147 |
# Figure out what kind of repo we are in. |
148 |
- |
149 |
if ( -d "CVS" ) { |
150 |
- $vcs = "cvs"; |
151 |
+ $vcs = "cvs"; |
152 |
} elsif ( -d '.svn' ) { |
153 |
- $vcs = "svn"; |
154 |
-} elsif ( -f '/usr/bin/git' and open GIT, "git rev-parse --git-dir |" ) { |
155 |
- $vcs = "git"; |
156 |
- close GIT; |
157 |
+ $vcs = "svn"; |
158 |
} else { |
159 |
- die "No CVS, .git, .svn directories found, what kind of repo is this?"; |
160 |
+ if ( -x '/usr/bin/git' ) { |
161 |
+ open(GIT, '-|', "git rev-parse --git-dir 2>/dev/null"); |
162 |
+ $vcs = "git" if defined(<GIT>); |
163 |
+ close(GIT); |
164 |
+ } |
165 |
+ |
166 |
+ if ( ! $vcs ) { |
167 |
+ die "No CVS, .git, .svn directories found, what kind of repo is this?"; |
168 |
+ } |
169 |
} |
170 |
|
171 |
# Read the current ChangeLog |
172 |
if (-f 'ChangeLog') { |
173 |
- open I, '<ChangeLog' or die "Can't open ChangeLog for input: $!\n"; |
174 |
- { local $/ = undef; $text = <I>; } |
175 |
- close I; |
176 |
+ open I, '<ChangeLog' or die "Can't open ChangeLog for input: $!\n"; |
177 |
+ { local $/ = undef; $text = <I>; } |
178 |
+ close I; |
179 |
} else { |
180 |
- # No ChangeLog here, maybe we should make one... |
181 |
- if (<*.ebuild>) { |
182 |
- open C, "portageq envvar PORTDIR |" or die "Can't find PORTDIR"; |
183 |
- my ($new) = <C>; |
184 |
- close C; |
185 |
- $new =~ s/\s+$//; |
186 |
- open I, "< $new/skel.ChangeLog" |
187 |
- or die "Can't open $new/skel.ChangeLog for input: $!\n"; |
188 |
- { local $/ = undef; $text = <I>; } |
189 |
- close I; |
190 |
- my ($cwd) = getcwd(); |
191 |
- $cwd =~ m|.*/(\w+-\w+)/([^/]+)| |
192 |
- or die "Can't figure out category/package.. sorry!\n"; |
193 |
- my ($category, $package_name) = ($1, $2); |
194 |
- $text =~ s/^\*.*//ms; # don't need the fake entry |
195 |
- $text =~ s/<CATEGORY>/$category/; |
196 |
- $text =~ s/<PACKAGE_NAME>/$package_name/; |
197 |
- } else { |
198 |
- die "This should be run in a directory with ebuilds...\n"; |
199 |
- } |
200 |
+ # No ChangeLog here, maybe we should make one... |
201 |
+ if (<*.ebuild>) { |
202 |
+ open C, "portageq envvar PORTDIR |" or die "Can't find PORTDIR"; |
203 |
+ my ($new) = <C>; |
204 |
+ close C; |
205 |
+ |
206 |
+ $new =~ s/\s+$//; |
207 |
+ open I, "< $new/skel.ChangeLog" |
208 |
+ or die "Can't open $new/skel.ChangeLog for input: $!\n"; |
209 |
+ { local $/ = undef; $text = <I>; } |
210 |
+ close I; |
211 |
+ $text =~ s/^\*.*//ms; # don't need the fake entry |
212 |
+ } else { |
213 |
+ die "This should be run in a directory with ebuilds...\n"; |
214 |
+ } |
215 |
} |
216 |
|
217 |
# Figure out what has changed around here |
218 |
open C, $vcs{$vcs}{status}.' 2>&1 |' or die "Can't run ".$vcs{$vcs}{status}.": $!\n"; |
219 |
while (<C>) { |
220 |
- if (/^C\s+(\S+)/) { |
221 |
- if($vcs eq "git") { |
222 |
- my $filename = $2; |
223 |
- $filename =~ /\S*\/(\S*)/; |
224 |
- if( -d $1 ) { |
225 |
+ if (/^C\s+(\S+)/) { |
226 |
+ if($vcs eq "git") { |
227 |
+ my $filename = $2; |
228 |
+ $filename =~ /\S*\/(\S*)/; |
229 |
+ |
230 |
+ if( -d $1 ) { |
231 |
+ next; |
232 |
+ } |
233 |
+ |
234 |
+ push @conflicts, $1; |
235 |
+ next; |
236 |
+ } |
237 |
+ |
238 |
+ push @conflicts, $1; |
239 |
next; |
240 |
- } |
241 |
- push @conflicts, $1; |
242 |
- next; |
243 |
- } |
244 |
- push @conflicts, $1; |
245 |
- next; |
246 |
- } elsif (/^\?\s+(\S+)/) { |
247 |
- if($vcs eq "git") { |
248 |
- my $filename = $2; |
249 |
- $filename =~ /\S*\/(\S*)/; |
250 |
- if( -d $1 ) { |
251 |
+ } elsif (/^\?\s+(\S+)/) { |
252 |
+ if($vcs eq "git") { |
253 |
+ my $filename = $2; |
254 |
+ $filename =~ /\S*\/(\S*)/; |
255 |
+ |
256 |
+ if( -d $1 ) { |
257 |
+ next; |
258 |
+ } |
259 |
+ |
260 |
+ push @unknown, $1; |
261 |
+ next; |
262 |
+ } else { |
263 |
+ push @unknown, $1; |
264 |
+ } |
265 |
+ |
266 |
+ $actions{$1} = '+'; |
267 |
next; |
268 |
- } |
269 |
- push @unknown, $1; |
270 |
- next; |
271 |
- } else { |
272 |
- push @unknown, $1; |
273 |
- } |
274 |
- $actions{$1} = '+'; |
275 |
- next; |
276 |
- } elsif (/^([ARMD])\s+(\S+)/) { |
277 |
- my ($status, $filename) = ($1,$2); |
278 |
- if($vcs eq "git") { |
279 |
- open P, "git-rev-parse --sq --show-prefix |"; |
280 |
- my $prefix = <P>; |
281 |
- $prefix = substr($prefix, 0, -1); |
282 |
- close P; |
283 |
- |
284 |
- if ($filename =~ /$prefix(\S*)/) { |
285 |
- $filename = $1 ; |
286 |
- } |
287 |
- else { |
288 |
- next; |
289 |
- } |
290 |
- } |
291 |
- if( -d $filename ) { |
292 |
- next; |
293 |
+ } elsif (/^([ARMD])\s+\+?\s*(\S+)/) { |
294 |
+ my ($status, $filename) = ($1,$2); |
295 |
+ |
296 |
+ if($vcs eq "git") { |
297 |
+ open P, "git rev-parse --sq --show-prefix |"; |
298 |
+ my $prefix = <P>; |
299 |
+ $prefix = substr($prefix, 0, -1); |
300 |
+ close P; |
301 |
+ |
302 |
+ if ($filename =~ /$prefix(\S*)/) { |
303 |
+ $filename = $1 ; |
304 |
+ } |
305 |
+ else { |
306 |
+ next; |
307 |
+ } |
308 |
+ } |
309 |
+ |
310 |
+ if( -d $filename ) { |
311 |
+ next; |
312 |
+ } |
313 |
+ |
314 |
+ push @files, $filename; |
315 |
+ ($actions{$filename} = $status) =~ tr/DARM/-+-/d; |
316 |
} |
317 |
- push @files, $filename; |
318 |
- ($actions{$filename} = $status) =~ tr/DARM/-+-/d; |
319 |
- } |
320 |
} |
321 |
|
322 |
# git only shows files already added so we need to check for unknown files |
323 |
-# separately here. |
324 |
+# separately here. |
325 |
if($vcs eq "git") { |
326 |
find(\&git_unknown_objects, "./"); |
327 |
} |
328 |
@@ -145,131 +197,144 @@ |
329 |
my ($dev,$ino,$mode,$nlink,$uid,$gid); |
330 |
|
331 |
# Ignore empty directories - git doesn't version them and cvs removes them. |
332 |
- if ((($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) && ! -d _) { |
333 |
+ if ( (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) && ! -d _ ) { |
334 |
open C, $vcs." status $_ 2>&1 1>/dev/null |"; |
335 |
- |
336 |
- while (<C>) { |
337 |
+ |
338 |
+ while (<C>) { |
339 |
$_ = <C>; |
340 |
push @unknown, $object; |
341 |
- }; |
342 |
- close C; |
343 |
+ }; |
344 |
+ |
345 |
+ close C; |
346 |
}; |
347 |
} |
348 |
|
349 |
# Separate out the trivial files for now |
350 |
-@files = grep { |
351 |
- !/files.digest|Manifest|ChangeLog/ or do { push @trivial, $_; 0; } |
352 |
+@files = grep { |
353 |
+ !/files.digest|Manifest|ChangeLog/ or do { push @trivial, $_; 0; } |
354 |
} @files; |
355 |
|
356 |
-@unknown = grep { |
357 |
- !/files.digest|Manifest|ChangeLog/ or do { push @trivial, $_; 0; } |
358 |
+@unknown = grep { |
359 |
+ !/files.digest|Manifest|ChangeLog/ or do { push @trivial, $_; 0; } |
360 |
} @unknown; |
361 |
|
362 |
# Don't allow any conflicts |
363 |
if (@conflicts) { |
364 |
- print STDERR <<EOT; |
365 |
+ print STDERR <<EOT; |
366 |
$vcs reports the following conflicts. Please resolve them before |
367 |
running echangelog. |
368 |
EOT |
369 |
- print STDERR map "C $_\n", @conflicts; |
370 |
- exit 1; |
371 |
+ print STDERR map "C $_\n", @conflicts; |
372 |
+ exit 1; |
373 |
} |
374 |
|
375 |
# Don't allow unknown files (other than the trivial files that were separated |
376 |
# out above) |
377 |
if (@unknown) { |
378 |
- print STDERR <<EOT; |
379 |
+ print STDERR <<EOT; |
380 |
$vcs reports the following unknown files. Please use "$vcs add" before |
381 |
running echangelog, or remove the files in question. |
382 |
EOT |
383 |
- print STDERR map "? $_\n", @unknown; |
384 |
- exit 1; |
385 |
+ print STDERR map "? $_\n", @unknown; |
386 |
+ exit 1; |
387 |
} |
388 |
|
389 |
# Sort the list of files as portage does. None of the operations through |
390 |
# the rest of the script should break this sort. |
391 |
sub sortfunc($$) { |
392 |
- my ($a, $b) = @_; |
393 |
- (my $va = $a) =~ s/.*?-(\d.*?)(?:\.ebuild)?$/$1/; |
394 |
- (my $vb = $b) =~ s/.*?-(\d.*?)(?:\.ebuild)?$/$1/; |
395 |
- my ($na, $sa, $sna, $ra) = ($va =~ /^(.*?)(?:_(alpha|beta||pre|rc|p)(\d*))?(?:-r(\d+))?$/); |
396 |
- my ($nb, $sb, $snb, $rb) = ($vb =~ /^(.*?)(?:_(alpha|beta||pre|rc|p)(\d*))?(?:-r(\d+))?$/); |
397 |
- my (@na) = split /\.|(?<=\d)(?=[^\d\.])/, $na; |
398 |
- my (@nb) = split /\.|(?<=\d)(?=[^\d\.])/, $nb; |
399 |
- my $retval; |
400 |
+ my ($a, $b) = @_; |
401 |
+ (my $va = $a) =~ s/.*?-(\d.*?)(?:\.ebuild)?$/$1/; |
402 |
+ (my $vb = $b) =~ s/.*?-(\d.*?)(?:\.ebuild)?$/$1/; |
403 |
+ my ($na, $sa, $sna, $ra) = ($va =~ /^(.*?)(?:_(alpha|beta||pre|rc|p)(\d*))?(?:-r(\d+))?$/); |
404 |
+ my ($nb, $sb, $snb, $rb) = ($vb =~ /^(.*?)(?:_(alpha|beta||pre|rc|p)(\d*))?(?:-r(\d+))?$/); |
405 |
+ my (@na) = split /\.|(?<=\d)(?=[^\d\.])/, $na; |
406 |
+ my (@nb) = split /\.|(?<=\d)(?=[^\d\.])/, $nb; |
407 |
+ my $retval; |
408 |
|
409 |
- # |
410 |
- # compare version numbers first |
411 |
- # |
412 |
- for (my $i = 0; defined $na[$i] or defined $nb[$i]; $i++) { |
413 |
- # def vs. undef |
414 |
- return +1 if defined $na[$i] and !defined $nb[$i]; |
415 |
- return -1 if defined $nb[$i] and !defined $na[$i]; |
416 |
+ # |
417 |
+ # compare version numbers first |
418 |
+ # |
419 |
+ for (my $i = 0; defined $na[$i] or defined $nb[$i]; $i++) { |
420 |
+ # def vs. undef |
421 |
+ return +1 if defined $na[$i] and !defined $nb[$i]; |
422 |
+ return -1 if defined $nb[$i] and !defined $na[$i]; |
423 |
|
424 |
- # num vs. num |
425 |
- if ($na[$i] =~ /^\d/ and $nb[$i] =~ /^\d/) { |
426 |
- $retval = ($na[$i] <=> $nb[$i]); |
427 |
- return $retval if $retval; |
428 |
- next; |
429 |
- } |
430 |
+ # num vs. num |
431 |
+ if ($na[$i] =~ /^\d/ and $nb[$i] =~ /^\d/) { |
432 |
+ $retval = ($na[$i] <=> $nb[$i]); |
433 |
+ return $retval if $retval; |
434 |
+ next; |
435 |
+ } |
436 |
|
437 |
- # char vs. char |
438 |
- if ($na[$i] =~ /^\D/ and $nb[$i] =~ /^\D/) { |
439 |
- $retval = ($na[$i] cmp $nb[$i]); |
440 |
- return $retval if $retval; |
441 |
- next; |
442 |
- } |
443 |
+ # char vs. char |
444 |
+ if ($na[$i] =~ /^\D/ and $nb[$i] =~ /^\D/) { |
445 |
+ $retval = ($na[$i] cmp $nb[$i]); |
446 |
+ return $retval if $retval; |
447 |
+ next; |
448 |
+ } |
449 |
|
450 |
- # num vs. char |
451 |
- $retval = ($na[$i] =~ /\d/ and -1 or +1); |
452 |
- return $retval; |
453 |
- } |
454 |
+ # num vs. char |
455 |
+ $retval = ($na[$i] =~ /\d/ and -1 or +1); |
456 |
+ return $retval; |
457 |
+ } |
458 |
|
459 |
- # |
460 |
- # compare suffix second |
461 |
- # |
462 |
- if (defined $sa and !defined $sb) { |
463 |
- return +2 if $sa eq "p"; |
464 |
- return -2; |
465 |
- } |
466 |
- if (defined $sb and !defined $sa) { |
467 |
- return -3 if $sb eq "p"; |
468 |
- return +3; |
469 |
- } |
470 |
+ # |
471 |
+ # compare suffix second |
472 |
+ # |
473 |
+ if (defined $sa and !defined $sb) { |
474 |
+ return +2 if $sa eq "p"; |
475 |
+ return -2; |
476 |
+ } |
477 |
+ if (defined $sb and !defined $sa) { |
478 |
+ return -3 if $sb eq "p"; |
479 |
+ return +3; |
480 |
+ } |
481 |
|
482 |
- if (defined $sa) { # and defined $sb |
483 |
- $retval = ($sa cmp $sb); |
484 |
- if ($retval) { |
485 |
- return +4 if $sa eq "p"; |
486 |
- return -4 if $sb eq "p"; |
487 |
- return $retval; # suffixes happen to be alphabetical order, mostly |
488 |
- } |
489 |
+ if (defined $sa) { # and defined $sb |
490 |
+ $retval = ($sa cmp $sb); |
491 |
+ if ($retval) { |
492 |
+ return +4 if $sa eq "p"; |
493 |
+ return -4 if $sb eq "p"; |
494 |
+ return $retval; # suffixes happen to be alphabetical order, mostly |
495 |
+ } |
496 |
|
497 |
- # compare suffix number |
498 |
- return +5 if defined $sna and !defined $snb; |
499 |
- return -5 if defined $snb and !defined $sna; |
500 |
- if (defined $sna) { # and defined $snb |
501 |
- $retval = ($sna <=> $snb); |
502 |
- return $retval if $retval; |
503 |
- } |
504 |
- } |
505 |
+ # compare suffix number |
506 |
+ return +5 if defined $sna and !defined $snb; |
507 |
+ return -5 if defined $snb and !defined $sna; |
508 |
+ |
509 |
+ if (defined $sna) { # and defined $snb |
510 |
+ $retval = ($sna <=> $snb); |
511 |
+ return $retval if $retval; |
512 |
+ } |
513 |
+ } |
514 |
|
515 |
- # |
516 |
- # compare rev third |
517 |
- # |
518 |
- return +6 if defined $ra and !defined $rb; |
519 |
- return -6 if defined $rb and !defined $ra; |
520 |
- if (defined $ra) { # and defined $rb |
521 |
- return ($ra <=> $rb); |
522 |
- } |
523 |
+ # |
524 |
+ # compare rev third |
525 |
+ # |
526 |
+ return +6 if defined $ra and !defined $rb; |
527 |
+ return -6 if defined $rb and !defined $ra; |
528 |
+ |
529 |
+ if (defined $ra) { # and defined $rb |
530 |
+ return ($ra <=> $rb); |
531 |
+ } |
532 |
|
533 |
- # |
534 |
- # nothing left to compare |
535 |
- # |
536 |
- return 0; |
537 |
+ # |
538 |
+ # nothing left to compare |
539 |
+ # |
540 |
+ return 0; |
541 |
} |
542 |
+ |
543 |
@files = sort sortfunc @files; |
544 |
|
545 |
+# Just to ensure we don't get duplicate entries. |
546 |
+sub mypush(\@@) { |
547 |
+ my $aref = shift; |
548 |
+ |
549 |
+ foreach my $value (@_) { |
550 |
+ push(@{$aref}, $value) if !grep(/^$value$/, @{$aref}); |
551 |
+ } |
552 |
+} |
553 |
+ |
554 |
# Forget ebuilds that only have changed copyrights, unless that's all |
555 |
# the changed files we have |
556 |
|
557 |
@@ -277,62 +342,81 @@ |
558 |
@files = grep !/\.ebuild$/, @files; |
559 |
|
560 |
if (@ebuilds) { |
561 |
- if ($vcs eq "git") { |
562 |
- open C, $vcs{$vcs}{diff}." HEAD -- @ebuilds 2>&1 |" or die "Can't run: ".$vcs{$vcs}{diff}."$!\n"; |
563 |
- } else { |
564 |
- open C, $vcs{$vcs}{diff}." @ebuilds 2>&1 |" or die "Can't run: ".$vcs{$vcs}{diff}."$!\n"; |
565 |
- } |
566 |
- $_ = <C>; |
567 |
- while (defined $_) { |
568 |
- # only possible with cvs |
569 |
- if (/^$vcs diff: (([^\/]*?)\.ebuild) was removed/) { |
570 |
- push @files, $1; |
571 |
+ if ($vcs eq "git") { |
572 |
+ open C, $vcs{$vcs}{diff}." HEAD -- @ebuilds 2>&1 |" or die "Can't run: ".$vcs{$vcs}{diff}."$!\n"; |
573 |
+ } else { |
574 |
+ open C, $vcs{$vcs}{diff}." @ebuilds 2>&1 |" or die "Can't run: ".$vcs{$vcs}{diff}."$!\n"; |
575 |
} |
576 |
|
577 |
- # We assume GNU diff output format here. |
578 |
- # git format: diff --git a/app-doc/repodoc/metadata.xml b/app-doc/repodoc/metadata.xml |
579 |
- elsif (/$vcs{$vcs}{regex}/) { |
580 |
- my $f; |
581 |
- if ($vcs eq "git") { |
582 |
- ($f) = ($1); |
583 |
- my $version = ($2); |
584 |
- while (<C>) { |
585 |
- last if /^deleted file mode|^index/; |
586 |
- if (/^new file mode/) { |
587 |
- push @new_versions, $version; # new ebuild, will create a new entry |
588 |
- last; |
589 |
- } |
590 |
- } |
591 |
- } else { |
592 |
- ($f) = ($2); |
593 |
+ $_ = <C>; |
594 |
+ |
595 |
+ while (defined $_) { |
596 |
+ # only possible with cvs |
597 |
+ if (/^$vcs diff: (([^\/]*?)\.ebuild) was removed/) { |
598 |
+ mypush(@files, $1); |
599 |
} |
600 |
+ # We assume GNU diff output format here. |
601 |
+ # git format: diff --git a/app-doc/repodoc/metadata.xml b/app-doc/repodoc/metadata.xml |
602 |
+ elsif (/$vcs{$vcs}{regex}/) { |
603 |
+ my $f = $1; |
604 |
|
605 |
- # check if more than just copyright date changed. |
606 |
- # skip some lines (vcs dependent) |
607 |
- foreach(1..$vcs{$vcs}{skip}){ |
608 |
+ if ($vcs eq "git") { |
609 |
+ my $version = $2; |
610 |
+ |
611 |
+ while (<C>) { |
612 |
+ last if /^deleted file mode|^index/; |
613 |
+ if (/^new file mode/) { |
614 |
+ mypush(@files, $f); |
615 |
+ mypush(@new_versions, $version); |
616 |
+ last; |
617 |
+ } |
618 |
+ } |
619 |
+ } |
620 |
+ |
621 |
+ # check if more than just copyright date changed. |
622 |
+ # skip some lines (vcs dependent) |
623 |
+ foreach(1..$vcs{$vcs}{skip}) { |
624 |
$_ = <C>; |
625 |
- } |
626 |
- while (<C>) { |
627 |
- last if /^[A-Za-z]/; |
628 |
- if (/^[-+](?!# Copyright)/) { |
629 |
- push @files, $f; |
630 |
- last; |
631 |
- } |
632 |
- } |
633 |
- # at this point we've either added $f to @files or not, |
634 |
- # and we have the next line in $_ for processing |
635 |
- next; |
636 |
- } |
637 |
- elsif (/^$vcs.*?: (([^\/]*?)\.ebuild) is a new entry/) { |
638 |
- push @files, $1; |
639 |
- push @new_versions, $2; # new ebuild, will create a new entry |
640 |
- } |
641 |
- # other cvs output is ignored |
642 |
- $_ = <C>; |
643 |
- } |
644 |
+ } |
645 |
+ |
646 |
+ while (<C>) { |
647 |
+ last if /^[A-Za-z]/; |
648 |
+ if (/^[-+](?!# Copyright)/) { |
649 |
+ mypush(@files, $f); |
650 |
+ last; |
651 |
+ } |
652 |
+ } |
653 |
+ |
654 |
+ # at this point we've either added $f to @files or not, |
655 |
+ # and we have the next line in $_ for processing |
656 |
+ next; |
657 |
+ } |
658 |
+ elsif (/^$vcs.*?: (([^\/]*?)\.ebuild) is a new entry/) { |
659 |
+ mypush(@files, $1); |
660 |
+ mypush(@new_versions, $2); |
661 |
+ } |
662 |
+ |
663 |
+ # other cvs output is ignored |
664 |
+ $_ = <C>; |
665 |
+ } |
666 |
} |
667 |
close C; |
668 |
|
669 |
+# Subversion diff doesn't identify new versions. So use the status command |
670 |
+if (($vcs eq "svn") and (@ebuilds)) { |
671 |
+ open C, $vcs{$vcs}{status}." @ebuilds 2>&1 |" or die "Can't run: ".$vcs{$vcs}{status}."$!\n"; |
672 |
+ $_ = <C>; |
673 |
+ |
674 |
+ while (defined $_) { |
675 |
+ if (/^A\s+\+?\s*(([^\s]*)\.ebuild)/) { |
676 |
+ mypush(@files, $1); |
677 |
+ mypush(@new_versions, $2); |
678 |
+ } |
679 |
+ |
680 |
+ $_ = <C>; |
681 |
+ } |
682 |
+} |
683 |
+ |
684 |
# When a package move occurs, the versions appear to be new even though they are |
685 |
# not. Trim them from @new_versions in that case. |
686 |
@new_versions = grep { $text !~ /^\*\Q$_\E\s/m } @new_versions; |
687 |
@@ -343,48 +427,62 @@ |
688 |
|
689 |
# Allow ChangeLog entries with no changed files, but give a fat warning |
690 |
unless (@files) { |
691 |
- print STDERR "**\n"; |
692 |
- print STDERR "** NOTE: No non-trivial changed files found. Normally echangelog\n"; |
693 |
- print STDERR "** should be run after all affected files have been added and/or\n"; |
694 |
- print STDERR "** modified. Did you forget to $vcs add?\n"; |
695 |
- print STDERR "**\n"; |
696 |
- @files = sort sortfunc @trivial; |
697 |
- @files = qw/ChangeLog/ unless @files; # last resort to put something in the list |
698 |
+ print STDERR "**\n"; |
699 |
+ print STDERR "** NOTE: No non-trivial changed files found. Normally echangelog\n"; |
700 |
+ print STDERR "** should be run after all affected files have been added and/or\n"; |
701 |
+ print STDERR "** modified. Did you forget to $vcs add?\n"; |
702 |
+ print STDERR "**\n"; |
703 |
+ |
704 |
+ if ($opt_strict) { |
705 |
+ print STDERR "** In strict mode, exiting\n"; |
706 |
+ exit 1; |
707 |
+ } |
708 |
+ |
709 |
+ @files = sort sortfunc @trivial; |
710 |
+ @files = qw/ChangeLog/ unless @files; # last resort to put something in the list |
711 |
} |
712 |
|
713 |
+# sort |
714 |
+@files = sort sortfunc @files; |
715 |
+@new_versions = sort sortfunc @new_versions; |
716 |
+ |
717 |
# Get the input from the cmdline, editor or stdin |
718 |
if ($ARGV[0]) { |
719 |
- $input = "@ARGV"; |
720 |
+ $input = "@ARGV"; |
721 |
} else { |
722 |
- # Testing for defined() allows ECHANGELOG_EDITOR='' to cancel EDITOR |
723 |
- $editor = defined($ENV{'ECHANGELOG_EDITOR'}) ? $ENV{'ECHANGELOG_EDITOR'} : |
724 |
- $ENV{'EDITOR'} || undef; |
725 |
- if ($editor) { |
726 |
- system("$editor ChangeLog.new"); |
727 |
- if ($? != 0) { |
728 |
- # This usually happens when the editor got forcefully killed; and |
729 |
- # the terminal is probably messed up: so we reset things. |
730 |
- system('/usr/bin/stty sane'); |
731 |
- print STDERR "Editor died! Reverting to stdin method.\n"; |
732 |
- undef $editor; |
733 |
- } else { |
734 |
- if (open I, "<ChangeLog.new") { |
735 |
- local $/ = undef; |
736 |
- $input = <I>; |
737 |
- close I; |
738 |
- } else { |
739 |
- print STDERR "Error opening ChangeLog.new: $!\n"; |
740 |
- print STDERR "Reverting to stdin method.\n"; |
741 |
- undef $editor; |
742 |
- } |
743 |
- unlink 'ChangeLog.new'; |
744 |
- } |
745 |
- } |
746 |
- unless ($editor) { |
747 |
- print "Please type the log entry: use Ctrl-d to finish, Ctrl-c to abort...\n"; |
748 |
- local $/ = undef; |
749 |
- $input = <>; |
750 |
- } |
751 |
+ # Testing for defined() allows ECHANGELOG_EDITOR='' to cancel EDITOR |
752 |
+ $editor = defined($ENV{'ECHANGELOG_EDITOR'}) ? $ENV{'ECHANGELOG_EDITOR'} : |
753 |
+ $ENV{'EDITOR'} || undef; |
754 |
+ |
755 |
+ if ($editor) { |
756 |
+ system("$editor ChangeLog.new"); |
757 |
+ |
758 |
+ if ($? != 0) { |
759 |
+ # This usually happens when the editor got forcefully killed; and |
760 |
+ # the terminal is probably messed up: so we reset things. |
761 |
+ system('/usr/bin/stty sane'); |
762 |
+ print STDERR "Editor died! Reverting to stdin method.\n"; |
763 |
+ undef $editor; |
764 |
+ } else { |
765 |
+ if (open I, "<ChangeLog.new") { |
766 |
+ local $/ = undef; |
767 |
+ $input = <I>; |
768 |
+ close I; |
769 |
+ } else { |
770 |
+ print STDERR "Error opening ChangeLog.new: $!\n"; |
771 |
+ print STDERR "Reverting to stdin method.\n"; |
772 |
+ undef $editor; |
773 |
+ } |
774 |
+ |
775 |
+ unlink 'ChangeLog.new'; |
776 |
+ } |
777 |
+ } |
778 |
+ |
779 |
+ unless ($editor) { |
780 |
+ print "Please type the log entry: use Ctrl-d to finish, Ctrl-c to abort...\n"; |
781 |
+ local $/ = undef; |
782 |
+ $input = <>; |
783 |
+ } |
784 |
} |
785 |
die "Empty entry; aborting\n" unless $input =~ /\S/; |
786 |
|
787 |
@@ -395,18 +493,20 @@ |
788 |
|
789 |
# Prepend the user info to the input |
790 |
unless ($user = $ENV{'ECHANGELOG_USER'}) { |
791 |
- my ($fullname, $username) = (getpwuid($<))[6,0]; |
792 |
- $fullname =~ s/,.*//; # remove GECOS, bug 80011 |
793 |
- $user = sprintf "%s <%s\@gentoo.org>", $fullname, $username; |
794 |
+ my ($fullname, $username) = (getpwuid($<))[6,0]; |
795 |
+ $fullname =~ s/,.*//; # remove GECOS, bug 80011 |
796 |
+ $user = sprintf "%s <%s\@gentoo.org>", $fullname, $username; |
797 |
} |
798 |
+ |
799 |
# Make sure that we didn't get "root" |
800 |
die "Please set ECHANGELOG_USER or run as non-root\n" if $user =~ /<root@/; |
801 |
+ |
802 |
$date = strftime("%d %b %Y", gmtime); |
803 |
$entry = "$date; $user "; |
804 |
$entry .= join ', ', map "$actions{$_}$_", @files; |
805 |
$entry .= ':'; |
806 |
-$entry = Text::Wrap::fill(' ', ' ', $entry); # does not append a \n |
807 |
-$entry .= "\n$input"; # append user input |
808 |
+$entry = Text::Wrap::fill(' ', ' ', $entry); # does not append a \n |
809 |
+$entry .= "\n$input"; # append user input |
810 |
|
811 |
# Each one of these regular expressions will eat the whitespace |
812 |
# leading up to the next entry (except the two-space leader on the |
813 |
@@ -414,28 +514,49 @@ |
814 |
# double carriage-return. This helps to normalize the spacing in |
815 |
# the ChangeLogs. |
816 |
if (@new_versions) { |
817 |
- # Insert at the top with a new version marker |
818 |
- $text =~ s/^( .*? ) # grab header |
819 |
- \s*\n(?=\ \ \d|\*|\z) # suck up trailing whitespace |
820 |
- /"$1\n\n" . |
821 |
- join("\n", map "*$_ ($date)", reverse @new_versions) . |
822 |
- "\n\n$entry\n\n"/sxe |
823 |
- or die "Failed to insert new entry (4)\n"; |
824 |
+ # Insert at the top with a new version marker |
825 |
+ $text =~ s/^( .*? ) # grab header |
826 |
+ \s*\n(?=\ \ \d|\*|\z) # suck up trailing whitespace |
827 |
+ /"$1\n\n" . |
828 |
+ join("\n", map "*$_ ($date)", reverse @new_versions) . |
829 |
+ "\n\n$entry\n\n"/sxe |
830 |
+ or die "Failed to insert new entry (4)\n"; |
831 |
} else { |
832 |
- # Changing an existing patch or ebuild, no new version marker |
833 |
- # required |
834 |
- $text =~ s/^( .*? ) # grab header |
835 |
- \s*\n(?=\ \ \d|\*|\z) # suck up trailing whitespace |
836 |
- /$1\n\n$entry\n\n/sx |
837 |
- or die "Failed to insert new entry (3)\n"; |
838 |
+ # Changing an existing patch or ebuild, no new version marker |
839 |
+ # required |
840 |
+ $text =~ s/^( .*? ) # grab header |
841 |
+ \s*\n(?=\ \ \d|\*|\z) # suck up trailing whitespace |
842 |
+ /$1\n\n$entry\n\n/sx |
843 |
+ or die "Failed to insert new entry (3)\n"; |
844 |
} |
845 |
|
846 |
+sub update_cat_pn { |
847 |
+ my ($t) = @_; |
848 |
+ my ($cwd) = getcwd(); |
849 |
+ |
850 |
+ $cwd =~ m|.*/(\w+-\w+\|virtual)/([^/]+)| |
851 |
+ or die "Can't figure out category/package.. sorry!\n"; |
852 |
+ my ($category, $package_name) = ($1, $2); |
853 |
+ $t =~ s/^(# ChangeLog for).*/$1 $category\/$package_name/; |
854 |
+ |
855 |
+ return $t; |
856 |
+} |
857 |
+ |
858 |
+# New packages and/or ones that have moved around often have stale data here. |
859 |
+# But only do that in places where ebuilds are around (as echangelog can be |
860 |
+# used in profiles/ and such places). |
861 |
+if (grep(/\.ebuild$/, @files)) { |
862 |
+ $text = update_cat_pn($text); |
863 |
+} |
864 |
+ |
865 |
sub update_copyright { |
866 |
- my ($t) = @_; |
867 |
- (my $year = $date) =~ s/.* //; |
868 |
- $t =~ s/^# Copyright \d+(?= )/$&-$year/m or |
869 |
- $t =~ s/^(# Copyright \d+)-(\d+)/$1-$year/m; |
870 |
- return $t; |
871 |
+ my ($t) = @_; |
872 |
+ (my $year = $date) =~ s/.* //; |
873 |
+ |
874 |
+ $t =~ s/^# Copyright \d+(?= )/$&-$year/m or |
875 |
+ $t =~ s/^(# Copyright) \d+-(\d+)/$1 1999-$year/m; |
876 |
+ |
877 |
+ return $t; |
878 |
} |
879 |
|
880 |
# Update the copyright year in the ChangeLog |
881 |
@@ -450,25 +571,26 @@ |
882 |
# copyright lines on ebuilds that haven't changed. I verified this with an IP |
883 |
# lawyer. |
884 |
for my $e (grep /\.ebuild$/, @files) { |
885 |
- if (-s $e) { |
886 |
- my ($etext, $netext); |
887 |
- open E, "<$e" or warn("Can't read $e to update copyright year\n"), next; |
888 |
- { local $/ = undef; $etext = <E>; } |
889 |
- close E; |
890 |
+ if (-s $e) { |
891 |
+ my ($etext, $netext); |
892 |
|
893 |
- # Attempt the substitution and compare |
894 |
- $netext = update_copyright($etext); |
895 |
- next if $netext eq $etext; # skip this file if no change. |
896 |
+ open E, "<$e" or warn("Can't read $e to update copyright year\n"), next; |
897 |
+ { local $/ = undef; $etext = <E>; } |
898 |
+ close E; |
899 |
|
900 |
- # Write the new ebuild |
901 |
- open E, ">$e.new" or warn("Can't open $e.new\n"), next; |
902 |
- print E $netext and |
903 |
- close E or warn("Can't write $e.new\n"), next; |
904 |
+ # Attempt the substitution and compare |
905 |
+ $netext = update_copyright($etext); |
906 |
+ next if $netext eq $etext; # skip this file if no change. |
907 |
|
908 |
- # Move things around and show the diff |
909 |
- system "diff -U 0 $e $e.new"; |
910 |
- rename "$e.new", $e or warn("Can't rename $e.new: $!\n"); |
911 |
- } |
912 |
+ # Write the new ebuild |
913 |
+ open E, ">$e.new" or warn("Can't open $e.new\n"), next; |
914 |
+ print E $netext and |
915 |
+ close E or warn("Can't write $e.new\n"), next; |
916 |
+ |
917 |
+ # Move things around and show the diff |
918 |
+ system "diff -U 0 $e $e.new"; |
919 |
+ rename "$e.new", $e or warn("Can't rename $e.new: $!\n"); |
920 |
+ } |
921 |
} |
922 |
|
923 |
# Move things around and show the ChangeLog diff |
924 |
@@ -476,18 +598,18 @@ |
925 |
rename 'ChangeLog.new', 'ChangeLog' or die "Can't rename ChangeLog.new: $!\n"; |
926 |
|
927 |
# Okay, now we have a starter ChangeLog to work with. |
928 |
-# The text will be added just like with any other ChangeLog below. |
929 |
+# The text will be added just like with any other ChangeLog below. |
930 |
# Add the new ChangeLog to vcs before continuing. |
931 |
if ($vcs eq "cvs") { |
932 |
- if (open F, "CVS/Entries") { |
933 |
- system("cvs -f add ChangeLog") unless (scalar grep /^\/ChangeLog\//, <F>); |
934 |
- } |
935 |
+ if (open F, "CVS/Entries") { |
936 |
+ system("cvs -f add ChangeLog") unless (scalar grep /^\/ChangeLog\//, <F>); |
937 |
+ } |
938 |
} elsif ($vcs eq "svn") { |
939 |
- if (open F, ".svn/entries") { |
940 |
- system("svn add ChangeLog") unless (scalar grep /ChangeLog/, <F>); |
941 |
- } |
942 |
+ if (open F, ".svn/entries") { |
943 |
+ system("svn add ChangeLog") unless (scalar grep /ChangeLog/, <F>); |
944 |
+ } |
945 |
} else { |
946 |
- system("$vcs{$vcs}{add} ChangeLog 2>&1 >> /dev/null"); |
947 |
+ system("$vcs{$vcs}{add} ChangeLog 2>&1 >> /dev/null"); |
948 |
} |
949 |
|
950 |
-# vim:sw=4 ts=8 expandtab |
951 |
+# vim: set ts=4 sw=4 tw=0: |
952 |
|
953 |
|
954 |
Property changes on: branches/gentoolkit-0.2.4/src/echangelog/echangelog |
955 |
___________________________________________________________________ |
956 |
Name: svn:executable |
957 |
+ * |
958 |
|
959 |
Modified: branches/gentoolkit-0.2.4/src/echangelog/echangelog.1 |
960 |
=================================================================== |
961 |
--- branches/gentoolkit-0.2.4/src/echangelog/echangelog.1 2009-04-30 15:06:15 UTC (rev 556) |
962 |
+++ branches/gentoolkit-0.2.4/src/echangelog/echangelog.1 2009-04-30 21:08:44 UTC (rev 557) |
963 |
@@ -1,4 +1,4 @@ |
964 |
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.13 |
965 |
+.\" Automatically generated by Pod::Man 2.16 (Pod::Simple 3.07) |
966 |
.\" |
967 |
.\" Standard preamble: |
968 |
.\" ======================================================================== |
969 |
@@ -25,11 +25,11 @@ |
970 |
.. |
971 |
.\" Set up some character translations and predefined strings. \*(-- will |
972 |
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left |
973 |
-.\" double quote, and \*(R" will give a right double quote. | will give a |
974 |
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to |
975 |
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' |
976 |
-.\" expand to `' in nroff, nothing in troff, for use with C<>. |
977 |
-.tr \(*W-|\(bv\*(Tr |
978 |
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will |
979 |
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and |
980 |
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, |
981 |
+.\" nothing in troff, for use with C<>. |
982 |
+.tr \(*W- |
983 |
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' |
984 |
.ie n \{\ |
985 |
. ds -- \(*W- |
986 |
@@ -48,23 +48,26 @@ |
987 |
. ds R" '' |
988 |
'br\} |
989 |
.\" |
990 |
+.\" Escape single quotes in literal strings from groff's Unicode transform. |
991 |
+.ie \n(.g .ds Aq \(aq |
992 |
+.el .ds Aq ' |
993 |
+.\" |
994 |
.\" If the F register is turned on, we'll generate index entries on stderr for |
995 |
.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index |
996 |
.\" entries marked with X<> in POD. Of course, you'll have to process the |
997 |
.\" output yourself in some meaningful fashion. |
998 |
-.if \nF \{\ |
999 |
+.ie \nF \{\ |
1000 |
. de IX |
1001 |
. tm Index:\\$1\t\\n%\t"\\$2" |
1002 |
.. |
1003 |
. nr % 0 |
1004 |
. rr F |
1005 |
.\} |
1006 |
+.el \{\ |
1007 |
+. de IX |
1008 |
+.. |
1009 |
+.\} |
1010 |
.\" |
1011 |
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes |
1012 |
-.\" way too many mistakes in technical documents. |
1013 |
-.hy 0 |
1014 |
-.if n .na |
1015 |
-.\" |
1016 |
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). |
1017 |
.\" Fear. Run. Save yourself. No user-serviceable parts. |
1018 |
. \" fudge factors for nroff and troff |
1019 |
@@ -128,8 +131,12 @@ |
1020 |
.rm #[ #] #H #V #F C |
1021 |
.\" ======================================================================== |
1022 |
.\" |
1023 |
-.IX Title "ECHANGELOG 1" |
1024 |
-.TH ECHANGELOG 1 "2004-04-02" "perl v5.8.2" "User Contributed Perl Documentation" |
1025 |
+.IX Title "echangelog 1" |
1026 |
+.TH echangelog 1 "2009-04-28" "perl v5.10.0" "Gentoolkit" |
1027 |
+.\" For nroff, turn off justification. Always turn off hyphenation; it makes |
1028 |
+.\" way too many mistakes in technical documents. |
1029 |
+.if n .ad l |
1030 |
+.nh |
1031 |
.SH "NAME" |
1032 |
echangelog \- Gentoo: update portage ChangeLogs |
1033 |
.SH "SYNOPSIS" |
1034 |
@@ -141,7 +148,7 @@ |
1035 |
in Gentoo. The tool scans the current directory, which is assumed to |
1036 |
be a package directory such as /usr/portage/app\-editors/vim, finds |
1037 |
what files have been changed or added, and inserts the appropriate |
1038 |
-entry to ChangeLog. If \fItext\fR is not provided on the command\-line, |
1039 |
+entry to ChangeLog. If \fItext\fR is not provided on the command-line, |
1040 |
echangelog prompts for it. |
1041 |
.PP |
1042 |
All modifications should occur before running echangelog so that it |
1043 |
@@ -152,7 +159,7 @@ |
1044 |
If your text would cause the ChangeLog entry to exceed 80 columns, it |
1045 |
will be rewrapped to keep the ChangeLog neat. If you need special |
1046 |
formatting in the ChangeLog, then you can either (1) run echangelog |
1047 |
-with no text on the command\-line, and make sure that your text won't |
1048 |
+with no text on the command-line, and make sure that your text won't |
1049 |
be too wide, (2) edit the ChangeLog manually. If you prefer (2), I'd |
1050 |
recommend something like \*(L"echangelog blah\*(R" so that the header lines |
1051 |
are computed correctly, then edit and change \*(L"blah\*(R" to your preferred |
1052 |
@@ -173,22 +180,20 @@ |
1053 |
parsed from skel.ebuild. |
1054 |
.PP |
1055 |
.Vb 2 |
1056 |
-\& $ cvs add metalog-0.1.ebuild |
1057 |
-\& cvs server: use 'cvs commit' to add this file permanently |
1058 |
-.Ve |
1059 |
-.PP |
1060 |
-.Vb 13 |
1061 |
-\& $ echangelog 'New ebuild, thanks to Harvey McGillicuddy' |
1062 |
-\& --- ChangeLog 1969-12-31 19:00:00.000000000 -0500 |
1063 |
-\& +++ ChangeLog.new 2003-02-23 14:04:06.000000000 -0500 |
1064 |
-\& @@ -0,0 +1,9 @@ |
1065 |
-\& +# ChangeLog for app-admin/metalog |
1066 |
-\& +# Copyright 2000-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2 |
1067 |
+\& $ cvs add metalog\-0.1.ebuild |
1068 |
+\& cvs server: use \*(Aqcvs commit\*(Aq to add this file permanently |
1069 |
+\& |
1070 |
+\& $ echangelog \*(AqNew ebuild, thanks to Harvey McGillicuddy\*(Aq |
1071 |
+\& \-\-\- ChangeLog 1969\-12\-31 19:00:00.000000000 \-0500 |
1072 |
+\& +++ ChangeLog.new 2003\-02\-23 14:04:06.000000000 \-0500 |
1073 |
+\& @@ \-0,0 +1,9 @@ |
1074 |
+\& +# ChangeLog for app\-admin/metalog |
1075 |
+\& +# Copyright 2000\-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2 |
1076 |
\& +# $Header$ |
1077 |
\& + |
1078 |
-\& +*metalog-0.1 (23 Feb 2003) |
1079 |
+\& +*metalog\-0.1 (23 Feb 2003) |
1080 |
\& + |
1081 |
-\& + 23 Feb 2003; Aron Griffis <agriffis@g.o> metalog-0.1.ebuild : |
1082 |
+\& + 23 Feb 2003; Aron Griffis <agriffis@g.o> metalog\-0.1.ebuild : |
1083 |
\& + New ebuild, thanks to Harvey McGillicuddy |
1084 |
\& + |
1085 |
.Ve |
1086 |
@@ -197,61 +202,51 @@ |
1087 |
will notice the new file. |
1088 |
.PP |
1089 |
.Vb 2 |
1090 |
-\& $ cvs add metalog-0.1-r1.ebuild |
1091 |
-\& cvs server: use 'cvs commit' to add this file permanently |
1092 |
-.Ve |
1093 |
-.PP |
1094 |
-.Vb 6 |
1095 |
-\& $ echangelog 'Bump revision to fix bug #999' |
1096 |
-\& --- ChangeLog 2003-02-23 14:04:06.000000000 -0500 |
1097 |
-\& +++ ChangeLog.new 2003-02-23 14:07:48.000000000 -0500 |
1098 |
-\& @@ -2,6 +2,11 @@ |
1099 |
-\& # Copyright 2000-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2 |
1100 |
+\& $ cvs add metalog\-0.1\-r1.ebuild |
1101 |
+\& cvs server: use \*(Aqcvs commit\*(Aq to add this file permanently |
1102 |
+\& |
1103 |
+\& $ echangelog \*(AqBump revision to fix bug #999\*(Aq |
1104 |
+\& \-\-\- ChangeLog 2003\-02\-23 14:04:06.000000000 \-0500 |
1105 |
+\& +++ ChangeLog.new 2003\-02\-23 14:07:48.000000000 \-0500 |
1106 |
+\& @@ \-2,6 +2,11 @@ |
1107 |
+\& # Copyright 2000\-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2 |
1108 |
\& # $Header$ |
1109 |
-.Ve |
1110 |
-.PP |
1111 |
-.Vb 6 |
1112 |
-\& +*metalog-0.1-r1 (23 Feb 2003) |
1113 |
+\& |
1114 |
+\& +*metalog\-0.1\-r1 (23 Feb 2003) |
1115 |
\& + |
1116 |
-\& + 23 Feb 2003; Aron Griffis <agriffis@g.o> metalog-0.1-r1.ebuild : |
1117 |
+\& + 23 Feb 2003; Aron Griffis <agriffis@g.o> metalog\-0.1\-r1.ebuild : |
1118 |
\& + Bump revision to fix bug #999 |
1119 |
\& + |
1120 |
-\& *metalog-0.1 (23 Feb 2003) |
1121 |
+\& *metalog\-0.1 (23 Feb 2003) |
1122 |
+\& |
1123 |
+\& 23 Feb 2003; Aron Griffis <agriffis@g.o> metalog\-0.1.ebuild : |
1124 |
.Ve |
1125 |
.PP |
1126 |
-.Vb 1 |
1127 |
-\& 23 Feb 2003; Aron Griffis <agriffis@g.o> metalog-0.1.ebuild : |
1128 |
-.Ve |
1129 |
-.PP |
1130 |
For a multi-line entry, omit the command-line arg. |
1131 |
.PP |
1132 |
.Vb 10 |
1133 |
\& $ echangelog |
1134 |
-\& Please type the log entry, finish with ctrl-d |
1135 |
+\& Please type the log entry, finish with ctrl\-d |
1136 |
\& Bump revision to fix bug #999. Necessary to bump the revision because |
1137 |
-\& the problem appears at run-time, not compile-time. This should also |
1138 |
+\& the problem appears at run\-time, not compile\-time. This should also |
1139 |
\& give users the updated default configuration file. |
1140 |
-\& --- ChangeLog 2003-02-23 14:09:12.000000000 -0500 |
1141 |
-\& +++ ChangeLog.new 2003-02-23 14:12:43.000000000 -0500 |
1142 |
-\& @@ -2,6 +2,13 @@ |
1143 |
-\& # Copyright 2000-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2 |
1144 |
+\& \-\-\- ChangeLog 2003\-02\-23 14:09:12.000000000 \-0500 |
1145 |
+\& +++ ChangeLog.new 2003\-02\-23 14:12:43.000000000 \-0500 |
1146 |
+\& @@ \-2,6 +2,13 @@ |
1147 |
+\& # Copyright 2000\-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2 |
1148 |
\& # $Header$ |
1149 |
-.Ve |
1150 |
-.PP |
1151 |
-.Vb 8 |
1152 |
-\& +*metalog-0.1-r1 (23 Feb 2003) |
1153 |
+\& |
1154 |
+\& +*metalog\-0.1\-r1 (23 Feb 2003) |
1155 |
\& + |
1156 |
-\& + 23 Feb 2003; Aron Griffis <agriffis@g.o> metalog-0.1-r1.ebuild : |
1157 |
+\& + 23 Feb 2003; Aron Griffis <agriffis@g.o> metalog\-0.1\-r1.ebuild : |
1158 |
\& + Bump revision to fix bug #999. Necessary to bump the revision because |
1159 |
-\& + the problem appears at run-time, not compile-time. This should also |
1160 |
+\& + the problem appears at run\-time, not compile\-time. This should also |
1161 |
\& + give users the updated default configuration file. |
1162 |
\& + |
1163 |
-\& *metalog-0.1 (23 Feb 2003) |
1164 |
+\& *metalog\-0.1 (23 Feb 2003) |
1165 |
+\& |
1166 |
+\& 23 Feb 2003; Aron Griffis <agriffis@g.o> metalog\-0.1.ebuild : |
1167 |
.Ve |
1168 |
-.PP |
1169 |
-.Vb 1 |
1170 |
-\& 23 Feb 2003; Aron Griffis <agriffis@g.o> metalog-0.1.ebuild : |
1171 |
-.Ve |
1172 |
.SH "ENVIRONMENT VARIABLES" |
1173 |
.IX Header "ENVIRONMENT VARIABLES" |
1174 |
.IP "\s-1ECHANGELOG_USER\s0" 4 |
1175 |
|
1176 |
Copied: branches/gentoolkit-0.2.4/src/echangelog/test (from rev 556, trunk/src/echangelog/test) |
1177 |
|
1178 |
Modified: branches/gentoolkit-0.2.4/src/ekeyword/ChangeLog |
1179 |
=================================================================== |
1180 |
--- branches/gentoolkit-0.2.4/src/ekeyword/ChangeLog 2009-04-30 15:06:15 UTC (rev 556) |
1181 |
+++ branches/gentoolkit-0.2.4/src/ekeyword/ChangeLog 2009-04-30 21:08:44 UTC (rev 557) |
1182 |
@@ -1,3 +1,12 @@ |
1183 |
+24 Apr 2009 Paul Varner <fuzzyray@g.o> |
1184 |
+ * Handle multiline KEYWORDS |
1185 |
+ |
1186 |
+07 Jan 2009 Mike Frysinger <vapier@g.o> |
1187 |
+ * Support intended KEYWORDS |
1188 |
+ * Convert every instance of KEYWORDS in the file |
1189 |
+ * Error out on invalid arguments #156827 |
1190 |
+ * Tighten up diff output to show KEYWORDS changes |
1191 |
+ |
1192 |
27 Oct 2005 Aron Griffis <agriffis@g.o> |
1193 |
* Fix handling of comments |
1194 |
* Add support for bare ~ as a synonym for ~all |
1195 |
|
1196 |
Modified: branches/gentoolkit-0.2.4/src/ekeyword/ekeyword |
1197 |
=================================================================== |
1198 |
--- branches/gentoolkit-0.2.4/src/ekeyword/ekeyword 2009-04-30 15:06:15 UTC (rev 556) |
1199 |
+++ branches/gentoolkit-0.2.4/src/ekeyword/ekeyword 2009-04-30 21:08:44 UTC (rev 557) |
1200 |
@@ -1,6 +1,6 @@ |
1201 |
#!/usr/bin/perl -w |
1202 |
# |
1203 |
-# Copyright 2003-2004, Gentoo Foundation |
1204 |
+# Copyright 2003-2009, Gentoo Foundation |
1205 |
# Distributed under the terms of the GNU General Public License v2 |
1206 |
# Written by Aron Griffis <agriffis@g.o> |
1207 |
# |
1208 |
@@ -18,97 +18,110 @@ |
1209 |
|
1210 |
# make sure the cmdline consists of keywords and ebuilds |
1211 |
unless (@ARGV > 0) { |
1212 |
- die "syntax: ekeyword { arch | ~[arch] | -[arch] } ebuild...\n" |
1213 |
+ die "syntax: ekeyword { arch | ~[arch] | -[arch] } ebuild...\n" |
1214 |
} |
1215 |
for my $a (@ARGV) { |
1216 |
- $a = '~all' if $a eq '~' or $a eq $ENV{'HOME'}; # for vapier |
1217 |
- next if $a =~ /$kw_re/o; # keyword |
1218 |
- next if $a =~ /^\S+\.ebuild$/; # ebuild |
1219 |
- die "I don't understand $a\n"; |
1220 |
+ $a = '~all' if $a eq '~' or $a eq $ENV{'HOME'}; # for vapier |
1221 |
+ next if $a =~ /$kw_re/o; # keyword |
1222 |
+ next if $a =~ /^\S+\.ebuild$/; # ebuild |
1223 |
+ die "I don't understand $a\n"; |
1224 |
} |
1225 |
|
1226 |
+my $files = 0; |
1227 |
for my $f (@ARGV) { |
1228 |
- if ($f =~ /$kw_re/o) { |
1229 |
- push @kw, $f; |
1230 |
- next; |
1231 |
- } |
1232 |
+ if ($f =~ /$kw_re/o) { |
1233 |
+ push @kw, $f; |
1234 |
+ next; |
1235 |
+ } |
1236 |
|
1237 |
- print "$f\n"; |
1238 |
+ print "$f\n"; |
1239 |
|
1240 |
- open I, "<$f" or die "Can't read $f: $!\n"; |
1241 |
- open O, ">$f.new" or die "Can't create $f.new: $!\n"; |
1242 |
- select O; |
1243 |
+ open I, "<$f" or die "Can't read $f: $!\n"; |
1244 |
+ open O, ">$f.new" or die "Can't create $f.new: $!\n"; |
1245 |
+ select O; |
1246 |
|
1247 |
- while (<I>) { |
1248 |
- /^KEYWORDS/ or print, next; |
1249 |
+ while (<I>) { |
1250 |
+ if (/^\s*KEYWORDS=/) { |
1251 |
|
1252 |
- # extract the quoted section from KEYWORDS |
1253 |
- (my $quoted = $_) =~ s/^.*?["'](.*?)["'].*/$1/s; |
1254 |
+ # extract the quoted section from KEYWORDS |
1255 |
+ while (not /^KEYWORDS=["'].*?["']/) { |
1256 |
+ chomp; |
1257 |
+ my $next = <I>; |
1258 |
+ $_ = join " ", $_, $next; |
1259 |
+ } |
1260 |
+ (my $quoted = $_) =~ s/^.*?["'](.*?)["'].*/$1/s; |
1261 |
|
1262 |
- # replace -* with -STAR for our convenience below |
1263 |
- $quoted =~ s/-\*/-STAR/; |
1264 |
+ # replace -* with -STAR for our convenience below |
1265 |
+ $quoted =~ s/-\*/-STAR/; |
1266 |
|
1267 |
- for my $k (@kw) { |
1268 |
- my ($leader, $arch, $star) = ($k =~ /$kw_re/o); |
1269 |
+ for my $k (@kw) { |
1270 |
+ my ($leader, $arch, $star) = ($k =~ /$kw_re/o); |
1271 |
|
1272 |
- # handle -* and ^* |
1273 |
- if (defined $star) { |
1274 |
- $leader = substr $star,0,1; |
1275 |
- $arch = 'STAR'; |
1276 |
- } |
1277 |
+ # handle -* and ^* |
1278 |
+ if (defined $star) { |
1279 |
+ $leader = substr $star,0,1; |
1280 |
+ $arch = 'STAR'; |
1281 |
+ } |
1282 |
|
1283 |
- # remove keywords |
1284 |
- if ($leader eq '^') { |
1285 |
- if ($arch eq 'all') { |
1286 |
- $quoted = ''; |
1287 |
- } else { |
1288 |
- $quoted =~ s/[-~]?\Q$arch\E\b//; |
1289 |
- } |
1290 |
- } |
1291 |
+ # remove keywords |
1292 |
+ if ($leader eq '^') { |
1293 |
+ if ($arch eq 'all') { |
1294 |
+ $quoted = ''; |
1295 |
+ } else { |
1296 |
+ $quoted =~ s/[-~]?\Q$arch\E\b//; |
1297 |
+ } |
1298 |
|
1299 |
- # add or modify keywords |
1300 |
- else { |
1301 |
- if ($arch eq 'all') { |
1302 |
- # modify all non-masked keywords in the list |
1303 |
- $quoted =~ s/(^|\s)~?(?=\w)/$1$leader/g; |
1304 |
- } else { |
1305 |
- # modify or add keyword |
1306 |
- unless ($quoted =~ s/[-~]?\Q$arch\E(\s|$)/$leader$arch$1/) { |
1307 |
- # modification failed, need to add |
1308 |
- if ($arch eq 'STAR') { |
1309 |
- $quoted = "$leader$arch $quoted"; |
1310 |
- } else { |
1311 |
- $quoted .= " $leader$arch"; |
1312 |
+ # add or modify keywords |
1313 |
+ } else { |
1314 |
+ if ($arch eq 'all') { |
1315 |
+ # modify all non-masked keywords in the list |
1316 |
+ $quoted =~ s/(^|\s)~?(?=\w)/$1$leader/g; |
1317 |
+ } else { |
1318 |
+ # modify or add keyword |
1319 |
+ unless ($quoted =~ s/[-~]?\Q$arch\E(\s|$)/$leader$arch$1/) { |
1320 |
+ # modification failed, need to add |
1321 |
+ if ($arch eq 'STAR') { |
1322 |
+ $quoted = "$leader$arch $quoted"; |
1323 |
+ } else { |
1324 |
+ $quoted .= " $leader$arch"; |
1325 |
+ } |
1326 |
+ } |
1327 |
+ } |
1328 |
+ } |
1329 |
} |
1330 |
- } |
1331 |
- } |
1332 |
- } |
1333 |
- } |
1334 |
|
1335 |
- # replace -STAR with -* |
1336 |
- $quoted =~ s/-STAR\b/-*/; |
1337 |
+ # replace -STAR with -* |
1338 |
+ $quoted =~ s/-STAR\b/-*/; |
1339 |
|
1340 |
- # sort keywords and fix spacing |
1341 |
- $quoted = join " ", sort { |
1342 |
- (my $sa = $a) =~ s/^\W//; |
1343 |
- (my $sb = $b) =~ s/^\W//; |
1344 |
- return -1 if $sa eq '*'; |
1345 |
- return +1 if $sb eq '*'; |
1346 |
- $sa cmp $sb; |
1347 |
- } split " ", $quoted; |
1348 |
+ # sort keywords and fix spacing |
1349 |
+ $quoted = join " ", sort { |
1350 |
+ (my $sa = $a) =~ s/^\W//; |
1351 |
+ (my $sb = $b) =~ s/^\W//; |
1352 |
+ return -1 if $sa eq '*'; |
1353 |
+ return +1 if $sb eq '*'; |
1354 |
+ $sa cmp $sb; |
1355 |
+ } split " ", $quoted; |
1356 |
|
1357 |
- # re-insert quoted to KEYWORDS |
1358 |
- s/(["']).*?["']/$1$quoted$1/; |
1359 |
+ # re-insert quoted to KEYWORDS |
1360 |
+ s/(["']).*?["']/$1$quoted$1/; |
1361 |
|
1362 |
- print $_, <I> or die "Can't write $f.new: $!\n"; |
1363 |
- } |
1364 |
+ print $_ or die "Can't write $f.new: $!\n"; |
1365 |
+ } else { |
1366 |
+ print, next; |
1367 |
+ } |
1368 |
+ } |
1369 |
|
1370 |
- close I; |
1371 |
- close O; |
1372 |
- select STDOUT; |
1373 |
+ close I; |
1374 |
+ close O; |
1375 |
+ select STDOUT; |
1376 |
|
1377 |
- system "diff $f $f.new | grep -v '^[0-1]'"; |
1378 |
- rename "$f.new", "$f" or die "Can't rename: $!\n"; |
1379 |
+ system "diff -U 0 $f $f.new | sed -n '/KEYWORDS=/s:^: :p'"; |
1380 |
+ rename "$f.new", "$f" or die "Can't rename: $!\n"; |
1381 |
+ $files++; |
1382 |
} |
1383 |
|
1384 |
-# vim:ts=8 sw=4 |
1385 |
+if ($files == 0) { |
1386 |
+ die "No ebuilds processed!"; |
1387 |
+} |
1388 |
+ |
1389 |
+# vim:ts=4 sw=4 |
1390 |
|
1391 |
|
1392 |
Property changes on: branches/gentoolkit-0.2.4/src/ekeyword/ekeyword |
1393 |
___________________________________________________________________ |
1394 |
Name: svn:executable |
1395 |
+ * |
1396 |
|
1397 |
Modified: branches/gentoolkit-0.2.4/src/equery/equery |
1398 |
=================================================================== |
1399 |
--- branches/gentoolkit-0.2.4/src/equery/equery 2009-04-30 15:06:15 UTC (rev 556) |
1400 |
+++ branches/gentoolkit-0.2.4/src/equery/equery 2009-04-30 21:08:44 UTC (rev 557) |
1401 |
@@ -17,6 +17,7 @@ |
1402 |
import re |
1403 |
import sys |
1404 |
import time |
1405 |
+from glob import glob |
1406 |
|
1407 |
# portage (output module) and gentoolkit need special path modifications |
1408 |
sys.path.insert(0, "/usr/lib/gentoolkit/pym") |
1409 |
@@ -529,6 +530,23 @@ |
1410 |
except IOError: |
1411 |
print_warn(5, "Could not load USE flag descriptions from " + ppath(gentoolkit.settings["PORTDIR"] + "/profiles/use.desc")) |
1412 |
|
1413 |
+ # TODO: Add USE_EXPANDED variables to usedesc hash -- Bug #238005 |
1414 |
+ # Pseudo-code: |
1415 |
+ # for all files in gentoolkit.settings["PORTDIR"]+"/desc/*.desc |
1416 |
+ # variable name = <filename>_<field1> |
1417 |
+ # description = <field 2> |
1418 |
+ for descfile in glob(gentoolkit.settings["PORTDIR"]+"/profiles/desc/*.desc"): |
1419 |
+ try: |
1420 |
+ fd = open(descfile) |
1421 |
+ for line in fd.readlines(): |
1422 |
+ if line[0] == "#": |
1423 |
+ continue |
1424 |
+ fields = [field.strip() for field in line.split(" - ", 1)] |
1425 |
+ if len(fields) == 2: |
1426 |
+ usedesc["%s_%s" % (descfile.split("/")[-1][0:-5], fields[0],)] = fields[1] |
1427 |
+ except IOError: |
1428 |
+ print_warn(5, "Could not load USE flag descriptions from " + descfile) |
1429 |
+ |
1430 |
# Load local USE flag descriptions |
1431 |
try: |
1432 |
fd = open(gentoolkit.settings["PORTDIR"]+"/profiles/use.local.desc") |
1433 |
@@ -1607,6 +1625,7 @@ |
1434 |
status = 2 |
1435 |
|
1436 |
useflags = pkg.get_env_var("IUSE").split() |
1437 |
+ useflags = [f.lstrip("+-") for f in useflags] |
1438 |
|
1439 |
if query not in useflags: |
1440 |
continue |
1441 |
|
1442 |
Modified: branches/gentoolkit-0.2.4/src/gentoolkit/helpers.py |
1443 |
=================================================================== |
1444 |
--- branches/gentoolkit-0.2.4/src/gentoolkit/helpers.py 2009-04-30 15:06:15 UTC (rev 556) |
1445 |
+++ branches/gentoolkit-0.2.4/src/gentoolkit/helpers.py 2009-04-30 21:08:44 UTC (rev 557) |
1446 |
@@ -130,7 +130,7 @@ |
1447 |
for x in t: |
1448 |
t2 += porttree.dbapi.cp_list(x) |
1449 |
t2 += vartree.dbapi.cp_list(x) |
1450 |
- t2 = unique_array(t2) |
1451 |
+ t2 = unique_array(t2) |
1452 |
return [Package(x) for x in t2] |
1453 |
|
1454 |
def split_package_name(name): |
1455 |
|
1456 |
Modified: branches/gentoolkit-0.2.4/src/gentoolkit/package.py |
1457 |
=================================================================== |
1458 |
--- branches/gentoolkit-0.2.4/src/gentoolkit/package.py 2009-04-30 15:06:15 UTC (rev 556) |
1459 |
+++ branches/gentoolkit-0.2.4/src/gentoolkit/package.py 2009-04-30 21:08:44 UTC (rev 557) |
1460 |
@@ -7,6 +7,7 @@ |
1461 |
# |
1462 |
# $Header$ |
1463 |
|
1464 |
+import os |
1465 |
from errors import FatalError |
1466 |
import portage |
1467 |
from gentoolkit import * |
1468 |
@@ -25,6 +26,7 @@ |
1469 |
self._db = None |
1470 |
self._settings = settings |
1471 |
self._settingslock = settingslock |
1472 |
+ self._portdir_path = os.path.realpath(settings["PORTDIR"]) |
1473 |
|
1474 |
def get_name(self): |
1475 |
"""Returns base name of package, no category nor version""" |
1476 |
@@ -151,7 +153,7 @@ |
1477 |
def is_overlay(self): |
1478 |
"""Returns true if the package is in an overlay.""" |
1479 |
dir,ovl = portage.portdb.findname2(self._cpv) |
1480 |
- return ovl != settings["PORTDIR"] |
1481 |
+ return ovl != self._portdir_path |
1482 |
|
1483 |
def is_masked(self): |
1484 |
"""Returns true if this package is masked against installation. Note: We blindly assume that |
1485 |
|
1486 |
Modified: branches/gentoolkit-0.2.4/src/gentoolkit/pprinter.py |
1487 |
=================================================================== |
1488 |
--- branches/gentoolkit-0.2.4/src/gentoolkit/pprinter.py 2009-04-30 15:06:15 UTC (rev 556) |
1489 |
+++ branches/gentoolkit-0.2.4/src/gentoolkit/pprinter.py 2009-04-30 21:08:44 UTC (rev 557) |
1490 |
@@ -33,7 +33,7 @@ |
1491 |
def die(err, s): |
1492 |
"""Print an error string and die with an error code.""" |
1493 |
print_error(s) |
1494 |
- sys.exit(-err) |
1495 |
+ sys.exit(err) |
1496 |
|
1497 |
# Colour settings |
1498 |
|
1499 |
|
1500 |
Modified: branches/gentoolkit-0.2.4/src/glsa-check/glsa-check |
1501 |
=================================================================== |
1502 |
--- branches/gentoolkit-0.2.4/src/glsa-check/glsa-check 2009-04-30 15:06:15 UTC (rev 556) |
1503 |
+++ branches/gentoolkit-0.2.4/src/glsa-check/glsa-check 2009-04-30 21:08:44 UTC (rev 557) |
1504 |
@@ -82,10 +82,10 @@ |
1505 |
# sanity checking |
1506 |
if len(args) <= 0: |
1507 |
sys.stderr.write("no option given: what should I do ?\n") |
1508 |
- mode="help" |
1509 |
+ mode = "HELP" |
1510 |
elif len(args) > 1: |
1511 |
sys.stderr.write("please use only one command per call\n") |
1512 |
- mode = "help" |
1513 |
+ mode = "HELP" |
1514 |
else: |
1515 |
# in what mode are we ? |
1516 |
args = args[0] |
1517 |
@@ -96,32 +96,37 @@ |
1518 |
except GetoptError, e: |
1519 |
sys.stderr.write("unknown option given: ") |
1520 |
sys.stderr.write(str(e)+"\n") |
1521 |
- mode = "help" |
1522 |
+ mode = "HELP" |
1523 |
|
1524 |
# we need a set of glsa for most operation modes |
1525 |
if len(params) <= 0 and mode in ["fix", "test", "pretend", "dump", "inject", "mail"]: |
1526 |
sys.stderr.write("\nno GLSA given, so we'll do nothing for now. \n") |
1527 |
sys.stderr.write("If you want to run on all GLSA please tell me so \n") |
1528 |
sys.stderr.write("(specify \"all\" as parameter)\n\n") |
1529 |
- mode = "help" |
1530 |
+ mode = "HELP" |
1531 |
elif len(params) <= 0 and mode == "list": |
1532 |
params.append("new") |
1533 |
|
1534 |
# show help message |
1535 |
-if mode == "help": |
1536 |
- sys.stderr.write("\nSyntax: glsa-check <option> [glsa-list]\n\n") |
1537 |
+if mode == "help" or mode == "HELP": |
1538 |
+ msg = "Syntax: glsa-check <option> [glsa-list]\n\n" |
1539 |
for m in optionmap: |
1540 |
- sys.stderr.write(m[0] + "\t" + m[1] + " \t: " + m[-1] + "\n") |
1541 |
+ msg += m[0] + "\t" + m[1] + " \t: " + m[-1] + "\n" |
1542 |
for o in m[2:-1]: |
1543 |
- sys.stderr.write("\t" + o + "\n") |
1544 |
- sys.stderr.write("\nglsa-list can contain an arbitrary number of GLSA ids, \n") |
1545 |
- sys.stderr.write("filenames containing GLSAs or the special identifiers \n") |
1546 |
- sys.stderr.write("'all', 'new' and 'affected'\n") |
1547 |
- sys.exit(1) |
1548 |
+ msg += "\t" + o + "\n" |
1549 |
+ msg += "\nglsa-list can contain an arbitrary number of GLSA ids, \n" |
1550 |
+ msg += "filenames containing GLSAs or the special identifiers \n" |
1551 |
+ msg += "'all', 'new' and 'affected'\n" |
1552 |
+ if mode == "help": |
1553 |
+ sys.stdout.write(msg) |
1554 |
+ sys.exit(0) |
1555 |
+ else: |
1556 |
+ sys.stderr.write("\n" + msg) |
1557 |
+ sys.exit(1) |
1558 |
|
1559 |
# we need root priviledges for write access |
1560 |
if mode in ["fix", "inject"] and os.geteuid() != 0: |
1561 |
- sys.stderr.write("\nThis tool needs root access to "+mode+" this GLSA\n\n") |
1562 |
+ sys.stderr.write(__program__ + ": root access is needed for \""+mode+"\" mode\n") |
1563 |
sys.exit(2) |
1564 |
|
1565 |
# show version and copyright information |
1566 |
@@ -217,7 +222,7 @@ |
1567 |
fd1.write("... ") |
1568 |
else: |
1569 |
for pkg in myglsa.packages.keys(): |
1570 |
- mylist = vardb.match(portage.dep_getkey(pkg)) |
1571 |
+ mylist = vardb.match(portage.dep_getkey(str(pkg))) |
1572 |
if len(mylist) > 0: |
1573 |
pkg = color(" ".join(mylist)) |
1574 |
fd1.write(" " + pkg + " ") |
1575 |
@@ -259,6 +264,8 @@ |
1576 |
exitcode >>= 8 |
1577 |
if exitcode: |
1578 |
sys.exit(exitcode) |
1579 |
+ if len(mergelist): |
1580 |
+ sys.stdout.write("\n") |
1581 |
myglsa.inject() |
1582 |
elif mode == "pretend": |
1583 |
sys.stdout.write("Checking GLSA "+myid+"\n") |
1584 |
@@ -276,10 +283,10 @@ |
1585 |
sys.stdout.write(" " + pkg + " (" + oldver + ")\n") |
1586 |
else: |
1587 |
sys.stdout.write("Nothing to do for this GLSA\n") |
1588 |
+ sys.stdout.write("\n") |
1589 |
elif mode == "inject": |
1590 |
sys.stdout.write("injecting " + myid + "\n") |
1591 |
myglsa.inject() |
1592 |
- sys.stdout.write("\n") |
1593 |
sys.exit(0) |
1594 |
|
1595 |
# test is a bit different as Glsa.test() produces no output |
1596 |
|
1597 |
|
1598 |
Property changes on: branches/gentoolkit-0.2.4/src/glsa-check/glsa-check |
1599 |
___________________________________________________________________ |
1600 |
Name: svn:executable |
1601 |
+ * |
1602 |
|
1603 |
Modified: branches/gentoolkit-0.2.4/src/revdep-rebuild/revdep-rebuild |
1604 |
=================================================================== |
1605 |
--- branches/gentoolkit-0.2.4/src/revdep-rebuild/revdep-rebuild 2009-04-30 15:06:15 UTC (rev 556) |
1606 |
+++ branches/gentoolkit-0.2.4/src/revdep-rebuild/revdep-rebuild 2009-04-30 21:08:44 UTC (rev 557) |
1607 |
@@ -123,6 +123,7 @@ |
1608 |
eerror "I was instructed to rm '$@'" |
1609 |
die 1 "Refusing to delete anything before changing to temporary directory." |
1610 |
} |
1611 |
+: <<'EW' |
1612 |
## |
1613 |
# GNU find has -executable, but if our users' finds do not have that flag |
1614 |
# we emulate it with this function. Also emulates -writable and -readable. |
1615 |
@@ -158,6 +159,7 @@ |
1616 |
fi |
1617 |
find "$@" |
1618 |
} |
1619 |
+EW |
1620 |
|
1621 |
print_usage() { |
1622 |
cat << EOF |
1623 |
@@ -222,7 +224,7 @@ |
1624 |
# Replace whitespace with linebreaks, normalize repeated '/' chars, and sort -u |
1625 |
# (If any libs have whitespace in their filenames, someone needs punishment.) |
1626 |
clean_var() { |
1627 |
- awk 'BEGIN {RS="[[:space:]]"} |
1628 |
+ gawk 'BEGIN {RS="[[:space:]]"} |
1629 |
/-\*/ {exit} |
1630 |
/[^[:space:]]/ {gsub(/\/\/+/, "/"); print}' | sort -u |
1631 |
} |
1632 |
@@ -264,7 +266,7 @@ |
1633 |
# Normalize some EMERGE_OPTIONS |
1634 |
EMERGE_OPTIONS=(${EMERGE_OPTIONS[@]/%-p/--pretend}) |
1635 |
EMERGE_OPTIONS=(${EMERGE_OPTIONS[@]/%-f/--fetchonly}) |
1636 |
- EMERGE_OPTIONS=(${EMERGE_OPTIONS[@]/%-f/--verbose}) |
1637 |
+ EMERGE_OPTIONS=(${EMERGE_OPTIONS[@]/%-v/--verbose}) |
1638 |
} |
1639 |
## |
1640 |
# Use the color preference from portage |
1641 |
@@ -633,8 +635,8 @@ |
1642 |
findMask="${findMask[@]/#/-o -path }" |
1643 |
findMask="( ${findMask#-o } ) -prune -o" |
1644 |
fi |
1645 |
- # TODO: Check this |
1646 |
- find ${SEARCH_DIRS[@]} $findMask -type f \( -executable -o \ |
1647 |
+ # TODO: Check this -- afaict SEARCH_DIRS isn't an array, so this should just be $SEARCH_DIRS? |
1648 |
+ find ${SEARCH_DIRS[@]} $findMask -type f \( -perm -u+x -o -perm -g+x -o -perm -o+x -o \ |
1649 |
-name '*.so' -o -name '*.so.*' -o -name '*.la' \) -print 2> /dev/null | |
1650 |
sort -u > "$FILES_FILE" || |
1651 |
die $? "find failed to list binary files (This is a bug.)" |
1652 |
@@ -735,18 +737,39 @@ |
1653 |
fi |
1654 |
elif [[ $SEARCH_BROKEN ]]; then |
1655 |
# Look for broken .la files |
1656 |
+ la_SEARCH_DIRS="$SEARCH_DIRS" |
1657 |
+ la_search_dir="" |
1658 |
+ la_broken="" |
1659 |
+ la_lib="" |
1660 |
for depend in $( |
1661 |
- awk -F"[=']" '/^dependency_libs/{ |
1662 |
- gsub("^-[^[:space:]]*", "", $3); |
1663 |
- gsub("[[:space:]]-[^[:space:]]*", "", $3); |
1664 |
+ gawk -F"[=']" '/^dependency_libs/{ |
1665 |
print $3 |
1666 |
}' "$target_file" |
1667 |
); do |
1668 |
if [[ $depend = /* && ! -e $depend ]]; then |
1669 |
echo "obj $target_file" >> "$BROKEN_FILE" |
1670 |
echo_v " broken $target_file (requires $depend)" |
1671 |
+ elif [[ $depend = "-L/"* || $depend = "-R/"* ]]; then |
1672 |
+ if ! [[ $'\n'${la_SEARCH_DIRS}$'\n' == *$'\n'${depend#-?}$'\n'* ]]; then |
1673 |
+ la_SEARCH_DIRS+=$'\n'"${depend#-?}" |
1674 |
+ fi |
1675 |
+ elif [[ $depend = "-l"* ]]; then |
1676 |
+ la_lib="lib${depend#-l}" |
1677 |
+ la_broken="yes" |
1678 |
+ IFS=$'\n' |
1679 |
+ for la_search_dir in $la_SEARCH_DIRS; do |
1680 |
+ if [[ -e ${la_search_dir}/${la_lib}.so || -e ${la_search_dir}/${la_lib}.a ]]; then |
1681 |
+ la_broken="no" |
1682 |
+ fi |
1683 |
+ done |
1684 |
+ IFS="$OIFS" |
1685 |
+ if [[ $la_broken = yes ]]; then |
1686 |
+ echo "obj $target_file" >> "$BROKEN_FILE" |
1687 |
+ echo_v " broken $target_file (requires $depend)" |
1688 |
+ fi |
1689 |
fi |
1690 |
done |
1691 |
+ unset la_SEARCH_DIRS la_search_dir la_broken la_lib |
1692 |
fi |
1693 |
[[ $VERBOSE ]] && |
1694 |
progress $((++i)) $numFiles $target_file || |
1695 |
@@ -760,7 +783,7 @@ |
1696 |
done < <( |
1697 |
# Regexify LD_LIBRARY_MASK. Exclude it from the search. |
1698 |
LD_LIBRARY_MASK="${LD_LIBRARY_MASK//$'\n'/|}" |
1699 |
- awk -v ldmask="(${LD_LIBRARY_MASK//./\\\.})" ' |
1700 |
+ gawk -v ldmask="(${LD_LIBRARY_MASK//./\\\.})" ' |
1701 |
/no version information available/ && $0 !~ ldmask { |
1702 |
gsub(/[()]/, "", $NF) |
1703 |
if (seen[$NF]++) next |
1704 |
@@ -945,7 +968,7 @@ |
1705 |
ewarn "The broken files are:" |
1706 |
while read filename junk; do |
1707 |
[[ $junk = *none* ]] && ewarn " $filename" |
1708 |
- done < "$OWNERS_FILE" | awk '!s[$0]++' # (omit dupes) |
1709 |
+ done < "$OWNERS_FILE" | gawk '!s[$0]++' # (omit dupes) |
1710 |
fi |
1711 |
} |
1712 |
## |
1713 |
@@ -1080,8 +1103,11 @@ |
1714 |
einfo 'Build finished correctly. Removing temporary files...' |
1715 |
einfo |
1716 |
einfo 'You can re-run revdep-rebuild to verify that all libraries and binaries' |
1717 |
- einfo 'are fixed. If some inconsistency remains, it can be orphaned file, deep' |
1718 |
- einfo 'dependency, binary package or specially evaluated library.' |
1719 |
+ einfo 'are fixed. Possible reasons for remaining inconsistencies include:' |
1720 |
+ einfo ' orphaned files' |
1721 |
+ einfo ' deep dependencies' |
1722 |
+ einfo " packages installed outside of portage's control" |
1723 |
+ einfo ' specially-evaluated libraries' |
1724 |
if [[ -r "$OWNERS_FILE" && -s "$OWNERS_FILE" ]]; then |
1725 |
show_unowned_files |
1726 |
fi |
1727 |
|
1728 |
Modified: branches/gentoolkit-0.2.4/src/revdep-rebuild/revdep-rebuild.1 |
1729 |
=================================================================== |
1730 |
--- branches/gentoolkit-0.2.4/src/revdep-rebuild/revdep-rebuild.1 2009-04-30 15:06:15 UTC (rev 556) |
1731 |
+++ branches/gentoolkit-0.2.4/src/revdep-rebuild/revdep-rebuild.1 2009-04-30 21:08:44 UTC (rev 557) |
1732 |
@@ -91,6 +91,43 @@ |
1733 |
.br |
1734 |
\fBrevdep\-rebuild \-\-library libImlib[2]*.so.*\fR |
1735 |
|
1736 |
+.SH "FILES" |
1737 |
+.P |
1738 |
+revdep\-rebuild keeps several pseudo-temporary files in /var/cache/revdep\-rebuild/. Deleting these files can improve accuracy at the cost of speed: |
1739 |
+.TP 15 |
1740 |
+.I 0_env.rr |
1741 |
+Contains environment variables |
1742 |
+.TP |
1743 |
+.I 1_files.rr |
1744 |
+Contains a list of files to search |
1745 |
+.TP |
1746 |
+.I 2_ldpath.rr |
1747 |
+Contains the LDPATH |
1748 |
+.TP |
1749 |
+.I 3_broken.rr |
1750 |
+Contains the list of broken files |
1751 |
+.TP |
1752 |
+.I 3_errors.rr |
1753 |
+Contains the ldd error output |
1754 |
+.TP |
1755 |
+.I 4_raw.rr |
1756 |
+Contains the raw list of packages |
1757 |
+.TP |
1758 |
+.I 4_owners.rr |
1759 |
+Contains the file owners |
1760 |
+.TP |
1761 |
+.I 4_pkgs.rr |
1762 |
+Contains the unsorted bare package names |
1763 |
+.TP |
1764 |
+.I 4_ebuilds.rr |
1765 |
+Contains the unsorted atoms |
1766 |
+.TP |
1767 |
+.I 5_order.rr |
1768 |
+Contains the sorted atoms |
1769 |
+.TP |
1770 |
+.I 6_status.rr |
1771 |
+Contains the ldd error output |
1772 |
+ |
1773 |
.SH "EXIT STATUS" |
1774 |
revdep\-rebuild returns a zero exit status if it \fBand emerge\fR succeeds, and a nonzero exit status otherwise. |
1775 |
.SH "BUGS" |