Gentoo Archives: gentoo-commits

From: "Paul Varner (fuzzyray)" <fuzzyray@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoolkit r552 - trunk/src/echangelog
Date: Tue, 28 Apr 2009 16:03:40
Message-Id: E1LypmR-0004KN-Lo@stork.gentoo.org
1 Author: fuzzyray
2 Date: 2009-04-28 16:03:35 +0000 (Tue, 28 Apr 2009)
3 New Revision: 552
4
5 Modified:
6 trunk/src/echangelog/echangelog
7 trunk/src/echangelog/echangelog.1
8 Log:
9 Update echangelog with updates from idl0r
10
11 Modified: trunk/src/echangelog/echangelog
12 ===================================================================
13 --- trunk/src/echangelog/echangelog 2009-04-28 15:45:40 UTC (rev 551)
14 +++ trunk/src/echangelog/echangelog 2009-04-28 16:03:35 UTC (rev 552)
15 @@ -24,22 +24,30 @@
16 my ($input, $editor, $entry, $user, $date, $text, $year, $vcs);
17 my ($opt_help, $opt_strict, $opt_version);
18
19 -my %vcs = ( cvs => { diff => "cvs -f diff -U0",
20 - status => "cvs -fn up",
21 - add => "cvs -f add",
22 - skip => 6,
23 - regex => qr/^Index: (([^\/]*?)\.ebuild)\s*$/ },
24 - svn => { diff => "svn diff -N",
25 - status => "svn status",
26 - add => "svn add",
27 - skip => 6,
28 - regex => qr/^Index: (([^\/]*?)\.ebuild)\s*$/ },
29 - git => { diff => "git diff",
30 - status => "git diff-index HEAD --name-status",
31 - add => "git add",
32 - skip => 4,
33 - regex => qr/^diff \-\-git \S*\/((\S*)\.ebuild)/ }
34 -
35 +my %vcs = (
36 + cvs => {
37 + diff => "cvs -f diff -U0",
38 + status => "cvs -fn up",
39 + add => "cvs -f add",
40 + skip => 6,
41 + regex => qr/^Index: (([^\/]*?)\.ebuild)\s*$/
42 + },
43 + svn => {
44 + diff => "svn diff -N",
45 + status => "svn status",
46 + add => "svn add",
47 + skip => 4,
48 + regex => qr/^Index: (([^\/]*?)\.ebuild)\s*$/
49 + },
50 + git => {
51 + diff => "git diff",
52 + status => "git diff-index HEAD --name-status",
53 + add => "git add",
54 + # This value should usually be 3 but on new file mode we need skip+1.
55 + # So 4 should be fine anyway.
56 + skip => 4,
57 + regex => qr/^diff \-\-git \S*\/((\S*)\.ebuild)/
58 + },
59 );
60
61 sub usage {
62 @@ -144,7 +152,7 @@
63 my $prefix = <P>;
64 $prefix = substr($prefix, 0, -1);
65 close P;
66 -
67 +
68 if ($filename =~ /$prefix(\S*)/) {
69 $filename = $1 ;
70 }
71 @@ -296,6 +304,15 @@
72 }
73 @files = sort sortfunc @files;
74
75 +# Just to ensure we don't get duplicate entries.
76 +sub mypush(\@@) {
77 + my $aref = shift;
78 +
79 + foreach my $value (@_) {
80 + push(@{$aref}, $value) if !grep(/^$value$/, @{$aref});
81 + }
82 +}
83 +
84 # Forget ebuilds that only have changed copyrights, unless that's all
85 # the changed files we have
86
87 @@ -304,53 +321,60 @@
88
89 if (@ebuilds) {
90 if ($vcs eq "git") {
91 - open C, $vcs{$vcs}{diff}." HEAD -- @ebuilds 2>&1 |" or die "Can't run: ".$vcs{$vcs}{diff}."$!\n";
92 + open C, $vcs{$vcs}{diff}." HEAD -- @ebuilds 2>&1 |" or die "Can't run: ".$vcs{$vcs}{diff}."$!\n";
93 } else {
94 open C, $vcs{$vcs}{diff}." @ebuilds 2>&1 |" or die "Can't run: ".$vcs{$vcs}{diff}."$!\n";
95 }
96 +
97 $_ = <C>;
98 +
99 while (defined $_) {
100 - # only possible with cvs
101 - if (/^$vcs diff: (([^\/]*?)\.ebuild) was removed/) {
102 - push @files, $1;
103 - }
104 + # only possible with cvs
105 + if (/^$vcs diff: (([^\/]*?)\.ebuild) was removed/) {
106 + mypush(@files, $1);
107 + }
108
109 - # We assume GNU diff output format here.
110 - # git format: diff --git a/app-doc/repodoc/metadata.xml b/app-doc/repodoc/metadata.xml
111 - elsif (/$vcs{$vcs}{regex}/) {
112 - my $f;
113 - ($f) = ($1);
114 - if ($vcs eq "git") {
115 - my $version = ($2);
116 - while (<C>) {
117 - last if /^deleted file mode|^index/;
118 - if (/^new file mode/) {
119 - push @new_versions, $version; # new ebuild, will create a new entry
120 - last;
121 - }
122 - }
123 - }
124 + # We assume GNU diff output format here.
125 + # git format: diff --git a/app-doc/repodoc/metadata.xml b/app-doc/repodoc/metadata.xml
126 + elsif (/$vcs{$vcs}{regex}/) {
127 + my $f = $1;
128
129 + if ($vcs eq "git") {
130 + my $version = $2;
131 +
132 + while (<C>) {
133 + last if /^deleted file mode|^index/;
134 + if (/^new file mode/) {
135 + mypush(@files, $f);
136 + mypush(@new_versions, $version);
137 + last;
138 + }
139 + }
140 + }
141 +
142 # check if more than just copyright date changed.
143 # skip some lines (vcs dependent)
144 - foreach(1..$vcs{$vcs}{skip}){
145 - $_ = <C>;
146 - }
147 - while (<C>) {
148 + foreach(1..$vcs{$vcs}{skip}) {
149 + $_ = <C>;
150 + }
151 +
152 + while (<C>) {
153 last if /^[A-Za-z]/;
154 if (/^[-+](?!# Copyright)/) {
155 - push @files, $f;
156 + mypush(@files, $f);
157 last;
158 }
159 }
160 +
161 # at this point we've either added $f to @files or not,
162 # and we have the next line in $_ for processing
163 next;
164 }
165 - elsif (/^$vcs.*?: (([^\/]*?)\.ebuild) is a new entry/) {
166 - push @files, $1;
167 - push @new_versions, $2; # new ebuild, will create a new entry
168 + elsif (/^$vcs.*?: (([^\/]*?)\.ebuild) is a new entry/) {
169 + mypush(@files, $1);
170 + mypush(@new_versions, $2);
171 }
172 +
173 # other cvs output is ignored
174 $_ = <C>;
175 }
176 @@ -359,14 +383,16 @@
177
178 # Subversion diff doesn't identify new versions. So use the status command
179 if (($vcs eq "svn") and (@ebuilds)) {
180 - open C, $vcs{$vcs}{status}." @ebuilds 2>&1 |" or die "Can't run: ".$vcs{$vcs}{status}."$!\n";
181 - $_ = <C>;
182 - while (defined $_) {
183 - if (/^A\s*(\s{1}[^\s]*)\.ebuild/) {
184 - push @new_versions, $1;
185 - }
186 - $_ = <C>;
187 - }
188 + open C, $vcs{$vcs}{status}." @ebuilds 2>&1 |" or die "Can't run: ".$vcs{$vcs}{status}."$!\n";
189 + $_ = <C>;
190 +
191 + while (defined $_) {
192 + if (/^A\s*(([^\s]*)\.ebuild)/) {
193 + mypush(@files, $1);
194 + mypush(@new_versions, $2);
195 + }
196 + $_ = <C>;
197 + }
198 }
199
200 # When a package move occurs, the versions appear to be new even though they are
201 @@ -392,6 +418,10 @@
202 @files = qw/ChangeLog/ unless @files; # last resort to put something in the list
203 }
204
205 +# sort
206 +@files = sort sortfunc @files;
207 +@new_versions = sort sortfunc @new_versions;
208 +
209 # Get the input from the cmdline, editor or stdin
210 if ($ARGV[0]) {
211 $input = "@ARGV";
212 @@ -547,4 +577,4 @@
213 system("$vcs{$vcs}{add} ChangeLog 2>&1 >> /dev/null");
214 }
215
216 -# vim:sw=4 ts=8 expandtab
217 +# vim:sw=4 ts=4 expandtab
218
219 Modified: trunk/src/echangelog/echangelog.1
220 ===================================================================
221 --- trunk/src/echangelog/echangelog.1 2009-04-28 15:45:40 UTC (rev 551)
222 +++ trunk/src/echangelog/echangelog.1 2009-04-28 16:03:35 UTC (rev 552)
223 @@ -1,4 +1,4 @@
224 -.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.13
225 +.\" Automatically generated by Pod::Man 2.16 (Pod::Simple 3.07)
226 .\"
227 .\" Standard preamble:
228 .\" ========================================================================
229 @@ -25,11 +25,11 @@
230 ..
231 .\" Set up some character translations and predefined strings. \*(-- will
232 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
233 -.\" double quote, and \*(R" will give a right double quote. | will give a
234 -.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
235 -.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
236 -.\" expand to `' in nroff, nothing in troff, for use with C<>.
237 -.tr \(*W-|\(bv\*(Tr
238 +.\" double quote, and \*(R" will give a right double quote. \*(C+ will
239 +.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
240 +.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
241 +.\" nothing in troff, for use with C<>.
242 +.tr \(*W-
243 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
244 .ie n \{\
245 . ds -- \(*W-
246 @@ -48,23 +48,26 @@
247 . ds R" ''
248 'br\}
249 .\"
250 +.\" Escape single quotes in literal strings from groff's Unicode transform.
251 +.ie \n(.g .ds Aq \(aq
252 +.el .ds Aq '
253 +.\"
254 .\" If the F register is turned on, we'll generate index entries on stderr for
255 .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
256 .\" entries marked with X<> in POD. Of course, you'll have to process the
257 .\" output yourself in some meaningful fashion.
258 -.if \nF \{\
259 +.ie \nF \{\
260 . de IX
261 . tm Index:\\$1\t\\n%\t"\\$2"
262 ..
263 . nr % 0
264 . rr F
265 .\}
266 +.el \{\
267 +. de IX
268 +..
269 +.\}
270 .\"
271 -.\" For nroff, turn off justification. Always turn off hyphenation; it makes
272 -.\" way too many mistakes in technical documents.
273 -.hy 0
274 -.if n .na
275 -.\"
276 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
277 .\" Fear. Run. Save yourself. No user-serviceable parts.
278 . \" fudge factors for nroff and troff
279 @@ -128,8 +131,12 @@
280 .rm #[ #] #H #V #F C
281 .\" ========================================================================
282 .\"
283 -.IX Title "ECHANGELOG 1"
284 -.TH ECHANGELOG 1 "2004-04-02" "perl v5.8.2" "User Contributed Perl Documentation"
285 +.IX Title "echangelog 1"
286 +.TH echangelog 1 "2009-04-28" "perl v5.10.0" "Gentoolkit"
287 +.\" For nroff, turn off justification. Always turn off hyphenation; it makes
288 +.\" way too many mistakes in technical documents.
289 +.if n .ad l
290 +.nh
291 .SH "NAME"
292 echangelog \- Gentoo: update portage ChangeLogs
293 .SH "SYNOPSIS"
294 @@ -141,7 +148,7 @@
295 in Gentoo. The tool scans the current directory, which is assumed to
296 be a package directory such as /usr/portage/app\-editors/vim, finds
297 what files have been changed or added, and inserts the appropriate
298 -entry to ChangeLog. If \fItext\fR is not provided on the command\-line,
299 +entry to ChangeLog. If \fItext\fR is not provided on the command-line,
300 echangelog prompts for it.
301 .PP
302 All modifications should occur before running echangelog so that it
303 @@ -152,7 +159,7 @@
304 If your text would cause the ChangeLog entry to exceed 80 columns, it
305 will be rewrapped to keep the ChangeLog neat. If you need special
306 formatting in the ChangeLog, then you can either (1) run echangelog
307 -with no text on the command\-line, and make sure that your text won't
308 +with no text on the command-line, and make sure that your text won't
309 be too wide, (2) edit the ChangeLog manually. If you prefer (2), I'd
310 recommend something like \*(L"echangelog blah\*(R" so that the header lines
311 are computed correctly, then edit and change \*(L"blah\*(R" to your preferred
312 @@ -164,37 +171,29 @@
313 echangelog when it finishes its work.
314 .SH "OPTIONS"
315 .IX Header "OPTIONS"
316 -.TP
317 -.BR --help
318 -Display help output (just like this section ...).
319 -.TP
320 -.BR --strict
321 -Abort execution if only simple changes (like date changes) are found.
322 -.TP
323 -.BR --version
324 -Display version information.
325 +Presently echangelog is simple enough that it supplies no options.
326 +Probably I'll add \fB\-\-help\fR and \fB\-\-version\fR in the future, but for
327 +now it's enough to track the gentoolkit version.
328 .SH "EXAMPLES"
329 .IX Header "EXAMPLES"
330 To create a ChangeLog for a completely new package. The header is
331 parsed from skel.ebuild.
332 .PP
333 .Vb 2
334 -\& $ cvs add metalog-0.1.ebuild
335 -\& cvs server: use 'cvs commit' to add this file permanently
336 -.Ve
337 -.PP
338 -.Vb 13
339 -\& $ echangelog 'New ebuild, thanks to Harvey McGillicuddy'
340 -\& --- ChangeLog 1969-12-31 19:00:00.000000000 -0500
341 -\& +++ ChangeLog.new 2003-02-23 14:04:06.000000000 -0500
342 -\& @@ -0,0 +1,9 @@
343 -\& +# ChangeLog for app-admin/metalog
344 -\& +# Copyright 2000-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2
345 +\& $ cvs add metalog\-0.1.ebuild
346 +\& cvs server: use \*(Aqcvs commit\*(Aq to add this file permanently
347 +\&
348 +\& $ echangelog \*(AqNew ebuild, thanks to Harvey McGillicuddy\*(Aq
349 +\& \-\-\- ChangeLog 1969\-12\-31 19:00:00.000000000 \-0500
350 +\& +++ ChangeLog.new 2003\-02\-23 14:04:06.000000000 \-0500
351 +\& @@ \-0,0 +1,9 @@
352 +\& +# ChangeLog for app\-admin/metalog
353 +\& +# Copyright 2000\-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2
354 \& +# $Header$
355 \& +
356 -\& +*metalog-0.1 (23 Feb 2003)
357 +\& +*metalog\-0.1 (23 Feb 2003)
358 \& +
359 -\& + 23 Feb 2003; Aron Griffis <agriffis@g.o> metalog-0.1.ebuild :
360 +\& + 23 Feb 2003; Aron Griffis <agriffis@g.o> metalog\-0.1.ebuild :
361 \& + New ebuild, thanks to Harvey McGillicuddy
362 \& +
363 .Ve
364 @@ -203,61 +202,51 @@
365 will notice the new file.
366 .PP
367 .Vb 2
368 -\& $ cvs add metalog-0.1-r1.ebuild
369 -\& cvs server: use 'cvs commit' to add this file permanently
370 -.Ve
371 -.PP
372 -.Vb 6
373 -\& $ echangelog 'Bump revision to fix bug #999'
374 -\& --- ChangeLog 2003-02-23 14:04:06.000000000 -0500
375 -\& +++ ChangeLog.new 2003-02-23 14:07:48.000000000 -0500
376 -\& @@ -2,6 +2,11 @@
377 -\& # Copyright 2000-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2
378 +\& $ cvs add metalog\-0.1\-r1.ebuild
379 +\& cvs server: use \*(Aqcvs commit\*(Aq to add this file permanently
380 +\&
381 +\& $ echangelog \*(AqBump revision to fix bug #999\*(Aq
382 +\& \-\-\- ChangeLog 2003\-02\-23 14:04:06.000000000 \-0500
383 +\& +++ ChangeLog.new 2003\-02\-23 14:07:48.000000000 \-0500
384 +\& @@ \-2,6 +2,11 @@
385 +\& # Copyright 2000\-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2
386 \& # $Header$
387 -.Ve
388 -.PP
389 -.Vb 6
390 -\& +*metalog-0.1-r1 (23 Feb 2003)
391 +\&
392 +\& +*metalog\-0.1\-r1 (23 Feb 2003)
393 \& +
394 -\& + 23 Feb 2003; Aron Griffis <agriffis@g.o> metalog-0.1-r1.ebuild :
395 +\& + 23 Feb 2003; Aron Griffis <agriffis@g.o> metalog\-0.1\-r1.ebuild :
396 \& + Bump revision to fix bug #999
397 \& +
398 -\& *metalog-0.1 (23 Feb 2003)
399 +\& *metalog\-0.1 (23 Feb 2003)
400 +\&
401 +\& 23 Feb 2003; Aron Griffis <agriffis@g.o> metalog\-0.1.ebuild :
402 .Ve
403 .PP
404 -.Vb 1
405 -\& 23 Feb 2003; Aron Griffis <agriffis@g.o> metalog-0.1.ebuild :
406 -.Ve
407 -.PP
408 For a multi-line entry, omit the command-line arg.
409 .PP
410 .Vb 10
411 \& $ echangelog
412 -\& Please type the log entry, finish with ctrl-d
413 +\& Please type the log entry, finish with ctrl\-d
414 \& Bump revision to fix bug #999. Necessary to bump the revision because
415 -\& the problem appears at run-time, not compile-time. This should also
416 +\& the problem appears at run\-time, not compile\-time. This should also
417 \& give users the updated default configuration file.
418 -\& --- ChangeLog 2003-02-23 14:09:12.000000000 -0500
419 -\& +++ ChangeLog.new 2003-02-23 14:12:43.000000000 -0500
420 -\& @@ -2,6 +2,13 @@
421 -\& # Copyright 2000-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2
422 +\& \-\-\- ChangeLog 2003\-02\-23 14:09:12.000000000 \-0500
423 +\& +++ ChangeLog.new 2003\-02\-23 14:12:43.000000000 \-0500
424 +\& @@ \-2,6 +2,13 @@
425 +\& # Copyright 2000\-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2
426 \& # $Header$
427 -.Ve
428 -.PP
429 -.Vb 8
430 -\& +*metalog-0.1-r1 (23 Feb 2003)
431 +\&
432 +\& +*metalog\-0.1\-r1 (23 Feb 2003)
433 \& +
434 -\& + 23 Feb 2003; Aron Griffis <agriffis@g.o> metalog-0.1-r1.ebuild :
435 +\& + 23 Feb 2003; Aron Griffis <agriffis@g.o> metalog\-0.1\-r1.ebuild :
436 \& + Bump revision to fix bug #999. Necessary to bump the revision because
437 -\& + the problem appears at run-time, not compile-time. This should also
438 +\& + the problem appears at run\-time, not compile\-time. This should also
439 \& + give users the updated default configuration file.
440 \& +
441 -\& *metalog-0.1 (23 Feb 2003)
442 +\& *metalog\-0.1 (23 Feb 2003)
443 +\&
444 +\& 23 Feb 2003; Aron Griffis <agriffis@g.o> metalog\-0.1.ebuild :
445 .Ve
446 -.PP
447 -.Vb 1
448 -\& 23 Feb 2003; Aron Griffis <agriffis@g.o> metalog-0.1.ebuild :
449 -.Ve
450 .SH "ENVIRONMENT VARIABLES"
451 .IX Header "ENVIRONMENT VARIABLES"
452 .IP "\s-1ECHANGELOG_USER\s0" 4