aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtrunk/src/echangelog/echangelog138
-rw-r--r--trunk/src/echangelog/echangelog.1139
2 files changed, 148 insertions, 129 deletions
diff --git a/trunk/src/echangelog/echangelog b/trunk/src/echangelog/echangelog
index 524b01c..28358fa 100755
--- a/trunk/src/echangelog/echangelog
+++ b/trunk/src/echangelog/echangelog
@@ -24,22 +24,30 @@ my (@files, @ebuilds, @conflicts, @trivial, @unknown, @new_versions, %actions);
my ($input, $editor, $entry, $user, $date, $text, $year, $vcs);
my ($opt_help, $opt_strict, $opt_version);
-my %vcs = ( cvs => { diff => "cvs -f diff -U0",
- status => "cvs -fn up",
- add => "cvs -f add",
- skip => 6,
- regex => qr/^Index: (([^\/]*?)\.ebuild)\s*$/ },
- svn => { diff => "svn diff -N",
- status => "svn status",
- add => "svn add",
- skip => 6,
- regex => qr/^Index: (([^\/]*?)\.ebuild)\s*$/ },
- git => { diff => "git diff",
- status => "git diff-index HEAD --name-status",
- add => "git add",
- skip => 4,
- regex => qr/^diff \-\-git \S*\/((\S*)\.ebuild)/ }
-
+my %vcs = (
+ cvs => {
+ diff => "cvs -f diff -U0",
+ status => "cvs -fn up",
+ add => "cvs -f add",
+ skip => 6,
+ regex => qr/^Index: (([^\/]*?)\.ebuild)\s*$/
+ },
+ svn => {
+ diff => "svn diff -N",
+ status => "svn status",
+ add => "svn add",
+ skip => 4,
+ regex => qr/^Index: (([^\/]*?)\.ebuild)\s*$/
+ },
+ git => {
+ diff => "git diff",
+ status => "git diff-index HEAD --name-status",
+ add => "git add",
+ # This value should usually be 3 but on new file mode we need skip+1.
+ # So 4 should be fine anyway.
+ skip => 4,
+ regex => qr/^diff \-\-git \S*\/((\S*)\.ebuild)/
+ },
);
sub usage {
@@ -144,7 +152,7 @@ while (<C>) {
my $prefix = <P>;
$prefix = substr($prefix, 0, -1);
close P;
-
+
if ($filename =~ /$prefix(\S*)/) {
$filename = $1 ;
}
@@ -296,6 +304,15 @@ sub sortfunc($$) {
}
@files = sort sortfunc @files;
+# Just to ensure we don't get duplicate entries.
+sub mypush(\@@) {
+ my $aref = shift;
+
+ foreach my $value (@_) {
+ push(@{$aref}, $value) if !grep(/^$value$/, @{$aref});
+ }
+}
+
# Forget ebuilds that only have changed copyrights, unless that's all
# the changed files we have
@@ -304,53 +321,60 @@ sub sortfunc($$) {
if (@ebuilds) {
if ($vcs eq "git") {
- open C, $vcs{$vcs}{diff}." HEAD -- @ebuilds 2>&1 |" or die "Can't run: ".$vcs{$vcs}{diff}."$!\n";
+ open C, $vcs{$vcs}{diff}." HEAD -- @ebuilds 2>&1 |" or die "Can't run: ".$vcs{$vcs}{diff}."$!\n";
} else {
open C, $vcs{$vcs}{diff}." @ebuilds 2>&1 |" or die "Can't run: ".$vcs{$vcs}{diff}."$!\n";
}
+
$_ = <C>;
+
while (defined $_) {
- # only possible with cvs
- if (/^$vcs diff: (([^\/]*?)\.ebuild) was removed/) {
- push @files, $1;
- }
+ # only possible with cvs
+ if (/^$vcs diff: (([^\/]*?)\.ebuild) was removed/) {
+ mypush(@files, $1);
+ }
- # We assume GNU diff output format here.
- # git format: diff --git a/app-doc/repodoc/metadata.xml b/app-doc/repodoc/metadata.xml
- elsif (/$vcs{$vcs}{regex}/) {
- my $f;
- ($f) = ($1);
- if ($vcs eq "git") {
- my $version = ($2);
- while (<C>) {
- last if /^deleted file mode|^index/;
- if (/^new file mode/) {
- push @new_versions, $version; # new ebuild, will create a new entry
- last;
- }
- }
- }
+ # We assume GNU diff output format here.
+ # git format: diff --git a/app-doc/repodoc/metadata.xml b/app-doc/repodoc/metadata.xml
+ elsif (/$vcs{$vcs}{regex}/) {
+ my $f = $1;
+
+ if ($vcs eq "git") {
+ my $version = $2;
+
+ while (<C>) {
+ last if /^deleted file mode|^index/;
+ if (/^new file mode/) {
+ mypush(@files, $f);
+ mypush(@new_versions, $version);
+ last;
+ }
+ }
+ }
# check if more than just copyright date changed.
# skip some lines (vcs dependent)
- foreach(1..$vcs{$vcs}{skip}){
- $_ = <C>;
- }
- while (<C>) {
+ foreach(1..$vcs{$vcs}{skip}) {
+ $_ = <C>;
+ }
+
+ while (<C>) {
last if /^[A-Za-z]/;
if (/^[-+](?!# Copyright)/) {
- push @files, $f;
+ mypush(@files, $f);
last;
}
}
+
# at this point we've either added $f to @files or not,
# and we have the next line in $_ for processing
next;
}
- elsif (/^$vcs.*?: (([^\/]*?)\.ebuild) is a new entry/) {
- push @files, $1;
- push @new_versions, $2; # new ebuild, will create a new entry
+ elsif (/^$vcs.*?: (([^\/]*?)\.ebuild) is a new entry/) {
+ mypush(@files, $1);
+ mypush(@new_versions, $2);
}
+
# other cvs output is ignored
$_ = <C>;
}
@@ -359,14 +383,16 @@ close C;
# Subversion diff doesn't identify new versions. So use the status command
if (($vcs eq "svn") and (@ebuilds)) {
- open C, $vcs{$vcs}{status}." @ebuilds 2>&1 |" or die "Can't run: ".$vcs{$vcs}{status}."$!\n";
- $_ = <C>;
- while (defined $_) {
- if (/^A\s*(\s{1}[^\s]*)\.ebuild/) {
- push @new_versions, $1;
- }
- $_ = <C>;
- }
+ open C, $vcs{$vcs}{status}." @ebuilds 2>&1 |" or die "Can't run: ".$vcs{$vcs}{status}."$!\n";
+ $_ = <C>;
+
+ while (defined $_) {
+ if (/^A\s*(([^\s]*)\.ebuild)/) {
+ mypush(@files, $1);
+ mypush(@new_versions, $2);
+ }
+ $_ = <C>;
+ }
}
# When a package move occurs, the versions appear to be new even though they are
@@ -392,6 +418,10 @@ unless (@files) {
@files = qw/ChangeLog/ unless @files; # last resort to put something in the list
}
+# sort
+@files = sort sortfunc @files;
+@new_versions = sort sortfunc @new_versions;
+
# Get the input from the cmdline, editor or stdin
if ($ARGV[0]) {
$input = "@ARGV";
@@ -547,4 +577,4 @@ if ($vcs eq "cvs") {
system("$vcs{$vcs}{add} ChangeLog 2>&1 >> /dev/null");
}
-# vim:sw=4 ts=8 expandtab
+# vim:sw=4 ts=4 expandtab
diff --git a/trunk/src/echangelog/echangelog.1 b/trunk/src/echangelog/echangelog.1
index e1b795a..1575644 100644
--- a/trunk/src/echangelog/echangelog.1
+++ b/trunk/src/echangelog/echangelog.1
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.13
+.\" Automatically generated by Pod::Man 2.16 (Pod::Simple 3.07)
.\"
.\" Standard preamble:
.\" ========================================================================
@@ -25,11 +25,11 @@
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
@@ -48,22 +48,25 @@
. ds R" ''
'br\}
.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
-.if \nF \{\
+.ie \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. nr % 0
. rr F
.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
+.el \{\
+. de IX
+..
+.\}
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
@@ -128,8 +131,12 @@
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
-.IX Title "ECHANGELOG 1"
-.TH ECHANGELOG 1 "2004-04-02" "perl v5.8.2" "User Contributed Perl Documentation"
+.IX Title "echangelog 1"
+.TH echangelog 1 "2009-04-28" "perl v5.10.0" "Gentoolkit"
+.\" For nroff, turn off justification. Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
.SH "NAME"
echangelog \- Gentoo: update portage ChangeLogs
.SH "SYNOPSIS"
@@ -141,7 +148,7 @@ This tool provides an easy way to create or update portage ChangeLogs
in Gentoo. The tool scans the current directory, which is assumed to
be a package directory such as /usr/portage/app\-editors/vim, finds
what files have been changed or added, and inserts the appropriate
-entry to ChangeLog. If \fItext\fR is not provided on the command\-line,
+entry to ChangeLog. If \fItext\fR is not provided on the command-line,
echangelog prompts for it.
.PP
All modifications should occur before running echangelog so that it
@@ -152,7 +159,7 @@ echangelog won't know those files are part of the update.
If your text would cause the ChangeLog entry to exceed 80 columns, it
will be rewrapped to keep the ChangeLog neat. If you need special
formatting in the ChangeLog, then you can either (1) run echangelog
-with no text on the command\-line, and make sure that your text won't
+with no text on the command-line, and make sure that your text won't
be too wide, (2) edit the ChangeLog manually. If you prefer (2), I'd
recommend something like \*(L"echangelog blah\*(R" so that the header lines
are computed correctly, then edit and change \*(L"blah\*(R" to your preferred
@@ -164,37 +171,29 @@ ChangeLog itself. These updates are included in the diff displayed by
echangelog when it finishes its work.
.SH "OPTIONS"
.IX Header "OPTIONS"
-.TP
-.BR --help
-Display help output (just like this section ...).
-.TP
-.BR --strict
-Abort execution if only simple changes (like date changes) are found.
-.TP
-.BR --version
-Display version information.
+Presently echangelog is simple enough that it supplies no options.
+Probably I'll add \fB\-\-help\fR and \fB\-\-version\fR in the future, but for
+now it's enough to track the gentoolkit version.
.SH "EXAMPLES"
.IX Header "EXAMPLES"
To create a ChangeLog for a completely new package. The header is
parsed from skel.ebuild.
.PP
.Vb 2
-\& $ cvs add metalog-0.1.ebuild
-\& cvs server: use 'cvs commit' to add this file permanently
-.Ve
-.PP
-.Vb 13
-\& $ echangelog 'New ebuild, thanks to Harvey McGillicuddy'
-\& --- ChangeLog 1969-12-31 19:00:00.000000000 -0500
-\& +++ ChangeLog.new 2003-02-23 14:04:06.000000000 -0500
-\& @@ -0,0 +1,9 @@
-\& +# ChangeLog for app-admin/metalog
-\& +# Copyright 2000-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2
+\& $ cvs add metalog\-0.1.ebuild
+\& cvs server: use \*(Aqcvs commit\*(Aq to add this file permanently
+\&
+\& $ echangelog \*(AqNew ebuild, thanks to Harvey McGillicuddy\*(Aq
+\& \-\-\- ChangeLog 1969\-12\-31 19:00:00.000000000 \-0500
+\& +++ ChangeLog.new 2003\-02\-23 14:04:06.000000000 \-0500
+\& @@ \-0,0 +1,9 @@
+\& +# ChangeLog for app\-admin/metalog
+\& +# Copyright 2000\-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2
\& +# $Header$
\& +
-\& +*metalog-0.1 (23 Feb 2003)
+\& +*metalog\-0.1 (23 Feb 2003)
\& +
-\& + 23 Feb 2003; Aron Griffis <agriffis@gentoo.org> metalog-0.1.ebuild :
+\& + 23 Feb 2003; Aron Griffis <agriffis@gentoo.org> metalog\-0.1.ebuild :
\& + New ebuild, thanks to Harvey McGillicuddy
\& +
.Ve
@@ -203,60 +202,50 @@ To bump a revision. Note you need to \*(L"cvs add\*(R" so that echangelog
will notice the new file.
.PP
.Vb 2
-\& $ cvs add metalog-0.1-r1.ebuild
-\& cvs server: use 'cvs commit' to add this file permanently
-.Ve
-.PP
-.Vb 6
-\& $ echangelog 'Bump revision to fix bug #999'
-\& --- ChangeLog 2003-02-23 14:04:06.000000000 -0500
-\& +++ ChangeLog.new 2003-02-23 14:07:48.000000000 -0500
-\& @@ -2,6 +2,11 @@
-\& # Copyright 2000-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2
+\& $ cvs add metalog\-0.1\-r1.ebuild
+\& cvs server: use \*(Aqcvs commit\*(Aq to add this file permanently
+\&
+\& $ echangelog \*(AqBump revision to fix bug #999\*(Aq
+\& \-\-\- ChangeLog 2003\-02\-23 14:04:06.000000000 \-0500
+\& +++ ChangeLog.new 2003\-02\-23 14:07:48.000000000 \-0500
+\& @@ \-2,6 +2,11 @@
+\& # Copyright 2000\-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2
\& # $Header$
-.Ve
-.PP
-.Vb 6
-\& +*metalog-0.1-r1 (23 Feb 2003)
+\&
+\& +*metalog\-0.1\-r1 (23 Feb 2003)
\& +
-\& + 23 Feb 2003; Aron Griffis <agriffis@gentoo.org> metalog-0.1-r1.ebuild :
+\& + 23 Feb 2003; Aron Griffis <agriffis@gentoo.org> metalog\-0.1\-r1.ebuild :
\& + Bump revision to fix bug #999
\& +
-\& *metalog-0.1 (23 Feb 2003)
-.Ve
-.PP
-.Vb 1
-\& 23 Feb 2003; Aron Griffis <agriffis@gentoo.org> metalog-0.1.ebuild :
+\& *metalog\-0.1 (23 Feb 2003)
+\&
+\& 23 Feb 2003; Aron Griffis <agriffis@gentoo.org> metalog\-0.1.ebuild :
.Ve
.PP
For a multi-line entry, omit the command-line arg.
.PP
.Vb 10
\& $ echangelog
-\& Please type the log entry, finish with ctrl-d
+\& Please type the log entry, finish with ctrl\-d
\& Bump revision to fix bug #999. Necessary to bump the revision because
-\& the problem appears at run-time, not compile-time. This should also
+\& the problem appears at run\-time, not compile\-time. This should also
\& give users the updated default configuration file.
-\& --- ChangeLog 2003-02-23 14:09:12.000000000 -0500
-\& +++ ChangeLog.new 2003-02-23 14:12:43.000000000 -0500
-\& @@ -2,6 +2,13 @@
-\& # Copyright 2000-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2
+\& \-\-\- ChangeLog 2003\-02\-23 14:09:12.000000000 \-0500
+\& +++ ChangeLog.new 2003\-02\-23 14:12:43.000000000 \-0500
+\& @@ \-2,6 +2,13 @@
+\& # Copyright 2000\-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2
\& # $Header$
-.Ve
-.PP
-.Vb 8
-\& +*metalog-0.1-r1 (23 Feb 2003)
+\&
+\& +*metalog\-0.1\-r1 (23 Feb 2003)
\& +
-\& + 23 Feb 2003; Aron Griffis <agriffis@gentoo.org> metalog-0.1-r1.ebuild :
+\& + 23 Feb 2003; Aron Griffis <agriffis@gentoo.org> metalog\-0.1\-r1.ebuild :
\& + Bump revision to fix bug #999. Necessary to bump the revision because
-\& + the problem appears at run-time, not compile-time. This should also
+\& + the problem appears at run\-time, not compile\-time. This should also
\& + give users the updated default configuration file.
\& +
-\& *metalog-0.1 (23 Feb 2003)
-.Ve
-.PP
-.Vb 1
-\& 23 Feb 2003; Aron Griffis <agriffis@gentoo.org> metalog-0.1.ebuild :
+\& *metalog\-0.1 (23 Feb 2003)
+\&
+\& 23 Feb 2003; Aron Griffis <agriffis@gentoo.org> metalog\-0.1.ebuild :
.Ve
.SH "ENVIRONMENT VARIABLES"
.IX Header "ENVIRONMENT VARIABLES"