aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoridl0r <idl0r@gentoo.org>2009-05-09 18:25:52 +0000
committeridl0r <idl0r@gentoo.org>2009-05-09 18:25:52 +0000
commit8babb87408f6b5f063e3e40dbf32774d56965c09 (patch)
tree5f4b0177088304ac7d01950dacfb20768b6b232a
parentAdd hg/mercurial support. (diff)
downloadgentoolkit-8babb87408f6b5f063e3e40dbf32774d56965c09.tar.gz
gentoolkit-8babb87408f6b5f063e3e40dbf32774d56965c09.tar.bz2
gentoolkit-8babb87408f6b5f063e3e40dbf32774d56965c09.zip
Update category/package when creating the initial ChangeLog, thanks to Serkan Kaba <serkan@gentoo.org>. Cleanup.
svn path=/trunk/gentoolkit-dev/; revision=636
-rwxr-xr-xsrc/echangelog/echangelog51
1 files changed, 28 insertions, 23 deletions
diff --git a/src/echangelog/echangelog b/src/echangelog/echangelog
index 9b71f8b..4315acf 100755
--- a/src/echangelog/echangelog
+++ b/src/echangelog/echangelog
@@ -11,6 +11,7 @@
use strict;
use POSIX qw(strftime getcwd setlocale);
use File::Find;
+use File::Basename;
use Getopt::Long;
# Fix bug 21022 by restricting to C locale
@@ -153,6 +154,18 @@ sub changelog_info(%) {
close(INFO);
}
+sub update_cat_pn {
+ my $t = shift;
+ my $cwd = getcwd();
+
+ my $category = basename(dirname($cwd));
+ my $package_name = basename($cwd);
+
+ $t =~ s/^(# ChangeLog for).*/$1 $category\/$package_name/;
+
+ return $t;
+}
+
GetOptions(
'help' => \$opt_help,
'strict' => \$opt_strict,
@@ -193,22 +206,27 @@ if ( -d "CVS" ) {
# Read the current ChangeLog
if (-f 'ChangeLog') {
- open I, '<ChangeLog' or die "Can't open ChangeLog for input: $!\n";
+ open(I, '<', 'ChangeLog') or die "Can't open ChangeLog for input: $!\n";
{ local $/ = undef; $text = <I>; }
- close I;
+ close(I);
} else {
# No ChangeLog here, maybe we should make one...
if (<*.ebuild>) {
- open C, "portageq envvar PORTDIR |" or die "Can't find PORTDIR";
- my ($new) = <C>;
- close C;
+ open(C, '-|', "portageq portdir") or die "portageq returned with an error: $!\n";
+ my $portdir = <C>;
+ $portdir =~ s/\s+$//;
+ close(C);
- $new =~ s/\s+$//;
- open I, "< $new/skel.ChangeLog"
- or die "Can't open $new/skel.ChangeLog for input: $!\n";
+ die "Can't find PORTDIR\n" if (length $portdir == 0);
+
+ open(I, '<', "$portdir/skel.ChangeLog")
+ or die "Can't open $portdir/skel.ChangeLog for input: $!\n";
{ local $/ = undef; $text = <I>; }
- close I;
- $text =~ s/^\*.*//ms; # don't need the fake entry
+ 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";
}
@@ -424,7 +442,6 @@ sub mypush(\@@) {
# Forget ebuilds that only have changed copyrights, unless that's all
# the changed files we have
-
@ebuilds = grep /\.ebuild$/, @files;
@files = grep !/\.ebuild$/, @files;
@@ -641,18 +658,6 @@ if (@new_versions) {
or die "Failed to insert new entry (3)\n";
}
-sub update_cat_pn {
- my ($t) = @_;
- my ($cwd) = getcwd();
-
- $cwd =~ m|.*/(\w+-\w+\|virtual)/([^/]+)|
- or die "Can't figure out category/package.. sorry!\n";
- my ($category, $package_name) = ($1, $2);
- $t =~ s/^(# ChangeLog for).*/$1 $category\/$package_name/;
-
- return $t;
-}
-
# 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).