public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/gentoolkit:gentoolkit-dev commit in: src/echangelog/
@ 2011-02-25 20:51 Christian Ruppert
  0 siblings, 0 replies; 17+ messages in thread
From: Christian Ruppert @ 2011-02-25 20:51 UTC (permalink / raw
  To: gentoo-commits

commit:     b9cf4f5e2c9a41208ea5157debaf3263c90988aa
Author:     Christian Ruppert <idl0r <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 25 20:04:47 2011 +0000
Commit:     Christian Ruppert <idl0r <AT> gentoo <DOT> org>
CommitDate: Fri Feb 25 20:04:47 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=b9cf4f5e

Use the @ebuilds array instead of @files for ebuild related changes

---
 src/echangelog/echangelog |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/echangelog/echangelog b/src/echangelog/echangelog
index 6eaccb8..06fc33e 100755
--- a/src/echangelog/echangelog
+++ b/src/echangelog/echangelog
@@ -525,7 +525,7 @@ if (@ebuilds) {
 	while (defined $_) {
 		# only possible with cvs
 		if (/^$vcs diff: (([^\/]*?)\.ebuild) was removed/) {
-			mypush(@files, $1);
+			mypush(@ebuilds, $1);
 		}
 		# We assume GNU diff output format here.
 		# git format: diff --git a/app-doc/repodoc/metadata.xml b/app-doc/repodoc/metadata.xml
@@ -536,7 +536,7 @@ if (@ebuilds) {
 				while (<C>) {
 					last if /^deleted file mode|^index/;
 					if (/^new file mode/) {
-						mypush(@files, $file);
+						mypush(@ebuilds, $file);
 						mypush(@new_versions, $version);
 						last;
 					}
@@ -545,12 +545,12 @@ if (@ebuilds) {
 
 			if ($vcs eq "bzr") {
 				if (/^=== added file/) {
-					mypush(@files, $file);
+					mypush(@ebuilds, $file);
 					mypush(@new_versions, $version);
 					last;
 				}
 				elsif(/^=== renamed file '.+\/([^\/]+\.ebuild)' => '.+\/(([^\/]+)\.ebuild)'/) {
-					mypush(@files, $1, $2);
+					mypush(@ebuilds, $1, $2);
 					mypush(@new_versions, $3);
 					last;
 				}
@@ -565,17 +565,17 @@ if (@ebuilds) {
 			while (<C>) {
 				last if /^[A-Za-z]/;
 				if (/^[-+](?!# Copyright)/) {
-					mypush(@files, $file);
+					mypush(@ebuilds, $file);
 					last;
 				}
 			}
 
-			# at this point we've either added $f to @files or not,
+			# at this point we've either added $f to @ebuilds or not,
 			# and we have the next line in $_ for processing
 			next;
 		}
 		elsif (/^$vcs.*?: (([^\/]*?)\.ebuild) is a new entry/) {
-			mypush(@files, $1);
+			mypush(@ebuilds, $1);
 			mypush(@new_versions, $2);
 		}
 
@@ -592,7 +592,7 @@ if (($vcs eq "svn" or $vcs eq "hg") and (@ebuilds)) {
 
 	while (defined $_) {
 		if (/^A\s+\+?\s*(([^\s]*)\.ebuild)/) {
-			mypush(@files, $1);
+			mypush(@ebuilds, $1);
 			mypush(@new_versions, $2);
 		}
 



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/gentoolkit:gentoolkit-dev commit in: src/echangelog/
@ 2011-02-25 20:51 Christian Ruppert
  0 siblings, 0 replies; 17+ messages in thread
From: Christian Ruppert @ 2011-02-25 20:51 UTC (permalink / raw
  To: gentoo-commits

commit:     86d80c0b388edd5ee952babfb1f2b28e0b08ba30
Author:     Christian Ruppert <idl0r <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 25 20:04:11 2011 +0000
Commit:     Christian Ruppert <idl0r <AT> gentoo <DOT> org>
CommitDate: Fri Feb 25 20:04:11 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=86d80c0b

Some cleanup

---
 src/echangelog/echangelog |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/echangelog/echangelog b/src/echangelog/echangelog
index 8462421..6eaccb8 100755
--- a/src/echangelog/echangelog
+++ b/src/echangelog/echangelog
@@ -23,13 +23,15 @@ $Text::Wrap::unexpand = 0;
 # Global variables
 my (@files, @ebuilds, @conflicts, @trivial, @unknown, @new_versions, %actions);
 my ($input, $editor, $entry, $user, $date, $text, $vcs);
-my ($opt_help, $opt_nostrict, $opt_force_vcs, $opt_version);
+my ($opt_help, $opt_nostrict, $opt_force_vcs, $opt_version, $opt_strict);
+
+$date = strftime("%d %b %Y", gmtime);
 
 $opt_help = 0;
 $opt_nostrict = 0;
 $opt_version = 0;
 # DEPRECATED
-my $opt_strict = 0;
+$opt_strict = 0;
 
 my %vcs = (
 	bzr => {
@@ -86,7 +88,7 @@ sub usage {
 	Options:
 	    --help      err, this screen ...
 	    --no-strict do not abort on trivial/no changes
-	    --vcs <vcs> skip vcs autodetection and use the specified vcs instead      
+	    --vcs <vcs> skip vcs autodetection and use the specified vcs instead
 	                for a list of supported version control systems see below
 	    --version   show version info
 
@@ -379,7 +381,7 @@ sub git_unknown_objects {
 
 		# IMHO we can skip those files, even if they're untracked
 		#next if $line =~ m/^\.gitignore$/;
-		
+
 		push(@unknown, $line);
 	}
 	close(GIT);
@@ -508,8 +510,8 @@ sub sortfunc($$) {
 
 # Forget ebuilds that only have changed copyrights, unless that's all
 # the changed files we have
-@ebuilds = grep /\.ebuild$/, @files;
-@files = grep !/\.ebuild$/, @files;
+@ebuilds = grep(/\.ebuild$/, @files);
+@files = grep(!/\.ebuild$/, @files);
 
 if (@ebuilds) {
 	if ($vcs eq "git") {
@@ -609,7 +611,7 @@ if (($vcs eq "svn" or $vcs eq "hg") and (@ebuilds)) {
 # Allow ChangeLog entries with no changed files, but give a fat warning
 unless (@files) {
 	print STDERR "**\n";
-	print STDERR "** NOTE: No non-trivial changed files found.  Normally echangelog\n";
+	print STDERR "** NOTE: No non-trivial changed files found. Normally echangelog\n";
 	print STDERR "** should be run after all affected files have been added and/or\n";
 	print STDERR "** modified.  Did you forget to $vcs add?\n";
 	print STDERR "**\n";
@@ -620,7 +622,7 @@ unless (@files) {
 		exit(1);
 	}
 
-	@files = sort sortfunc @trivial;
+	@files = @trivial;
 
 	# last resort to put something in the list
 	unless (@files) {
@@ -707,7 +709,6 @@ else {
 # Make sure that we didn't get "root"
 die "Please set ECHANGELOG_USER or run as non-root\n" if $user =~ /<root@/;
 
-$date = strftime("%d %b %Y", gmtime);
 $entry = "$date; $user ";
 $entry .= join ', ', sort sortfunc map("$actions{$_}$_", @files);
 $entry .= ':';
@@ -776,8 +777,7 @@ for my $e (grep(!/\.(patch|diff)$/, @files)) {
 		rename "$e.new", $e or warn("Can't rename $e.new: $!\n");
 
 		# git requires to re-add this file else it wouln't be included in the commit.
-		if ($vcs eq "git")
-		{
+		if ($vcs eq "git") {
 			system("$vcs{$vcs}{add} ${e}");
 		}
 	}



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/gentoolkit:gentoolkit-dev commit in: src/echangelog/
@ 2011-02-25 20:51 Christian Ruppert
  0 siblings, 0 replies; 17+ messages in thread
From: Christian Ruppert @ 2011-02-25 20:51 UTC (permalink / raw
  To: gentoo-commits

commit:     611d2be4c6d9483a0ce91a71904b9729f507e57b
Author:     Christian Ruppert <idl0r <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 25 20:13:51 2011 +0000
Commit:     Christian Ruppert <idl0r <AT> gentoo <DOT> org>
CommitDate: Fri Feb 25 20:17:33 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=611d2be4

Fix a bug where writing the new ChangeLog faild if *only* the ChangeLog itself has been modified

---
 src/echangelog/echangelog |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/echangelog/echangelog b/src/echangelog/echangelog
index fe21729..94f045e 100755
--- a/src/echangelog/echangelog
+++ b/src/echangelog/echangelog
@@ -745,11 +745,6 @@ if (@new_versions) {
 			or die "Failed to insert new entry (3)\n";
 }
 
-# Write the new ChangeLog
-open O, '>ChangeLog.new' or die "Can't open ChangeLog.new for output: $!\n";
-print O $text            or die "Can't write ChangeLog.new: $!\n";
-close O                  or die "Can't close ChangeLog.new: $!\n";
-
 # Update affected ebuilds and some other files copyright dates.  There is no reason to update the
 # copyright lines on ebuilds that haven't changed. I verified this with an IP
 # lawyer. (patches/diffs and binary files are excluded)
@@ -781,6 +776,11 @@ for my $e (grep(!/\.(patch|diff)$/, @files)) {
 	}
 }
 
+# Write the new ChangeLog
+open O, '>ChangeLog.new' or die "Can't open ChangeLog.new for output: $!\n";
+print O $text            or die "Can't write ChangeLog.new: $!\n";
+close O                  or die "Can't close ChangeLog.new: $!\n";
+
 # Move things around and show the ChangeLog diff
 system 'diff -Nu ChangeLog ChangeLog.new';
 rename 'ChangeLog.new', 'ChangeLog' or die "Can't rename ChangeLog.new: $!\n";



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/gentoolkit:gentoolkit-dev commit in: src/echangelog/
@ 2011-02-25 20:51 Christian Ruppert
  0 siblings, 0 replies; 17+ messages in thread
From: Christian Ruppert @ 2011-02-25 20:51 UTC (permalink / raw
  To: gentoo-commits

commit:     e34afa6e3da2ed329104a14eb957fb05326c437f
Author:     Christian Ruppert <idl0r <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 25 20:39:55 2011 +0000
Commit:     Christian Ruppert <idl0r <AT> gentoo <DOT> org>
CommitDate: Fri Feb 25 20:39:55 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=e34afa6e

Fix sorting again, bug 336390

---
 src/echangelog/echangelog |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/echangelog/echangelog b/src/echangelog/echangelog
index 94f045e..273c5db 100755
--- a/src/echangelog/echangelog
+++ b/src/echangelog/echangelog
@@ -612,12 +612,8 @@ if (($vcs eq "svn" or $vcs eq "hg") and (@ebuilds)) {
 # not.  Trim them from @new_versions in that case.
 @new_versions = grep { $text !~ /^\*\Q$_\E\s/m } @new_versions;
 
-# 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) {
+if (!@files && !@ebuilds) {
 	print STDERR "**\n";
 	print STDERR "** NOTE: No non-trivial changed files found. Normally echangelog\n";
 	print STDERR "** should be run after all affected files have been added and/or\n";
@@ -718,7 +714,13 @@ else {
 die "Please set ECHANGELOG_USER or run as non-root\n" if $user =~ /<root@/;
 
 $entry = "$date; $user ";
-$entry .= join ', ', sort sortfunc map("$actions{$_}$_", @files);
+if(@ebuilds) {
+	$entry .= join(', ', sort sortfunc map("$actions{$_}$_", @ebuilds));
+	$entry .= ", ".join(', ', sort sortfunc map("$actions{$_}$_", @files)) if @files;
+}
+else {
+	$entry .= join ', ', sort sortfunc map("$actions{$_}$_", @files);
+}
 $entry .= ':';
 $entry = Text::Wrap::fill('  ', '  ', $entry); # does not append a \n
 $entry .= "\n$input";                          # append user input



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/gentoolkit:gentoolkit-dev commit in: src/echangelog/
@ 2011-02-25 20:51 Christian Ruppert
  0 siblings, 0 replies; 17+ messages in thread
From: Christian Ruppert @ 2011-02-25 20:51 UTC (permalink / raw
  To: gentoo-commits

commit:     2f5229064ec75704c257053510df376689dd10b0
Author:     Christian Ruppert <idl0r <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 25 20:10:44 2011 +0000
Commit:     Christian Ruppert <idl0r <AT> gentoo <DOT> org>
CommitDate: Fri Feb 25 20:10:44 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=2f522906

Use update_cat_pn() and update_copyright() only once for the ChangeLog, right after loading it

---
 src/echangelog/echangelog |   22 ++++++++++------------
 1 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/src/echangelog/echangelog b/src/echangelog/echangelog
index 06fc33e..fe21729 100755
--- a/src/echangelog/echangelog
+++ b/src/echangelog/echangelog
@@ -282,13 +282,21 @@ if (-f 'ChangeLog') {
 		close(I);
 
 		$text =~ s/^\*.*//ms; # don't need the fake entry
-
-		$text = update_cat_pn($text);
 	} else {
 		die "This should be run in a directory with ebuilds...\n";
 	}
 }
 
+# Update the copyright year in the ChangeLog
+$text = update_copyright($text);
+
+# New packages and/or ones that have moved around often have stale data here.
+# But only do that in places where ebuilds are around (as echangelog can be
+# used in profiles/ and such places).
+if (<*.ebuild>) {
+	$text = update_cat_pn($text);
+}
+
 # Figure out what has changed around here
 open C, $vcs{$vcs}{status}.' 2>&1 |' or die "Can't run ".$vcs{$vcs}{status}.": $!\n";
 while (<C>) {
@@ -737,16 +745,6 @@ if (@new_versions) {
 			or die "Failed to insert new entry (3)\n";
 }
 
-# New packages and/or ones that have moved around often have stale data here.
-# But only do that in places where ebuilds are around (as echangelog can be
-# used in profiles/ and such places).
-if (grep(/\.ebuild$/, @files)) {
-	$text = update_cat_pn($text);
-}
-
-# Update the copyright year in the ChangeLog
-$text = update_copyright($text);
-
 # Write the new ChangeLog
 open O, '>ChangeLog.new' or die "Can't open ChangeLog.new for output: $!\n";
 print O $text            or die "Can't write ChangeLog.new: $!\n";



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/gentoolkit:gentoolkit-dev commit in: src/echangelog/
@ 2012-04-09 14:13 Christian Ruppert
  0 siblings, 0 replies; 17+ messages in thread
From: Christian Ruppert @ 2012-04-09 14:13 UTC (permalink / raw
  To: gentoo-commits

commit:     ec19885bb3fcc51fc5361cc59e5f832fda418f27
Author:     Christian Ruppert <idl0r <AT> gentoo <DOT> org>
AuthorDate: Mon Apr  9 14:13:43 2012 +0000
Commit:     Christian Ruppert <idl0r <AT> gentoo <DOT> org>
CommitDate: Mon Apr  9 14:13:43 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=ec19885b

Minor cleanup

---
 src/echangelog/echangelog |   39 +++++++++++++++++++--------------------
 1 files changed, 19 insertions(+), 20 deletions(-)

diff --git a/src/echangelog/echangelog b/src/echangelog/echangelog
index 62bff9b..a6a9533 100755
--- a/src/echangelog/echangelog
+++ b/src/echangelog/echangelog
@@ -106,7 +106,7 @@ sub version {
 	exit 0;
 }
 
-sub getenv($) {
+sub getenv {
     my $key = shift;
 
     # Ensure our variable exist
@@ -116,7 +116,7 @@ sub getenv($) {
             return $ENV{$key};
         }
     }
-    return undef;
+    return;
 }
 
 # Bug 264146.
@@ -135,9 +135,8 @@ sub getenv($) {
 sub text_fill {
 	my ($ip, $xp, @raw) = @_;
 	my @para;
-	my $pp;
 
-	for $pp ( split(/\n\s+/, join("\n", @raw)) ) {
+	for my $pp ( split(/\n\s+/, join("\n", @raw)) ) {
 		$pp =~ s/[\x09\x0B\x0C\x20]+/ /g;
 		my $x = Text::Wrap::wrap($ip, $xp, $pp);
 		push(@para, $x);
@@ -149,29 +148,29 @@ sub text_fill {
 	return join ($ps, @para);
 }
 
-sub changelog_info(%) {
+sub changelog_info {
 	my %changed = @_;
 
-	open(INFO, '>', 'ChangeLog.new');
+	open(my $fh, '>', 'ChangeLog.new');
 
-	print(INFO "\n");
-	print(INFO "# Please enter the ChangeLog message for your changes. Lines starting\n");
-	print(INFO "# with '#' will be ignored, and an empty message aborts the ChangeLog.\n");
-	print(INFO "#\n# Changes:\n");
+	print($fh "\n");
+	print($fh "# Please enter the ChangeLog message for your changes. Lines starting\n");
+	print($fh "# with '#' will be ignored, and an empty message aborts the ChangeLog.\n");
+	print($fh "#\n# Changes:\n");
 
 	foreach my $key (keys(%changed)) {
 		if ($changed{$key} eq "+") {
-			printf(INFO "# new file:\t%s\n", $key);
+			printf($fh "# new file:\t%s\n", $key);
 		}
 		elsif ($changed{$key} eq "-") {
-			printf(INFO "# deleted:\t%s\n", $key);
+			printf($fh "# deleted:\t%s\n", $key);
 		}
 		else {
-			printf(INFO "# modified:\t%s\n", $key);
+			printf($fh "# modified:\t%s\n", $key);
 		}
 	}
 
-	close(INFO);
+	close($fh);
 }
 
 sub update_cat_pn {
@@ -202,7 +201,7 @@ sub check_vcs_dir {
 }
 
 # Just to ensure we don't get duplicate entries.
-sub mypush(\@@) {
+sub mypush {
 	my $aref = shift;
 
 	foreach my $value (@_) {
@@ -381,8 +380,8 @@ while (<C>) {
 }
 
 sub git_unknown_objects {
-	open(GIT, "-|", "${vcs} ls-files --exclude-standard --others");
-	while(defined( my $line = <GIT> )) {
+	open(my $ph, "-|", "${vcs} ls-files --exclude-standard --others");
+	while(defined( my $line = <$ph> )) {
 		chomp($line);
 
 		# IMHO we can skip those files, even if they're untracked
@@ -390,7 +389,7 @@ sub git_unknown_objects {
 
 		push(@unknown, $line);
 	}
-	close(GIT);
+	close($ph);
 }
 
 # git only shows files already added so we need to check for unknown files
@@ -431,7 +430,7 @@ EOT
 
 # Sort the list of files as portage does.  None of the operations through
 # the rest of the script should break this sort.
-sub sortfunc($$) {
+sub sortfunc {
 	my ($a, $b) = @_;
 	(my $va = $a) =~ s/.*?-(\d.*?)(?:\.ebuild)?$/$1/;
 	(my $vb = $b) =~ s/.*?-(\d.*?)(?:\.ebuild)?$/$1/;
@@ -798,7 +797,7 @@ if ($vcs eq "cvs") {
 		system("svn add ChangeLog") unless (scalar grep /ChangeLog/, <F>);
 	}
 } else {
-	system("$vcs{$vcs}{add} ChangeLog 2>&1 >> /dev/null");
+	system("$vcs{$vcs}{add} ChangeLog 2>&1 > /dev/null");
 }
 
 # vim: set ts=4 sw=4 tw=0:



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/gentoolkit:gentoolkit-dev commit in: src/echangelog/
@ 2012-04-09 15:48 Christian Ruppert
  0 siblings, 0 replies; 17+ messages in thread
From: Christian Ruppert @ 2012-04-09 15:48 UTC (permalink / raw
  To: gentoo-commits

commit:     db6c7f618afd8e080ddc27fa133a711b8f049af3
Author:     Christian Ruppert <idl0r <AT> gentoo <DOT> org>
AuthorDate: Mon Apr  9 15:48:32 2012 +0000
Commit:     Christian Ruppert <idl0r <AT> gentoo <DOT> org>
CommitDate: Mon Apr  9 15:48:32 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=db6c7f61

Add prototypes back for now

---
 src/echangelog/echangelog |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/echangelog/echangelog b/src/echangelog/echangelog
index a6a9533..bf25af7 100755
--- a/src/echangelog/echangelog
+++ b/src/echangelog/echangelog
@@ -106,7 +106,7 @@ sub version {
 	exit 0;
 }
 
-sub getenv {
+sub getenv($) {
     my $key = shift;
 
     # Ensure our variable exist
@@ -201,7 +201,7 @@ sub check_vcs_dir {
 }
 
 # Just to ensure we don't get duplicate entries.
-sub mypush {
+sub mypush(\@@) {
 	my $aref = shift;
 
 	foreach my $value (@_) {
@@ -430,7 +430,7 @@ EOT
 
 # Sort the list of files as portage does.  None of the operations through
 # the rest of the script should break this sort.
-sub sortfunc {
+sub sortfunc($$) {
 	my ($a, $b) = @_;
 	(my $va = $a) =~ s/.*?-(\d.*?)(?:\.ebuild)?$/$1/;
 	(my $vb = $b) =~ s/.*?-(\d.*?)(?:\.ebuild)?$/$1/;



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/gentoolkit:gentoolkit-dev commit in: src/echangelog/
@ 2013-05-10 22:47 Christian Ruppert
  0 siblings, 0 replies; 17+ messages in thread
From: Christian Ruppert @ 2013-05-10 22:47 UTC (permalink / raw
  To: gentoo-commits

commit:     c508a549f93ab96db4a3c9a114a11f270994e2b8
Author:     Christian Ruppert <idl0r <AT> gentoo <DOT> org>
AuthorDate: Fri May 10 22:41:31 2013 +0000
Commit:     Christian Ruppert <idl0r <AT> gentoo <DOT> org>
CommitDate: Fri May 10 22:41:31 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=c508a549

Add clean target for echangelog

---
 src/echangelog/Makefile |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/echangelog/Makefile b/src/echangelog/Makefile
index fa2b38d..5d344b0 100644
--- a/src/echangelog/Makefile
+++ b/src/echangelog/Makefile
@@ -10,6 +10,9 @@ include ../../makedefs.mak
 
 all:
 
+clean:
+	$(RM) -r test/tmp
+
 test:
 	cd test; sh test.sh
 


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/gentoolkit:gentoolkit-dev commit in: src/echangelog/
@ 2013-05-11 14:18 Christian Ruppert
  0 siblings, 0 replies; 17+ messages in thread
From: Christian Ruppert @ 2013-05-11 14:18 UTC (permalink / raw
  To: gentoo-commits

commit:     d083c59eb3df6a96707a56f54a7dea77c2497493
Author:     Christian Ruppert <idl0r <AT> gentoo <DOT> org>
AuthorDate: Sat May 11 14:17:57 2013 +0000
Commit:     Christian Ruppert <idl0r <AT> gentoo <DOT> org>
CommitDate: Sat May 11 14:17:57 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=d083c59e

Fix closing pipe handle

---
 src/echangelog/echangelog |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/echangelog/echangelog b/src/echangelog/echangelog
index 48007d1..b7e97e4 100755
--- a/src/echangelog/echangelog
+++ b/src/echangelog/echangelog
@@ -592,7 +592,7 @@ if (@ebuilds) {
 		}
 	}
 }
-close($fh);
+close($fh) if $fh;
 
 # Subversion diff doesn't identify new versions. So use the status command
 if (($vcs eq "svn" or $vcs eq "hg") and (@ebuilds)) {


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/gentoolkit:gentoolkit-dev commit in: src/echangelog/
@ 2013-05-11 18:50 Christian Ruppert
  0 siblings, 0 replies; 17+ messages in thread
From: Christian Ruppert @ 2013-05-11 18:50 UTC (permalink / raw
  To: gentoo-commits

commit:     48c4271f8cfc4f4835cdd376f267aabc1a70fa0e
Author:     Christian Ruppert <idl0r <AT> gentoo <DOT> org>
AuthorDate: Sat May 11 18:40:48 2013 +0000
Commit:     Christian Ruppert <idl0r <AT> gentoo <DOT> org>
CommitDate: Sat May 11 18:40:48 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=48c4271f

Don't use constants for file/pipe handles

---
 src/echangelog/echangelog |   90 +++++++++++++++++++++++----------------------
 1 files changed, 46 insertions(+), 44 deletions(-)

diff --git a/src/echangelog/echangelog b/src/echangelog/echangelog
index b7e97e4..effc272 100755
--- a/src/echangelog/echangelog
+++ b/src/echangelog/echangelog
@@ -23,6 +23,7 @@ $Text::Wrap::unexpand = 0;
 # Global variables
 my (@files, @ebuilds, @conflicts, @trivial, @unknown, @new_versions, %actions);
 my ($input, $editor, $entry, $user, $date, $text, $vcs);
+my ($fh);
 my ($opt_help, $opt_nostrict, $opt_force_vcs, $opt_version, $opt_strict);
 
 $date = strftime("%d %b %Y", gmtime);
@@ -260,23 +261,23 @@ if ( ! $vcs ) {
 
 # Read the current ChangeLog
 if (-f 'ChangeLog') {
-	open(I, '<', 'ChangeLog') or die "Can't open ChangeLog for input: $!\n";
-	{ local $/ = undef; $text = <I>; }
-	close(I);
+	open($fh, '<', 'ChangeLog') or die "Can't open ChangeLog for input: $!\n";
+	{ local $/ = undef; $text = <$fh>; }
+	close($fh);
 } else {
 	# No ChangeLog here, maybe we should make one...
 	if (<*.ebuild>) {
-		open(C, '-|', "portageq portdir") or die "portageq returned with an error: $!\n";
-		my $portdir = <C>;
+		open(my $ph, '-|', "portageq portdir") or die "portageq returned with an error: $!\n";
+		my $portdir = <$ph>;
 		$portdir =~ s/\s+$//;
-		close(C);
+		close($ph);
 
 		die "Can't find PORTDIR\n" if (length $portdir == 0);
 
-		open(I, '<', "$portdir/skel.ChangeLog")
+		open($fh, '<', "$portdir/skel.ChangeLog")
 			or die "Can't open $portdir/skel.ChangeLog for input: $!\n";
-		{ local $/ = undef; $text = <I>; }
-		close(I);
+		{ local $/ = undef; $text = <$fh>; }
+		close($fh);
 
 		$text =~ s/^\*.*//ms; # don't need the fake entry
 	} else {
@@ -295,8 +296,8 @@ if (<*.ebuild>) {
 }
 
 # Figure out what has changed around here
-open C, $vcs{$vcs}{status}.' 2>&1 |' or die "Can't run ".$vcs{$vcs}{status}.": $!\n";
-while (<C>) {
+open(my $ph_status, $vcs{$vcs}{status}.' 2>&1 |') or die "Can't run ".$vcs{$vcs}{status}.": $!\n";
+while (<$ph_status>) {
 	# I don't want mess our existing stuff with the horrible bazaar stuff.
 	# TODO: add stuff for untracked/conflicting files.
 	if ($vcs eq "bzr") {
@@ -356,9 +357,9 @@ while (<C>) {
 		my ($status, $filename) = ($1,$2);
 
 		if($vcs eq "git") {
-			open(P, '-|', "git rev-parse --sq --show-prefix");
-			my $prefix = <P>;
-			close(P);
+			open(my $ph, '-|', "git rev-parse --sq --show-prefix");
+			my $prefix = <$ph>;
+			close($ph);
 
 			if (defined($prefix)) {
 				chomp($prefix);
@@ -378,6 +379,7 @@ while (<C>) {
 		($actions{$filename} = $status) =~ tr/DARM/-+-/d;
 	}
 }
+close($ph_status);
 
 sub git_unknown_objects {
 	open(my $ph, "-|", "${vcs} ls-files --exclude-standard --others");
@@ -518,15 +520,15 @@ sub sortfunc($$) {
 @ebuilds = grep(/\.ebuild$/, @files);
 @files = grep(!/\.ebuild$/, @files);
 
-my $fh;
+my $ph_diff;
 if (@ebuilds) {
 	if ($vcs eq "git") {
-		open($fh, $vcs{$vcs}{diff}." HEAD -- @ebuilds 2>&1 |") or die "Can't run: ".$vcs{$vcs}{diff}."$!\n";
+		open($ph_diff, $vcs{$vcs}{diff}." HEAD -- @ebuilds 2>&1 |") or die "Can't run: ".$vcs{$vcs}{diff}."$!\n";
 	} else {
-		open($fh, $vcs{$vcs}{diff}." @ebuilds 2>&1 |") or die "Can't run: ".$vcs{$vcs}{diff}."$!\n";
+		open($ph_diff, $vcs{$vcs}{diff}." @ebuilds 2>&1 |") or die "Can't run: ".$vcs{$vcs}{diff}."$!\n";
 	}
 
-	while (defined(my $line = <$fh>)) {
+	while (defined(my $line = <$ph_diff>)) {
 		# only possible with cvs
 		if ($line =~ m/^$vcs diff: (([^\/]*?)\.ebuild) was removed/) {
 			mypush(@ebuilds, $1);
@@ -537,7 +539,7 @@ if (@ebuilds) {
 			my ($file, $version) = ($1, $2);
 
 			if ($vcs eq "git") {
-				while (defined($line = <$fh>)) {
+				while (defined($line = <$ph_diff>)) {
 					last if $line =~ m/^deleted file mode|^index/;
 					if ($line =~ m/^new file mode/) {
 						mypush(@ebuilds, $file);
@@ -563,12 +565,12 @@ if (@ebuilds) {
 			# check if more than just copyright date changed.
 			# skip some lines (vcs dependent)
 			foreach(1..$vcs{$vcs}{skip}) {
-				$line = <$fh>;
+				$line = <$ph_diff>;
 			}
 
 
 			my $copy_only = 1;
-			while(defined($line = <$fh>)) {
+			while(defined($line = <$ph_diff>)) {
 				# We just want to check/compare the differences so anything beginning with +/-
 				if ($line =~ m/^[-+](?!# Copyright)/m) {
 					mypush(@ebuilds, $file);
@@ -592,21 +594,19 @@ if (@ebuilds) {
 		}
 	}
 }
-close($fh) if $fh;
+close($ph_diff) if $ph_diff;
 
 # Subversion diff doesn't identify new versions. So use the status command
 if (($vcs eq "svn" or $vcs eq "hg") and (@ebuilds)) {
-	open C, $vcs{$vcs}{status}." @ebuilds 2>&1 |" or die "Can't run: ".$vcs{$vcs}{status}."$!\n";
-	$_ = <C>;
+	open(my $ph_status, $vcs{$vcs}{status}." @ebuilds 2>&1 |") or die "Can't run: ".$vcs{$vcs}{status}."$!\n";
 
-	while (defined $_) {
-		if (/^A\s+\+?\s*(([^\s]*)\.ebuild)/) {
+	while (defined(my $line = <$ph_status>)) {
+		if ($line =~ m/^A\s+\+?\s*(([^\s]*)\.ebuild)/) {
 			mypush(@ebuilds, $1);
 			mypush(@new_versions, $2);
 		}
-
-		$_ = <C>;
 	}
+	close($ph_status);
 }
 
 # When a package move occurs, the versions appear to be new even though they are
@@ -660,10 +660,10 @@ if ($ARGV[0]) {
 			print STDERR "Editor died!  Reverting to stdin method.\n";
 			undef $editor;
 		} else {
-			if (open I, "<ChangeLog.new") {
+			if (open($fh, "<ChangeLog.new")) {
 				local $/ = undef;
-				$input = <I>;
-				close(I);
+				$input = <$fh>;
+				close($fh);
 
 				# Remove comments from changelog_info().
 				local $/ = "\n";
@@ -756,18 +756,18 @@ for my $e (grep(!/\.(patch|diff)$/, @files), @ebuilds) {
 	if (-s $e && ! -B $e) {
 		my ($etext, $netext);
 
-		open E, "<$e" or warn("Can't read $e to update copyright year\n"), next;
-		{ local $/ = undef; $etext = <E>; }
-		close E;
+		open($fh, "<", $e) or warn("Can't read $e to update copyright year\n"), next;
+		{ local $/ = undef; $etext = <$fh>; }
+		close($fh);
 
 		# Attempt the substitution and compare
 		$netext = update_copyright($etext);
 		next if $netext eq $etext; # skip this file if no change.
 
 		# Write the new ebuild
-		open E, ">$e.new" or warn("Can't open $e.new\n"), next;
-		print E $netext and
-		close E or warn("Can't write $e.new\n"), next;
+		open($fh, ">", "${e}.new") or warn("Can't open $e.new\n"), next;
+		print $fh $netext and
+		close($fh) or warn("Can't write $e.new\n"), next;
 
 		# Move things around and show the diff
 		system "diff -U 0 $e $e.new";
@@ -781,9 +781,9 @@ for my $e (grep(!/\.(patch|diff)$/, @files), @ebuilds) {
 }
 
 # Write the new ChangeLog
-open O, '>ChangeLog.new' or die "Can't open ChangeLog.new for output: $!\n";
-print O $text            or die "Can't write ChangeLog.new: $!\n";
-close O                  or die "Can't close ChangeLog.new: $!\n";
+open($fh, ">", 'ChangeLog.new') or die "Can't open ChangeLog.new for output: $!\n";
+print $fh $text or die "Can't write ChangeLog.new: $!\n";
+close($fh) or die "Can't close ChangeLog.new: $!\n";
 
 # Move things around and show the ChangeLog diff
 system 'diff -Nu ChangeLog ChangeLog.new';
@@ -793,12 +793,14 @@ rename 'ChangeLog.new', 'ChangeLog' or die "Can't rename ChangeLog.new: $!\n";
 # The text will be added just like with any other ChangeLog below.
 # Add the new ChangeLog to vcs before continuing.
 if ($vcs eq "cvs") {
-	if (open F, "CVS/Entries") {
-		system("cvs -f add ChangeLog") unless (scalar grep /^\/ChangeLog\//, <F>);
+	if (open($fh, "<", "CVS/Entries")) {
+		system("cvs -f add ChangeLog") unless (scalar grep /^\/ChangeLog\//, <$fh>);
+		close($fh);
 	}
 } elsif ($vcs eq "svn") {
-	if (open F, ".svn/entries") {
-		system("svn add ChangeLog") unless (scalar grep /ChangeLog/, <F>);
+	if (open($fh, "<", ".svn/entries")) {
+		system("svn add ChangeLog") unless (scalar grep /ChangeLog/, <$fh>);
+		close($fh);
 	}
 } else {
 	system("$vcs{$vcs}{add} ChangeLog 2>&1 > /dev/null");


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/gentoolkit:gentoolkit-dev commit in: src/echangelog/
@ 2013-05-11 18:50 Christian Ruppert
  0 siblings, 0 replies; 17+ messages in thread
From: Christian Ruppert @ 2013-05-11 18:50 UTC (permalink / raw
  To: gentoo-commits

commit:     a0571d3d011357f1f851988b76cf7925140dded8
Author:     Christian Ruppert <idl0r <AT> gentoo <DOT> org>
AuthorDate: Sat May 11 18:50:34 2013 +0000
Commit:     Christian Ruppert <idl0r <AT> gentoo <DOT> org>
CommitDate: Sat May 11 18:50:34 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=a0571d3d

Some cleanup

---
 src/echangelog/echangelog |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/echangelog/echangelog b/src/echangelog/echangelog
index effc272..6f1178c 100755
--- a/src/echangelog/echangelog
+++ b/src/echangelog/echangelog
@@ -266,7 +266,7 @@ if (-f 'ChangeLog') {
 	close($fh);
 } else {
 	# No ChangeLog here, maybe we should make one...
-	if (<*.ebuild>) {
+	if (glob("*.ebuild")) {
 		open(my $ph, '-|', "portageq portdir") or die "portageq returned with an error: $!\n";
 		my $portdir = <$ph>;
 		$portdir =~ s/\s+$//;
@@ -291,12 +291,12 @@ $text = update_copyright($text);
 # New packages and/or ones that have moved around often have stale data here.
 # But only do that in places where ebuilds are around (as echangelog can be
 # used in profiles/ and such places).
-if (<*.ebuild>) {
+if (glob("*.ebuild")) {
 	$text = update_cat_pn($text);
 }
 
 # Figure out what has changed around here
-open(my $ph_status, $vcs{$vcs}{status}.' 2>&1 |') or die "Can't run ".$vcs{$vcs}{status}.": $!\n";
+open(my $ph_status, "-|", $vcs{$vcs}{status}.' 2>&1 |') or die "Can't run ".$vcs{$vcs}{status}.": $!\n";
 while (<$ph_status>) {
 	# I don't want mess our existing stuff with the horrible bazaar stuff.
 	# TODO: add stuff for untracked/conflicting files.
@@ -523,9 +523,9 @@ sub sortfunc($$) {
 my $ph_diff;
 if (@ebuilds) {
 	if ($vcs eq "git") {
-		open($ph_diff, $vcs{$vcs}{diff}." HEAD -- @ebuilds 2>&1 |") or die "Can't run: ".$vcs{$vcs}{diff}."$!\n";
+		open($ph_diff, "-|", $vcs{$vcs}{diff}." HEAD -- @ebuilds 2>&1 |") or die "Can't run: ".$vcs{$vcs}{diff}."$!\n";
 	} else {
-		open($ph_diff, $vcs{$vcs}{diff}." @ebuilds 2>&1 |") or die "Can't run: ".$vcs{$vcs}{diff}."$!\n";
+		open($ph_diff, "-|", $vcs{$vcs}{diff}." @ebuilds 2>&1 |") or die "Can't run: ".$vcs{$vcs}{diff}."$!\n";
 	}
 
 	while (defined(my $line = <$ph_diff>)) {
@@ -598,7 +598,7 @@ close($ph_diff) if $ph_diff;
 
 # Subversion diff doesn't identify new versions. So use the status command
 if (($vcs eq "svn" or $vcs eq "hg") and (@ebuilds)) {
-	open(my $ph_status, $vcs{$vcs}{status}." @ebuilds 2>&1 |") or die "Can't run: ".$vcs{$vcs}{status}."$!\n";
+	open(my $ph_status, "-|", $vcs{$vcs}{status}." @ebuilds 2>&1 |") or die "Can't run: ".$vcs{$vcs}{status}."$!\n";
 
 	while (defined(my $line = <$ph_status>)) {
 		if ($line =~ m/^A\s+\+?\s*(([^\s]*)\.ebuild)/) {
@@ -660,7 +660,7 @@ if ($ARGV[0]) {
 			print STDERR "Editor died!  Reverting to stdin method.\n";
 			undef $editor;
 		} else {
-			if (open($fh, "<ChangeLog.new")) {
+			if (open($fh, "<", "ChangeLog.new")) {
 				local $/ = undef;
 				$input = <$fh>;
 				close($fh);


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/gentoolkit:gentoolkit-dev commit in: src/echangelog/
@ 2013-05-11 18:59 Christian Ruppert
  0 siblings, 0 replies; 17+ messages in thread
From: Christian Ruppert @ 2013-05-11 18:59 UTC (permalink / raw
  To: gentoo-commits

commit:     853a4399338b97246f7e6f3521c6312136b6c0cb
Author:     Christian Ruppert <idl0r <AT> gentoo <DOT> org>
AuthorDate: Sat May 11 18:57:00 2013 +0000
Commit:     Christian Ruppert <idl0r <AT> gentoo <DOT> org>
CommitDate: Sat May 11 18:57:00 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=853a4399

Remove pipe chars

---
 src/echangelog/echangelog |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/echangelog/echangelog b/src/echangelog/echangelog
index 6f1178c..d6cb205 100755
--- a/src/echangelog/echangelog
+++ b/src/echangelog/echangelog
@@ -296,7 +296,7 @@ if (glob("*.ebuild")) {
 }
 
 # Figure out what has changed around here
-open(my $ph_status, "-|", $vcs{$vcs}{status}.' 2>&1 |') or die "Can't run ".$vcs{$vcs}{status}.": $!\n";
+open(my $ph_status, "-|", $vcs{$vcs}{status}.' 2>&1') or die "Can't run ".$vcs{$vcs}{status}.": $!\n";
 while (<$ph_status>) {
 	# I don't want mess our existing stuff with the horrible bazaar stuff.
 	# TODO: add stuff for untracked/conflicting files.
@@ -523,9 +523,9 @@ sub sortfunc($$) {
 my $ph_diff;
 if (@ebuilds) {
 	if ($vcs eq "git") {
-		open($ph_diff, "-|", $vcs{$vcs}{diff}." HEAD -- @ebuilds 2>&1 |") or die "Can't run: ".$vcs{$vcs}{diff}."$!\n";
+		open($ph_diff, "-|", $vcs{$vcs}{diff}." HEAD -- @ebuilds 2>&1") or die "Can't run: ".$vcs{$vcs}{diff}."$!\n";
 	} else {
-		open($ph_diff, "-|", $vcs{$vcs}{diff}." @ebuilds 2>&1 |") or die "Can't run: ".$vcs{$vcs}{diff}."$!\n";
+		open($ph_diff, "-|", $vcs{$vcs}{diff}." @ebuilds 2>&1") or die "Can't run: ".$vcs{$vcs}{diff}."$!\n";
 	}
 
 	while (defined(my $line = <$ph_diff>)) {
@@ -598,7 +598,7 @@ close($ph_diff) if $ph_diff;
 
 # Subversion diff doesn't identify new versions. So use the status command
 if (($vcs eq "svn" or $vcs eq "hg") and (@ebuilds)) {
-	open(my $ph_status, "-|", $vcs{$vcs}{status}." @ebuilds 2>&1 |") or die "Can't run: ".$vcs{$vcs}{status}."$!\n";
+	open(my $ph_status, "-|", $vcs{$vcs}{status}." @ebuilds 2>&1") or die "Can't run: ".$vcs{$vcs}{status}."$!\n";
 
 	while (defined(my $line = <$ph_status>)) {
 		if ($line =~ m/^A\s+\+?\s*(([^\s]*)\.ebuild)/) {


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/gentoolkit:gentoolkit-dev commit in: src/echangelog/
@ 2013-05-11 19:11 Christian Ruppert
  0 siblings, 0 replies; 17+ messages in thread
From: Christian Ruppert @ 2013-05-11 19:11 UTC (permalink / raw
  To: gentoo-commits

commit:     ea8d02eb24a636b0974bff595c9574a426b86ae5
Author:     Christian Ruppert <idl0r <AT> gentoo <DOT> org>
AuthorDate: Sat May 11 19:11:12 2013 +0000
Commit:     Christian Ruppert <idl0r <AT> gentoo <DOT> org>
CommitDate: Sat May 11 19:11:12 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=ea8d02eb

Refactor pipe handle close

---
 src/echangelog/echangelog |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/echangelog/echangelog b/src/echangelog/echangelog
index d6cb205..ab3c475 100755
--- a/src/echangelog/echangelog
+++ b/src/echangelog/echangelog
@@ -520,8 +520,8 @@ sub sortfunc($$) {
 @ebuilds = grep(/\.ebuild$/, @files);
 @files = grep(!/\.ebuild$/, @files);
 
-my $ph_diff;
 if (@ebuilds) {
+	my $ph_diff;
 	if ($vcs eq "git") {
 		open($ph_diff, "-|", $vcs{$vcs}{diff}." HEAD -- @ebuilds 2>&1") or die "Can't run: ".$vcs{$vcs}{diff}."$!\n";
 	} else {
@@ -593,8 +593,8 @@ if (@ebuilds) {
 			mypush(@new_versions, $2);
 		}
 	}
+	close($ph_diff);
 }
-close($ph_diff) if $ph_diff;
 
 # Subversion diff doesn't identify new versions. So use the status command
 if (($vcs eq "svn" or $vcs eq "hg") and (@ebuilds)) {


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/gentoolkit:gentoolkit-dev commit in: src/echangelog/
@ 2013-05-11 19:22 Christian Ruppert
  0 siblings, 0 replies; 17+ messages in thread
From: Christian Ruppert @ 2013-05-11 19:22 UTC (permalink / raw
  To: gentoo-commits

commit:     19f0c04b81fe3f941ce2f3e2ebfe5cf1e43957ed
Author:     Christian Ruppert <idl0r <AT> gentoo <DOT> org>
AuthorDate: Sat May 11 19:22:46 2013 +0000
Commit:     Christian Ruppert <idl0r <AT> gentoo <DOT> org>
CommitDate: Sat May 11 19:22:46 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=19f0c04b

Minor

---
 src/echangelog/echangelog |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/echangelog/echangelog b/src/echangelog/echangelog
index ab3c475..7f5e307 100755
--- a/src/echangelog/echangelog
+++ b/src/echangelog/echangelog
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
 #
 # echangelog: Update the ChangeLog for an ebuild.  For example:
 #
@@ -8,13 +8,14 @@
 #   >   Add ~alpha to KEYWORDS
 #   >
 
+use warnings;
 use strict;
-use POSIX qw(strftime getcwd setlocale);
+use POSIX qw(locale_h strftime getcwd setlocale);
 use File::Basename;
 use Getopt::Long;
 
 # Fix bug 21022 by restricting to C locale
-setlocale(&POSIX::LC_ALL, "C");
+setlocale(LC_ALL, "C");
 
 use Text::Wrap;
 $Text::Wrap::columns = 80;


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/gentoolkit:gentoolkit-dev commit in: src/echangelog/
@ 2014-11-08 17:48 Christian Ruppert
  0 siblings, 0 replies; 17+ messages in thread
From: Christian Ruppert @ 2014-11-08 17:48 UTC (permalink / raw
  To: gentoo-commits

commit:     e57ed600e070e5cbfbd57086f7497cfd8ca480d9
Author:     Patrice Clement <monsieurp <AT> gentoo <DOT> org>
AuthorDate: Tue Nov  4 14:42:47 2014 +0000
Commit:     Christian Ruppert <idl0r <AT> gentoo <DOT> org>
CommitDate: Sat Nov  8 17:48:03 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=e57ed600

echangelog: get rid of useless hash calls down to only one

---
 src/echangelog/echangelog | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/echangelog/echangelog b/src/echangelog/echangelog
index 7f5e307..adf3ac8 100755
--- a/src/echangelog/echangelog
+++ b/src/echangelog/echangelog
@@ -108,17 +108,19 @@ sub version {
 	exit 0;
 }
 
-sub getenv($) {
+sub getenv ($) {
     my $key = shift;
 
-    # Ensure our variable exist
-    if ( defined($ENV{$key}) ) {
-        # Ensure we don't get empty variables
-        if ( length($ENV{$key}) > 0 ) {
-            return $ENV{$key};
-        }
-    }
-    return;
+    # Check for key: defined and not empty
+    return if !$key or $key eq '';
+
+    # Fetch key in %ENV hash
+    my $env = $ENV{$key};
+
+    # Make sure the variable does exist,
+    # check for its length
+    # and return it
+    return $env if $env and (length($env) > 0);
 }
 
 # Bug 264146.


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/gentoolkit:gentoolkit-dev commit in: src/echangelog/
@ 2014-11-15 18:37 Christian Ruppert
  0 siblings, 0 replies; 17+ messages in thread
From: Christian Ruppert @ 2014-11-15 18:37 UTC (permalink / raw
  To: gentoo-commits

commit:     e424b2c3204306c2c9e459f0d51d04dc7b66695c
Author:     Patrice Clement <monsieurp <AT> gentoo <DOT> org>
AuthorDate: Wed Nov  5 16:37:00 2014 +0000
Commit:     Christian Ruppert <idl0r <AT> gentoo <DOT> org>
CommitDate: Sat Nov 15 18:18:06 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=e424b2c3

echangelog: incorporate man page in script and make use of Pod::Usage for displaying it

---
 src/echangelog/echangelog | 221 +++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 198 insertions(+), 23 deletions(-)

diff --git a/src/echangelog/echangelog b/src/echangelog/echangelog
index adf3ac8..7a04634 100755
--- a/src/echangelog/echangelog
+++ b/src/echangelog/echangelog
@@ -13,6 +13,7 @@ use strict;
 use POSIX qw(locale_h strftime getcwd setlocale);
 use File::Basename;
 use Getopt::Long;
+use Pod::Usage;
 
 # Fix bug 21022 by restricting to C locale
 setlocale(LC_ALL, "C");
@@ -25,7 +26,7 @@ $Text::Wrap::unexpand = 0;
 my (@files, @ebuilds, @conflicts, @trivial, @unknown, @new_versions, %actions);
 my ($input, $editor, $entry, $user, $date, $text, $vcs);
 my ($fh);
-my ($opt_help, $opt_nostrict, $opt_force_vcs, $opt_version, $opt_strict);
+my ($opt_man, $opt_help, $opt_nostrict, $opt_force_vcs, $opt_version, $opt_strict);
 
 $date = strftime("%d %b %Y", gmtime);
 
@@ -83,23 +84,6 @@ my %vcs = (
 	},
 );
 
-sub usage {
-	(my $usage = <<"	EOF") =~ s/^\t//gm;
-	Usage: echangelog [options] <changelog message>
-
-	Options:
-	    --help      err, this screen ...
-	    --no-strict do not abort on trivial/no changes
-	    --vcs <vcs> skip vcs autodetection and use the specified vcs instead
-	                for a list of supported version control systems see below
-	    --version   show version info
-
-	Supported VCS: bzr, cvs, git, hg, svn
-	EOF
-	print $usage;
-	exit 0;
-}
-
 sub version {
 	my $Revision = "Last svn change rev";
 	my $Date = "Last svn change date";
@@ -223,15 +207,18 @@ sub update_copyright {
 	return $t;
 }
 
-GetOptions(
-	'help' => \$opt_help,
+my $ret = GetOptions(
 	'no-strict' => \$opt_nostrict,
-	'vcs=s' => \$opt_force_vcs,
 	'version|v' => \$opt_version,
-	'strict' => \$opt_strict,
+	'help|h'    => \$opt_help,
+	'strict'    => \$opt_strict,
+	'vcs=s'     => \$opt_force_vcs,
+  'man'       => \$opt_man,
 );
 
-usage() if $opt_help;
+
+pod2usage(-verbose => 1, -exitval => -1) if ($opt_help || $ret ne 1);
+pod2usage(-verbose => 2, -exitval => -1) if $opt_man;
 version() if $opt_version;
 
 if($opt_strict) {
@@ -810,3 +797,191 @@ if ($vcs eq "cvs") {
 }
 
 # vim: set ts=4 sw=4 tw=0:
+
+__END__
+
+=head1 NAME
+
+echangelog - Update portage ChangeLog files.
+
+=head1 SYNOPSIS
+
+echangelog [options] <changelog message>
+
+  --no-strict
+  --vcs <vcs>
+  --help|h
+  --man
+  --version
+
+=head1 OPTIONS
+
+=over 14
+
+=item B<--no-strict>
+
+Do not abort on trivial changes.
+
+=item B<--vcs vcs>
+
+Skip VCS autodetection and use the specified VCS instead.
+
+Supported VCS: bzr, cvs, git, hg, svn
+
+=item B<--help|h>
+
+Display help.
+
+=item B<--man>
+
+Display man page.
+
+=item B<--version>
+
+Display version.
+
+=back
+
+=head1 DESCRIPTION
+
+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 text is
+not provided on the command-line, echangelog prompts for it.
+
+All modifications should occur before running echangelog so that it can include
+the appropriate file information in the ChangeLog entry.  For example, you
+should run "cvs add" on your files, otherwise 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 be too wide, (2) edit the
+ChangeLog manually.  If you prefer (2), I'd recommend something like
+"echangelog blah" so that the header lines 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 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.
+
+=head1 EXAMPLES
+
+To create a ChangeLog for a completely new package.  The header is parsed from
+skel.ebuild.
+
+  $ cvs add metalog-0.1.ebuild
+  cvs server: use 'cvs commit' to add this file permanently
+  $ 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
+  +# $Header$
+  + +*metalog-0.1 (23 Feb 2003) +
+  +  23 Feb 2003; Aron Griffis <agriffis@gentoo.org> metalog-0.1.ebuild :
+
+  +  New ebuild, thanks to Harvey McGillicuddy
+  +
+To bump a revision.  Note you need to "cvs add" so that echangelog will notice
+the new file.
+
+  $ cvs add metalog-0.1-r1.ebuild
+  cvs server: use 'cvs commit' to add this file permanently
+  $ 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
+   # $Header$
+
+  +*metalog-0.1-r1 (23 Feb 2003)
+  +
+  +  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)
+     23 Feb 2003; Aron Griffis <agriffis@gentoo.org> metalog-0.1.ebuild :
+
+For a multi-line entry, omit the command-line arg.
+
+  $ echangelog
+  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
+  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
+   # $Header$
+  +*metalog-0.1-r1 (23 Feb 2003)
+  +
+  +  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
+  +  give users the updated default configuration file.
+  + *metalog-0.1 (23 Feb 2003)
+
+     23 Feb 2003; Aron Griffis <agriffis@gentoo.org> metalog-0.1.ebuild :
+
+For a multi-line entry, omit the command-line arg.
+
+  $ echangelog
+  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
+  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
+   # $Header$
+
+  +*metalog-0.1-r1 (23 Feb 2003)
+  +
+  +  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 +  give
+  users the updated default configuration file.  +
+  *metalog-0.1 (23 Feb 2003)
+     23 Feb 2003; Aron Griffis <agriffis@gentoo.org> metalog-0.1.ebuild :
+
+=head1 ENVIRONMENT VARIABLES
+
+=over 4
+
+=item B<ECHANGELOG_USER>
+
+ If echangelog can't figure out your username for the entry, you should set
+ ECHANGELOG_USER like so:
+ $ export ECHANGELOG_USER="Aron Griffis <agriffis@gentoo.org"
+
+=back
+
+=head1 NOTES
+
+As of the most recent version of echangelog (when this man-page appeared),
+echangelog puts all new entries at the top of the file instead of finding the
+appropriate *version line within the file.  This is because that "new"
+ChangeLog format was never agreed upon by the Gentoo developers.  Unfortunately
+the existence of both formats will undoubtedly cause much confusion.  This also
+means that the examples above are wrong, since I just copied them from some old
+email.  However they're not much wrong. ;-)
+
+=head1 AUTHORS
+
+This tool was written by Aron Griffis <agriffis@gentoo.org>.  Bugs found should
+be filed against me at http://bugs.gentoo.org/
+
+This man page has been turned into a Perl POD document by Patrice Clement
+<monsieurp@gentoo.org>.
+
+=cut


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/gentoolkit:gentoolkit-dev commit in: src/echangelog/
@ 2016-03-19 23:10 Mike Gilbert
  0 siblings, 0 replies; 17+ messages in thread
From: Mike Gilbert @ 2016-03-19 23:10 UTC (permalink / raw
  To: gentoo-commits

commit:     9b543ebcf154918d3455d7628570e8c66f55612f
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 19 23:09:26 2016 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Sat Mar 19 23:09:26 2016 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=9b543ebc

echangelog: Add fallback text in case skel.ChangeLog is missing

Bug: https://bugs.gentoo.org/577790

 src/echangelog/echangelog | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/echangelog/echangelog b/src/echangelog/echangelog
index c382fd6..98af377 100755
--- a/src/echangelog/echangelog
+++ b/src/echangelog/echangelog
@@ -264,10 +264,17 @@ if (-f 'ChangeLog') {
 
 		die "Can't find PORTDIR\n" if (length $portdir == 0);
 
-		open($fh, '<', "$portdir/skel.ChangeLog")
-			or die "Can't open $portdir/skel.ChangeLog for input: $!\n";
-		{ local $/ = undef; $text = <$fh>; }
-		close($fh);
+		if (open($fh, '<', "$portdir/skel.ChangeLog")) {
+			local $/ = undef; $text = <$fh>;
+			close($fh);
+		}
+		else {
+			$text = <<EOT
+# ChangeLog for <CATEGORY>/<PACKAGE>
+# Copyright 1999-2016 Gentoo Foundation; Distributed under the GPL v2
+# \$Id\$
+EOT
+		}
 
 		$text =~ s/^\*.*//ms; # don't need the fake entry
 	} else {


^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2016-03-19 23:11 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-11 18:50 [gentoo-commits] proj/gentoolkit:gentoolkit-dev commit in: src/echangelog/ Christian Ruppert
  -- strict thread matches above, loose matches on Subject: below --
2016-03-19 23:10 Mike Gilbert
2014-11-15 18:37 Christian Ruppert
2014-11-08 17:48 Christian Ruppert
2013-05-11 19:22 Christian Ruppert
2013-05-11 19:11 Christian Ruppert
2013-05-11 18:59 Christian Ruppert
2013-05-11 18:50 Christian Ruppert
2013-05-11 14:18 Christian Ruppert
2013-05-10 22:47 Christian Ruppert
2012-04-09 15:48 Christian Ruppert
2012-04-09 14:13 Christian Ruppert
2011-02-25 20:51 Christian Ruppert
2011-02-25 20:51 Christian Ruppert
2011-02-25 20:51 Christian Ruppert
2011-02-25 20:51 Christian Ruppert
2011-02-25 20:51 Christian Ruppert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox