summaryrefslogtreecommitdiff
path: root/trunk/src
diff options
context:
space:
mode:
authoragriffis <agriffis@gentoo.org>2004-03-17 04:37:52 +0000
committeragriffis <agriffis@gentoo.org>2004-03-17 04:37:52 +0000
commit97d0ca56c28b81fc8534dc09a4d6b25775218ec0 (patch)
treeca23ba1e3f665bec2ca303e712226e2d361b21c5 /trunk/src
parent82078b0ed488751bc7e5295a8cca9cb9b0bb2275 (diff)
downloadgentoolkit-97d0ca56c28b81fc8534dc09a4d6b25775218ec0.tar.gz
make ebuild copyright dates work
svn path=/; revision=91
Diffstat (limited to 'trunk/src')
-rw-r--r--trunk/src/echangelog/ChangeLog4
-rw-r--r--trunk/src/echangelog/README2
-rw-r--r--trunk/src/echangelog/echangelog89
-rw-r--r--trunk/src/echangelog/echangelog.pod2
4 files changed, 65 insertions, 32 deletions
diff --git a/trunk/src/echangelog/ChangeLog b/trunk/src/echangelog/ChangeLog
index 72f706d..5065bd8 100644
--- a/trunk/src/echangelog/ChangeLog
+++ b/trunk/src/echangelog/ChangeLog
@@ -1,3 +1,7 @@
+16 Mar 2004 Aron Griffis <agriffis@gentoo.org>
+ * Make Feb 17 behavior work without Feb 20 bug :-)
+ * Release as version 0.2.0
+
20 Feb 2004 Aron Griffis <agriffis@gentoo.org>
* Only update copyrights on modified ebuilds, otherwise if you run
echangelog again, it reports that all the ebuilds have been updated!
diff --git a/trunk/src/echangelog/README b/trunk/src/echangelog/README
index 5bb0444..7db8869 100644
--- a/trunk/src/echangelog/README
+++ b/trunk/src/echangelog/README
@@ -1,5 +1,5 @@
Package : echangelog
-Version : 0.1.0
+Version : 0.2.0
Author : See AUTHORS
MOTIVATION
diff --git a/trunk/src/echangelog/echangelog b/trunk/src/echangelog/echangelog
index b8afe63..e2d6c73 100644
--- a/trunk/src/echangelog/echangelog
+++ b/trunk/src/echangelog/echangelog
@@ -19,9 +19,10 @@ $Text::Wrap::columns = 79;
$Text::Wrap::unexpand = 0;
# Global variables
-my @files = ();
+my (@files) = ();
+my (@ebuilds) = ();
my ($input, $entry, $user, $date, $text, $version, $year);
-my %versions = ();
+my (%versions) = ();
# Read the current ChangeLog
if (-f 'ChangeLog') {
@@ -50,37 +51,62 @@ if (-f 'ChangeLog') {
}
# Figure out what has changed around here
-open C, 'cvs diff --brief 2>&1 |' or die "Can't run cvs diff: $!\n";
+open C, 'cvs -n up 2>&1 |' or die "Can't run cvs -n up: $!\n";
while (<C>) {
- /ChangeLog/ and next;
- if (/^cvs.*?: (([^\/]*?)\.ebuild) was removed/) {
- push @files, $1;
- $versions{$2} = 0; # existing ebuild that was removed
- }
- elsif (/^cvs.*?: (\S+) was removed/) {
- push @files, $1;
- # existing file that has been removed
- }
- elsif (/^Index: (([^\/]*?)\.ebuild)\s*$/) {
- push @files, $1;
- $versions{$2} = 0; # existing ebuild that has changed
- }
- elsif (/^Index: (\S+)/) {
- push @files, $1;
- # existing file, but not an ebuild, so no %version entry
- }
- elsif (/^cvs.*?: (([^\/]*?)\.ebuild) is a new entry/) {
- push @files, $1;
- $versions{$2} = -1; # new ebuild, will create a new entry
- }
- elsif (/^cvs.*?: (\S+) is a new entry/) {
- push @files, $1;
- # new file, but not an ebuild, so no %version entry
+ /ChangeLog/ and next;
+ /^[MCAR] (\S+)/ and push @files, $1;
+}
+
+# Forget ebuilds that only have changed copyrights, unless that's all
+# the changed files we have
+@ebuilds = grep /\.ebuild$/, @files;
+@files = grep !/\.ebuild$/, @files;
+print "files = @files\n";
+print "ebuilds = @ebuilds\n";
+if (@ebuilds) {
+ open C, "cvs diff -U 0 @ebuilds 2>&1 |" or die "Can't run cvs diff: $!\n";
+ $_ = <C>;
+ while (defined $_) {
+ if (/^cvs diff: (([^\/]*?)\.ebuild) was removed/) {
+ push @files, $1;
+ $versions{$2} = 0; # existing ebuild that was removed
+ }
+ elsif (/^Index: (([^\/]*?)\.ebuild)\s*$/) {
+ my ($f, $v) = ($1, $2);
+ # check if more than just copyright date changed.
+ # skip some lines
+ $_ = <C>; # ====================================
+ $_ = <C>; # RCS file: ...
+ $_ = <C>; # retrieving revision
+ $_ = <C>; # diff -u ...
+ $_ = <C>; # --- vim-6.2-r6.ebuild
+ $_ = <C>; # +++ vim-6.2-r6.ebuild
+ while (<C>) {
+ last if /^[A-Za-z]/;
+ if (/^[-+](?!# Copyright)/) {
+ push @files, $f;
+ $versions{$2} = $v; # existing ebuild that has changed
+ last;
+ }
+ }
+ # at this point we've either added $f to @files or not,
+ # and we have the next line in $_ for processing
+ next;
+ }
+ elsif (/^cvs.*?: (([^\/]*?)\.ebuild) is a new entry/) {
+ push @files, $1;
+ $versions{$2} = -1; # new ebuild, will create a new entry
+ }
+ # other cvs output is ignored
+ $_ = <C>;
}
- # other cvs output is ignored
}
close C;
+# Check if we have any files left, otherwise re-insert ebuild list
+# (of course, both might be empty anyway)
+@files = @ebuilds unless (@files);
+
# Allow ChangeLog entries with no changed files, but give a fat warning
unless (@files) {
print "**\n\n";
@@ -184,10 +210,12 @@ print O $text or die "Can't write ChangeLog.new: $!\n";
close O or die "Can't close ChangeLog.new: $!\n";
# Update affected ebuild copyright dates
-for my $e (grep /\.ebuild$/, @files) {
+#for my $e (grep /\.ebuild$/, @files) {
# Update all ebuild copyright dates -- according to Mr_Bones_ this is
# the right thing to do
-#for my $e (<*.ebuild>) {
+opendir D, '.' or die "Can't opendir .: $!\n";
+for my $e (grep /\.ebuild$/, readdir D) {
+ print "updating $e\n";
my ($etext, $netext);
open E, "<$e" or warn("Can't read $e to update copyright year\n"), next;
{ local $/ = undef; $etext = <E>; }
@@ -206,6 +234,7 @@ for my $e (grep /\.ebuild$/, @files) {
system "diff -U 0 $e $e.new";
rename "$e.new", $e or warn("Can't rename $e.new: $!\n");
}
+close D;
# Move things around and show the ChangeLog diff
system 'diff -Nu ChangeLog ChangeLog.new';
diff --git a/trunk/src/echangelog/echangelog.pod b/trunk/src/echangelog/echangelog.pod
index 45c9148..192af8d 100644
--- a/trunk/src/echangelog/echangelog.pod
+++ b/trunk/src/echangelog/echangelog.pod
@@ -30,7 +30,7 @@ are computed correctly, then edit and change "blah" to your preferred
text.
In addition to updating the ChangeLog, echangelog will automatically
-update the copyright year of any affected ebuilds, as well as the
+update the copyright year of all out-of-date ebuilds, as well as the
ChangeLog itself. These updates are included in the diff displayed by
echangelog when it finishes its work.