aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfuzzyray <fuzzyray@gentoo.org>2009-04-30 21:08:44 +0000
committerfuzzyray <fuzzyray@gentoo.org>2009-04-30 21:08:44 +0000
commitb8b86224215139835cd001f3d77def718e0eb624 (patch)
treea122d4bccb8dbca0c975d3dce597ca7f2882bb2c
parentMerge changes from trunk to fix issues in 0.2.4 (diff)
parentFixed git detection. (diff)
downloadgentoolkit-b8b86224215139835cd001f3d77def718e0eb624.tar.gz
gentoolkit-b8b86224215139835cd001f3d77def718e0eb624.tar.bz2
gentoolkit-b8b86224215139835cd001f3d77def718e0eb624.zip
Merge changes from trunk to fix issues in 0.2.4gentoolkit-0.2.4.3
svn path=/branches/gentoolkit-0.2.4/; revision=557
-rw-r--r--ChangeLog20
-rwxr-xr-x[-rw-r--r--]src/echangelog/echangelog766
-rw-r--r--src/echangelog/echangelog.1127
-rw-r--r--src/echangelog/test/TEST.pm26
-rw-r--r--src/echangelog/test/templates/test.patch6
-rw-r--r--src/echangelog/test/templates/vcstest-0.0.1.ebuild16
-rwxr-xr-xsrc/echangelog/test/test.sh192
-rw-r--r--src/ekeyword/ChangeLog9
-rwxr-xr-x[-rw-r--r--]src/ekeyword/ekeyword161
-rwxr-xr-xsrc/equery/equery19
-rw-r--r--src/gentoolkit/helpers.py2
-rw-r--r--src/gentoolkit/package.py4
-rw-r--r--src/gentoolkit/pprinter.py2
-rwxr-xr-x[-rw-r--r--]src/glsa-check/glsa-check37
-rwxr-xr-xsrc/revdep-rebuild/revdep-rebuild48
-rw-r--r--src/revdep-rebuild/revdep-rebuild.137
16 files changed, 981 insertions, 491 deletions
diff --git a/ChangeLog b/ChangeLog
index 2e13833..6597880 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2009-04-30: Paul Varner <fuzzyray@gentoo.org>
+ * revdep-rebuild: Add patch from loki_val to check -l dependencies in
+ .la files (Bug #267898)
+
+2009-04-24: Paul Varner <fuzzyray@gentoo.org>
+ * ekeyword: Fix to handle multiline KEYWORDS (Bug #267250)
+
+2009-01-08: Paul Varner <fuzzyray@gentoo.org>
+ * equery: Fix package.py to account for PORTDIR being a symbolic link
+ when checking if a package is in an overlay. (Bug #253968)
+
+2008-11-25: Paul Varner <fuzzyray@gentoo.org>
+ * revdep-rebuild: Fixes for non-linux Gentoo systems. Add patch from
+ igli to fix find command to comply with POSIX. Change awk calls to
+ gawk.
+
+2008-11-11: Paul Varner <fuzzyray@gentoo.org>
+ * echangelog: Add --strict option (Bug 246242).
+ * echangelog: Fix processing of virtual category (Bug 179530)
+
2008-09-17: Paul Varner <fuzzyray@gentoo.org>
* euse: Fix check_sanity function to use get_all_make_defaults
function when checking for the make.defaults files in the profile.
diff --git a/src/echangelog/echangelog b/src/echangelog/echangelog
index 1a4bee7..fea1af6 100644..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 Getopt::Long;
# Fix bug 21022 by restricting to C locale
setlocale(&POSIX::LC_ALL, "C");
@@ -21,121 +22,172 @@ $Text::Wrap::unexpand = 0;
# Global variables
my (@files, @ebuilds, @conflicts, @trivial, @unknown, @new_versions, %actions);
-my ($input, $editor, $entry, $user, $date, $text, $version, $year, $vcs);
-
-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 ($input, $editor, $entry, $user, $date, $text, $year, $vcs);
+my ($opt_help, $opt_strict, $opt_version);
+
+$opt_help = 0;
+$opt_strict = 0;
+$opt_version = 0;
+
+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 {
+ (my $usage = <<" EOF") =~ s/^\t//gm;
+ Usage: echangelog [options] <changelog message>
+
+ Options:
+ --help err, this screen ...
+ --strict abort on trivial/no changes
+ --version show version info
+ EOF
+ print $usage;
+ exit 0;
+}
+
+sub version {
+ my $Revision = "Last svn change rev";
+ my $Date = "Last svn change date";
+ my $foo = "";
+ print "echangelog\n$Revision$foo \n$Date$foo\n";
+ exit 0;
+}
+GetOptions(
+ 'help' => \$opt_help,
+ 'strict' => \$opt_strict,
+ 'version' => \$opt_version,
);
-# Figure out what kind of repo we are in.
+usage() if $opt_help;
+version() if $opt_version;
+# Figure out what kind of repo we are in.
if ( -d "CVS" ) {
- $vcs = "cvs";
+ $vcs = "cvs";
} elsif ( -d '.svn' ) {
- $vcs = "svn";
-} elsif ( -f '/usr/bin/git' and open GIT, "git rev-parse --git-dir |" ) {
- $vcs = "git";
- close GIT;
+ $vcs = "svn";
} else {
- die "No CVS, .git, .svn directories found, what kind of repo is this?";
+ if ( -x '/usr/bin/git' ) {
+ open(GIT, '-|', "git rev-parse --git-dir 2>/dev/null");
+ $vcs = "git" if defined(<GIT>);
+ close(GIT);
+ }
+
+ if ( ! $vcs ) {
+ die "No CVS, .git, .svn directories found, what kind of repo is this?";
+ }
}
# 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 I, '<ChangeLog' or die "Can't open ChangeLog for input: $!\n";
+ { local $/ = undef; $text = <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;
- $new =~ s/\s+$//;
- open I, "< $new/skel.ChangeLog"
- or die "Can't open $new/skel.ChangeLog for input: $!\n";
- { local $/ = undef; $text = <I>; }
- close I;
- my ($cwd) = getcwd();
- $cwd =~ m|.*/(\w+-\w+)/([^/]+)|
- or die "Can't figure out category/package.. sorry!\n";
- my ($category, $package_name) = ($1, $2);
- $text =~ s/^\*.*//ms; # don't need the fake entry
- $text =~ s/<CATEGORY>/$category/;
- $text =~ s/<PACKAGE_NAME>/$package_name/;
- } else {
- die "This should be run in a directory with ebuilds...\n";
- }
+ # 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;
+
+ $new =~ s/\s+$//;
+ open I, "< $new/skel.ChangeLog"
+ or die "Can't open $new/skel.ChangeLog for input: $!\n";
+ { local $/ = undef; $text = <I>; }
+ close I;
+ $text =~ s/^\*.*//ms; # don't need the fake entry
+ } else {
+ die "This should be run in a directory with ebuilds...\n";
+ }
}
# 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>) {
- if (/^C\s+(\S+)/) {
- if($vcs eq "git") {
- my $filename = $2;
- $filename =~ /\S*\/(\S*)/;
- if( -d $1 ) {
+ if (/^C\s+(\S+)/) {
+ if($vcs eq "git") {
+ my $filename = $2;
+ $filename =~ /\S*\/(\S*)/;
+
+ if( -d $1 ) {
+ next;
+ }
+
+ push @conflicts, $1;
+ next;
+ }
+
+ push @conflicts, $1;
next;
- }
- push @conflicts, $1;
- next;
- }
- push @conflicts, $1;
- next;
- } elsif (/^\?\s+(\S+)/) {
- if($vcs eq "git") {
- my $filename = $2;
- $filename =~ /\S*\/(\S*)/;
- if( -d $1 ) {
+ } elsif (/^\?\s+(\S+)/) {
+ if($vcs eq "git") {
+ my $filename = $2;
+ $filename =~ /\S*\/(\S*)/;
+
+ if( -d $1 ) {
+ next;
+ }
+
+ push @unknown, $1;
+ next;
+ } else {
+ push @unknown, $1;
+ }
+
+ $actions{$1} = '+';
next;
- }
- push @unknown, $1;
- next;
- } else {
- push @unknown, $1;
- }
- $actions{$1} = '+';
- next;
- } elsif (/^([ARMD])\s+(\S+)/) {
- my ($status, $filename) = ($1,$2);
- if($vcs eq "git") {
- open P, "git-rev-parse --sq --show-prefix |";
- my $prefix = <P>;
- $prefix = substr($prefix, 0, -1);
- close P;
-
- if ($filename =~ /$prefix(\S*)/) {
- $filename = $1 ;
- }
- else {
- next;
- }
- }
- if( -d $filename ) {
- next;
+ } elsif (/^([ARMD])\s+\+?\s*(\S+)/) {
+ my ($status, $filename) = ($1,$2);
+
+ if($vcs eq "git") {
+ open P, "git rev-parse --sq --show-prefix |";
+ my $prefix = <P>;
+ $prefix = substr($prefix, 0, -1);
+ close P;
+
+ if ($filename =~ /$prefix(\S*)/) {
+ $filename = $1 ;
+ }
+ else {
+ next;
+ }
+ }
+
+ if( -d $filename ) {
+ next;
+ }
+
+ push @files, $filename;
+ ($actions{$filename} = $status) =~ tr/DARM/-+-/d;
}
- push @files, $filename;
- ($actions{$filename} = $status) =~ tr/DARM/-+-/d;
- }
}
# git only shows files already added so we need to check for unknown files
-# separately here.
+# separately here.
if($vcs eq "git") {
find(\&git_unknown_objects, "./");
}
@@ -145,131 +197,144 @@ sub git_unknown_objects {
my ($dev,$ino,$mode,$nlink,$uid,$gid);
# Ignore empty directories - git doesn't version them and cvs removes them.
- if ((($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) && ! -d _) {
+ if ( (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) && ! -d _ ) {
open C, $vcs." status $_ 2>&1 1>/dev/null |";
-
- while (<C>) {
+
+ while (<C>) {
$_ = <C>;
push @unknown, $object;
- };
- close C;
+ };
+
+ close C;
};
}
# Separate out the trivial files for now
-@files = grep {
- !/files.digest|Manifest|ChangeLog/ or do { push @trivial, $_; 0; }
+@files = grep {
+ !/files.digest|Manifest|ChangeLog/ or do { push @trivial, $_; 0; }
} @files;
-@unknown = grep {
- !/files.digest|Manifest|ChangeLog/ or do { push @trivial, $_; 0; }
+@unknown = grep {
+ !/files.digest|Manifest|ChangeLog/ or do { push @trivial, $_; 0; }
} @unknown;
# Don't allow any conflicts
if (@conflicts) {
- print STDERR <<EOT;
+ print STDERR <<EOT;
$vcs reports the following conflicts. Please resolve them before
running echangelog.
EOT
- print STDERR map "C $_\n", @conflicts;
- exit 1;
+ print STDERR map "C $_\n", @conflicts;
+ exit 1;
}
# Don't allow unknown files (other than the trivial files that were separated
# out above)
if (@unknown) {
- print STDERR <<EOT;
+ print STDERR <<EOT;
$vcs reports the following unknown files. Please use "$vcs add" before
running echangelog, or remove the files in question.
EOT
- print STDERR map "? $_\n", @unknown;
- exit 1;
+ print STDERR map "? $_\n", @unknown;
+ exit 1;
}
# Sort the list of files as portage does. None of the operations through
# the rest of the script should break this sort.
sub sortfunc($$) {
- my ($a, $b) = @_;
- (my $va = $a) =~ s/.*?-(\d.*?)(?:\.ebuild)?$/$1/;
- (my $vb = $b) =~ s/.*?-(\d.*?)(?:\.ebuild)?$/$1/;
- my ($na, $sa, $sna, $ra) = ($va =~ /^(.*?)(?:_(alpha|beta||pre|rc|p)(\d*))?(?:-r(\d+))?$/);
- my ($nb, $sb, $snb, $rb) = ($vb =~ /^(.*?)(?:_(alpha|beta||pre|rc|p)(\d*))?(?:-r(\d+))?$/);
- my (@na) = split /\.|(?<=\d)(?=[^\d\.])/, $na;
- my (@nb) = split /\.|(?<=\d)(?=[^\d\.])/, $nb;
- my $retval;
-
- #
- # compare version numbers first
- #
- for (my $i = 0; defined $na[$i] or defined $nb[$i]; $i++) {
- # def vs. undef
- return +1 if defined $na[$i] and !defined $nb[$i];
- return -1 if defined $nb[$i] and !defined $na[$i];
-
- # num vs. num
- if ($na[$i] =~ /^\d/ and $nb[$i] =~ /^\d/) {
- $retval = ($na[$i] <=> $nb[$i]);
- return $retval if $retval;
- next;
- }
-
- # char vs. char
- if ($na[$i] =~ /^\D/ and $nb[$i] =~ /^\D/) {
- $retval = ($na[$i] cmp $nb[$i]);
- return $retval if $retval;
- next;
- }
-
- # num vs. char
- $retval = ($na[$i] =~ /\d/ and -1 or +1);
- return $retval;
- }
-
- #
- # compare suffix second
- #
- if (defined $sa and !defined $sb) {
- return +2 if $sa eq "p";
- return -2;
- }
- if (defined $sb and !defined $sa) {
- return -3 if $sb eq "p";
- return +3;
- }
-
- if (defined $sa) { # and defined $sb
- $retval = ($sa cmp $sb);
- if ($retval) {
- return +4 if $sa eq "p";
- return -4 if $sb eq "p";
- return $retval; # suffixes happen to be alphabetical order, mostly
- }
-
- # compare suffix number
- return +5 if defined $sna and !defined $snb;
- return -5 if defined $snb and !defined $sna;
- if (defined $sna) { # and defined $snb
- $retval = ($sna <=> $snb);
- return $retval if $retval;
- }
- }
-
- #
- # compare rev third
- #
- return +6 if defined $ra and !defined $rb;
- return -6 if defined $rb and !defined $ra;
- if (defined $ra) { # and defined $rb
- return ($ra <=> $rb);
- }
-
- #
- # nothing left to compare
- #
- return 0;
+ my ($a, $b) = @_;
+ (my $va = $a) =~ s/.*?-(\d.*?)(?:\.ebuild)?$/$1/;
+ (my $vb = $b) =~ s/.*?-(\d.*?)(?:\.ebuild)?$/$1/;
+ my ($na, $sa, $sna, $ra) = ($va =~ /^(.*?)(?:_(alpha|beta||pre|rc|p)(\d*))?(?:-r(\d+))?$/);
+ my ($nb, $sb, $snb, $rb) = ($vb =~ /^(.*?)(?:_(alpha|beta||pre|rc|p)(\d*))?(?:-r(\d+))?$/);
+ my (@na) = split /\.|(?<=\d)(?=[^\d\.])/, $na;
+ my (@nb) = split /\.|(?<=\d)(?=[^\d\.])/, $nb;
+ my $retval;
+
+ #
+ # compare version numbers first
+ #
+ for (my $i = 0; defined $na[$i] or defined $nb[$i]; $i++) {
+ # def vs. undef
+ return +1 if defined $na[$i] and !defined $nb[$i];
+ return -1 if defined $nb[$i] and !defined $na[$i];
+
+ # num vs. num
+ if ($na[$i] =~ /^\d/ and $nb[$i] =~ /^\d/) {
+ $retval = ($na[$i] <=> $nb[$i]);
+ return $retval if $retval;
+ next;
+ }
+
+ # char vs. char
+ if ($na[$i] =~ /^\D/ and $nb[$i] =~ /^\D/) {
+ $retval = ($na[$i] cmp $nb[$i]);
+ return $retval if $retval;
+ next;
+ }
+
+ # num vs. char
+ $retval = ($na[$i] =~ /\d/ and -1 or +1);
+ return $retval;
+ }
+
+ #
+ # compare suffix second
+ #
+ if (defined $sa and !defined $sb) {
+ return +2 if $sa eq "p";
+ return -2;
+ }
+ if (defined $sb and !defined $sa) {
+ return -3 if $sb eq "p";
+ return +3;
+ }
+
+ if (defined $sa) { # and defined $sb
+ $retval = ($sa cmp $sb);
+ if ($retval) {
+ return +4 if $sa eq "p";
+ return -4 if $sb eq "p";
+ return $retval; # suffixes happen to be alphabetical order, mostly
+ }
+
+ # compare suffix number
+ return +5 if defined $sna and !defined $snb;
+ return -5 if defined $snb and !defined $sna;
+
+ if (defined $sna) { # and defined $snb
+ $retval = ($sna <=> $snb);
+ return $retval if $retval;
+ }
+ }
+
+ #
+ # compare rev third
+ #
+ return +6 if defined $ra and !defined $rb;
+ return -6 if defined $rb and !defined $ra;
+
+ if (defined $ra) { # and defined $rb
+ return ($ra <=> $rb);
+ }
+
+ #
+ # nothing left to compare
+ #
+ return 0;
}
+
@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
@@ -277,62 +342,81 @@ sub sortfunc($$) {
@files = grep !/\.ebuild$/, @files;
if (@ebuilds) {
- if ($vcs eq "git") {
- 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;
+ if ($vcs eq "git") {
+ 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";
}
- # 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;
- if ($vcs eq "git") {
- ($f) = ($1);
- 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;
- }
- }
- } else {
- ($f) = ($2);
- }
+ $_ = <C>;
- # check if more than just copyright date changed.
- # skip some lines (vcs dependent)
- foreach(1..$vcs{$vcs}{skip}){
+ while (defined $_) {
+ # 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 = $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>) {
- last if /^[A-Za-z]/;
- if (/^[-+](?!# Copyright)/) {
- push @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
- }
- # other cvs output is ignored
- $_ = <C>;
- }
+ }
+
+ while (<C>) {
+ last if /^[A-Za-z]/;
+ if (/^[-+](?!# Copyright)/) {
+ 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/) {
+ mypush(@files, $1);
+ mypush(@new_versions, $2);
+ }
+
+ # other cvs output is ignored
+ $_ = <C>;
+ }
}
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*(([^\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
# not. Trim them from @new_versions in that case.
@new_versions = grep { $text !~ /^\*\Q$_\E\s/m } @new_versions;
@@ -343,48 +427,62 @@ close C;
# 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 "** 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";
- @files = sort sortfunc @trivial;
- @files = qw/ChangeLog/ unless @files; # last resort to put something in the list
+ 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";
+ print STDERR "** modified. Did you forget to $vcs add?\n";
+ print STDERR "**\n";
+
+ if ($opt_strict) {
+ print STDERR "** In strict mode, exiting\n";
+ exit 1;
+ }
+
+ @files = sort sortfunc @trivial;
+ @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";
+ $input = "@ARGV";
} else {
- # Testing for defined() allows ECHANGELOG_EDITOR='' to cancel EDITOR
- $editor = defined($ENV{'ECHANGELOG_EDITOR'}) ? $ENV{'ECHANGELOG_EDITOR'} :
- $ENV{'EDITOR'} || undef;
- if ($editor) {
- system("$editor ChangeLog.new");
- if ($? != 0) {
- # This usually happens when the editor got forcefully killed; and
- # the terminal is probably messed up: so we reset things.
- system('/usr/bin/stty sane');
- print STDERR "Editor died! Reverting to stdin method.\n";
- undef $editor;
- } else {
- if (open I, "<ChangeLog.new") {
- local $/ = undef;
- $input = <I>;
- close I;
- } else {
- print STDERR "Error opening ChangeLog.new: $!\n";
- print STDERR "Reverting to stdin method.\n";
- undef $editor;
- }
- unlink 'ChangeLog.new';
- }
- }
- unless ($editor) {
- print "Please type the log entry: use Ctrl-d to finish, Ctrl-c to abort...\n";
- local $/ = undef;
- $input = <>;
- }
+ # Testing for defined() allows ECHANGELOG_EDITOR='' to cancel EDITOR
+ $editor = defined($ENV{'ECHANGELOG_EDITOR'}) ? $ENV{'ECHANGELOG_EDITOR'} :
+ $ENV{'EDITOR'} || undef;
+
+ if ($editor) {
+ system("$editor ChangeLog.new");
+
+ if ($? != 0) {
+ # This usually happens when the editor got forcefully killed; and
+ # the terminal is probably messed up: so we reset things.
+ system('/usr/bin/stty sane');
+ print STDERR "Editor died! Reverting to stdin method.\n";
+ undef $editor;
+ } else {
+ if (open I, "<ChangeLog.new") {
+ local $/ = undef;
+ $input = <I>;
+ close I;
+ } else {
+ print STDERR "Error opening ChangeLog.new: $!\n";
+ print STDERR "Reverting to stdin method.\n";
+ undef $editor;
+ }
+
+ unlink 'ChangeLog.new';
+ }
+ }
+
+ unless ($editor) {
+ print "Please type the log entry: use Ctrl-d to finish, Ctrl-c to abort...\n";
+ local $/ = undef;
+ $input = <>;
+ }
}
die "Empty entry; aborting\n" unless $input =~ /\S/;
@@ -395,18 +493,20 @@ $input = Text::Wrap::fill(' ', ' ', $input);
# Prepend the user info to the input
unless ($user = $ENV{'ECHANGELOG_USER'}) {
- my ($fullname, $username) = (getpwuid($<))[6,0];
- $fullname =~ s/,.*//; # remove GECOS, bug 80011
- $user = sprintf "%s <%s\@gentoo.org>", $fullname, $username;
+ my ($fullname, $username) = (getpwuid($<))[6,0];
+ $fullname =~ s/,.*//; # remove GECOS, bug 80011
+ $user = sprintf "%s <%s\@gentoo.org>", $fullname, $username;
}
+
# 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 ', ', map "$actions{$_}$_", @files;
$entry .= ':';
-$entry = Text::Wrap::fill(' ', ' ', $entry); # does not append a \n
-$entry .= "\n$input"; # append user input
+$entry = Text::Wrap::fill(' ', ' ', $entry); # does not append a \n
+$entry .= "\n$input"; # append user input
# Each one of these regular expressions will eat the whitespace
# leading up to the next entry (except the two-space leader on the
@@ -414,28 +514,49 @@ $entry .= "\n$input"; # append user input
# double carriage-return. This helps to normalize the spacing in
# the ChangeLogs.
if (@new_versions) {
- # Insert at the top with a new version marker
- $text =~ s/^( .*? ) # grab header
- \s*\n(?=\ \ \d|\*|\z) # suck up trailing whitespace
- /"$1\n\n" .
- join("\n", map "*$_ ($date)", reverse @new_versions) .
- "\n\n$entry\n\n"/sxe
- or die "Failed to insert new entry (4)\n";
+ # Insert at the top with a new version marker
+ $text =~ s/^( .*? ) # grab header
+ \s*\n(?=\ \ \d|\*|\z) # suck up trailing whitespace
+ /"$1\n\n" .
+ join("\n", map "*$_ ($date)", reverse @new_versions) .
+ "\n\n$entry\n\n"/sxe
+ or die "Failed to insert new entry (4)\n";
} else {
- # Changing an existing patch or ebuild, no new version marker
- # required
- $text =~ s/^( .*? ) # grab header
- \s*\n(?=\ \ \d|\*|\z) # suck up trailing whitespace
- /$1\n\n$entry\n\n/sx
- or die "Failed to insert new entry (3)\n";
+ # Changing an existing patch or ebuild, no new version marker
+ # required
+ $text =~ s/^( .*? ) # grab header
+ \s*\n(?=\ \ \d|\*|\z) # suck up trailing whitespace
+ /$1\n\n$entry\n\n/sx
+ 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).
+if (grep(/\.ebuild$/, @files)) {
+ $text = update_cat_pn($text);
}
sub update_copyright {
- my ($t) = @_;
- (my $year = $date) =~ s/.* //;
- $t =~ s/^# Copyright \d+(?= )/$&-$year/m or
- $t =~ s/^(# Copyright \d+)-(\d+)/$1-$year/m;
- return $t;
+ my ($t) = @_;
+ (my $year = $date) =~ s/.* //;
+
+ $t =~ s/^# Copyright \d+(?= )/$&-$year/m or
+ $t =~ s/^(# Copyright) \d+-(\d+)/$1 1999-$year/m;
+
+ return $t;
}
# Update the copyright year in the ChangeLog
@@ -450,25 +571,26 @@ close O or die "Can't close ChangeLog.new: $!\n";
# copyright lines on ebuilds that haven't changed. I verified this with an IP
# lawyer.
for my $e (grep /\.ebuild$/, @files) {
- if (-s $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;
-
- # 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;
-
- # Move things around and show the diff
- system "diff -U 0 $e $e.new";
- rename "$e.new", $e or warn("Can't rename $e.new: $!\n");
- }
+ if (-s $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;
+
+ # 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;
+
+ # Move things around and show the diff
+ system "diff -U 0 $e $e.new";
+ rename "$e.new", $e or warn("Can't rename $e.new: $!\n");
+ }
}
# Move things around and show the ChangeLog diff
@@ -476,18 +598,18 @@ system 'diff -Nu ChangeLog ChangeLog.new';
rename 'ChangeLog.new', 'ChangeLog' or die "Can't rename ChangeLog.new: $!\n";
# Okay, now we have a starter ChangeLog to work with.
-# The text will be added just like with any other ChangeLog below.
+# 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 F, "CVS/Entries") {
+ system("cvs -f add ChangeLog") unless (scalar grep /^\/ChangeLog\//, <F>);
+ }
} elsif ($vcs eq "svn") {
- if (open F, ".svn/entries") {
- system("svn add ChangeLog") unless (scalar grep /ChangeLog/, <F>);
- }
+ if (open F, ".svn/entries") {
+ 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:sw=4 ts=8 expandtab
+# vim: set ts=4 sw=4 tw=0:
diff --git a/src/echangelog/echangelog.1 b/src/echangelog/echangelog.1
index f83eaf7..1575644 100644
--- a/src/echangelog/echangelog.1
+++ b/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
@@ -173,22 +180,20 @@ 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
@@ -197,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"
diff --git a/src/echangelog/test/TEST.pm b/src/echangelog/test/TEST.pm
new file mode 100644
index 0000000..6632148
--- /dev/null
+++ b/src/echangelog/test/TEST.pm
@@ -0,0 +1,26 @@
+# We just return a static/predefined date because we're working with
+# static md5 checksums.
+
+package TEST;
+
+use strict;
+use warnings;
+
+BEGIN {
+ use Exporter();
+ our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
+
+ $VERSION = 1.00;
+
+ @ISA = qw(Exporter);
+ @EXPORT = qw(&strftime);
+ %EXPORT_TAGS = ( );
+ @EXPORT_OK = qw();
+}
+our @EXPORT_OK;
+
+sub strftime {
+ return "01 Jan 2009";
+}
+
+1;
diff --git a/src/echangelog/test/templates/test.patch b/src/echangelog/test/templates/test.patch
new file mode 100644
index 0000000..72d46fa
--- /dev/null
+++ b/src/echangelog/test/templates/test.patch
@@ -0,0 +1,6 @@
+--- test.patch 2009-04-28 14:13:26.171225175 +0200
++++ test.patch 2009-04-28 14:12:26.246497830 +0200
+@@ -0,0 +1,3 @@
++This is just an example.
++Its used for several echangelog tests.
++
diff --git a/src/echangelog/test/templates/vcstest-0.0.1.ebuild b/src/echangelog/test/templates/vcstest-0.0.1.ebuild
new file mode 100644
index 0000000..2824b83
--- /dev/null
+++ b/src/echangelog/test/templates/vcstest-0.0.1.ebuild
@@ -0,0 +1,16 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+DESCRIPTION="echangelog test ebuild"
+HOMEPAGE=""
+SRC_URI=""
+
+LICENSE=""
+SLOT="0"
+KEYWORDS=""
+IUSE=""
+
+DEPEND=""
+RDEPEND=""
+
diff --git a/src/echangelog/test/test.sh b/src/echangelog/test/test.sh
new file mode 100755
index 0000000..374522f
--- /dev/null
+++ b/src/echangelog/test/test.sh
@@ -0,0 +1,192 @@
+#!/bin/sh
+
+source /etc/init.d/functions.sh
+
+VCSTEST="echangelog-test/vcstest"
+_ROOT=$(pwd)
+
+export ECHANGELOG_USER="Just a test <echangelogtest@gentoo.org>"
+
+#MD5_INIT="34d54bc2ab1a2154b0c7bd5cdd7f6119"
+MD5_INIT="34d54bc2ab1a2154b0c7bd5cdd7f6119"
+#MD5_PATCH="d910ab6b76cfb48b68e11ae1f06612bb"
+MD5_PATCH="db1ab89bb7374824d0f198078f79a83f"
+#MD5_REVBUMP="8e36650a644ba49cc13bcbe93fdb2d2d"
+MD5_REVBUMP="31ddfa60d2ae4dd1fccd7e3d2bd2c06c"
+#MD5_COPYRIGHT="55a6097d8e3913a9feb0dff250649c00"
+MD5_COPYRIGHT="6f39fa409ea14bb6506347c53f6dee50"
+#MD5_OBSOLETE="6c30d84f603f5f0e4b09a88d9cfdaaa8"
+MD5_OBSOLETE="0aedadf159c6f3add97a3f79fb867221"
+#MD5_FINAL="cdd58fea5cfcef5820013d82ccbe0e89"
+MD5_FINAL="17eb0df69f501cc6fdaffebd118b7764"
+
+function md5() {
+ local fname=$1
+ echo $(md5sum ${fname} | awk '{ print $1 }')
+}
+
+function ech() {
+ local bin=$1
+ local msg=$2
+
+ perl -I$(dirname $(dirname ${bin})) ${bin} "${msg}"
+}
+
+function make_test() {
+ local root=$1
+ local vcs=$2
+
+ local echangelog="${root}/tmp/echangelog"
+ local tmp="${root}/tmp/${vcs}"
+ local template="${root}/templates"
+
+ cd $root
+ mkdir -p ${tmp}
+ cd ${tmp}
+
+ [[ "${vcs}" == "cvs" ]] && mkdir -p ${tmp}/cvsroot
+ [[ "${vcs}" == "svn" ]] && mkdir -p ${tmp}/svnroot
+
+ if [[ "${vcs}" == "git" ]];
+ then
+ git init
+ touch .gitignore
+ git add .gitignore
+ git commit -a -m 'Initial Commit'
+ elif [[ "${vcs}" == "svn" ]];
+ then
+ svnadmin create svnroot
+ svn co file://${tmp}/svnroot svn
+ cd svn
+ elif [[ "${vcs}" == "cvs" ]];
+ then
+ CVSROOT="${tmp}/cvsroot" cvs init
+ mkdir cvsroot/cvs
+ cvs -d:local:${tmp}/cvsroot co cvs
+ cd cvs
+ fi
+
+ mkdir -p ${VCSTEST}
+
+ cp ${template}/vcstest-0.0.1.ebuild ${VCSTEST}
+ ${vcs} add $(dirname ${VCSTEST})
+ if [[ "${vcs}" == "cvs" ]];
+ then
+ ${vcs} add ${VCSTEST}
+ ${vcs} add "${VCSTEST}/vcstest-0.0.1.ebuild"
+ fi
+
+ cd ${VCSTEST}
+ ech ${echangelog} 'New ebuild for bug <id>.'
+
+ if [[ "${MD5_INIT}" != "$(md5 ChangeLog)" ]];
+ then
+ eerror "WRONG MD5_INIT!"
+ fi
+
+ mkdir files
+ cp ${template}/test.patch files
+ if [[ "${vcs}" == "cvs" ]];
+ then
+ ${vcs} add files/
+ ${vcs} add files/test.patch
+ else
+ ${vcs} add files
+ fi
+
+ ech ${echangelog} "Added adittional patch to fix foo."
+
+ if [[ "${MD5_PATCH}" != "$(md5 ChangeLog)" ]];
+ then
+ eerror "WRONG MD5_PATCH!"
+ fi
+
+ if [[ "${vcs}" == "svn" ]];
+ then
+ ${vcs} commit -m 'New ebuild for bug <id>.' ../
+ else
+ ${vcs} commit -m 'New ebuild for bug <id>.'
+ fi
+
+ [[ "${vcs}" == "cvs" ]] && sed -i -e 's:# $Header\: .*$:# $Header\: $:' ChangeLog
+
+ cp vcstest-0.0.1.ebuild vcstest-0.0.1-r1.ebuild
+ ${vcs} add vcstest-0.0.1-r1.ebuild
+
+ ech ${echangelog} "Revbump..."
+
+ if [[ "${MD5_REVBUMP}" != "$(md5 ChangeLog)" ]];
+ then
+ eerror "WRONG MD5_REVBUMP!"
+ fi
+
+ sed -i -e 's:# Copyright 1999-2009 Gentoo Foundation:# Copyright 1999-2010 Gentoo Foundation:' vcstest-0.0.1.ebuild
+ ech ${echangelog} "Revbump...; Just copyright changed."
+
+ if [[ "${MD5_COPYRIGHT}" != "$(md5 ChangeLog)" ]];
+ then
+ eerror "WRONG MD5_COPYRIGHT!"
+ fi
+
+ if [[ "${vcs}" == "cvs" ]];
+ then
+ rm -f files/test.patch
+ ${vcs} remove files/test.patch
+ else
+ ${vcs} rm files/test.patch
+ fi
+
+ ech ${echangelog} "Revbump...; Just copyright changed; Removed obsolete patch."
+
+ if [[ "${MD5_OBSOLETE}" != "$(md5 ChangeLog)" ]];
+ then
+ eerror "WRONG MD5_OBSOLETE!"
+ fi
+
+ echo>>vcstest-0.0.1.ebuild
+ ech ${echangelog} "Revbump...; Just copyright changed; Removed obsolete patch; Modified more then just the copyright."
+
+ if [[ "${MD5_FINAL}" != "$(md5 ChangeLog)" ]];
+ then
+ eerror "WRONG MD5_FINAL!"
+ fi
+}
+
+[[ -d "${_ROOT}/tmp" ]] && rm -rf ${_ROOT}/tmp
+mkdir -p ${_ROOT}/tmp
+
+ebegin "Preparing echangelog"
+
+if [[ -e ../echangelog ]];
+then
+ cp ../echangelog "${_ROOT}/tmp" || set $?
+ sed -i -e 's:use POSIX qw.*:use POSIX qw(setlocale getcwd);\nuse TEST qw(strftime);:' "${_ROOT}/tmp/echangelog" || set $?
+ eend ${1:-0} || exit ${1}
+else
+ eerror "error"
+ eend ${1:-1}
+ exit 1
+fi
+
+if [[ -x $(which git) ]];
+then
+ ebegin "Starting test with git"
+ make_test $_ROOT "git" || set $?
+ eend ${1:-0}
+fi
+
+if [[ -x $(which cvs) ]];
+then
+ ebegin "Starting test with cvs"
+ make_test $_ROOT "cvs" || set $?
+ eend ${1:-0}
+fi
+
+if [[ -x $(which svn) ]];
+then
+ ebegin "Starting test with svn"
+ make_test $_ROOT "svn" || set $?
+ eend ${1:-0}
+fi
+
+rm -rf "${_ROOT}/tmp"
diff --git a/src/ekeyword/ChangeLog b/src/ekeyword/ChangeLog
index d0fa818..68d99e5 100644
--- a/src/ekeyword/ChangeLog
+++ b/src/ekeyword/ChangeLog
@@ -1,3 +1,12 @@
+24 Apr 2009 Paul Varner <fuzzyray@gentoo.org>
+ * Handle multiline KEYWORDS
+
+07 Jan 2009 Mike Frysinger <vapier@gentoo.org>
+ * Support intended KEYWORDS
+ * Convert every instance of KEYWORDS in the file
+ * Error out on invalid arguments #156827
+ * Tighten up diff output to show KEYWORDS changes
+
27 Oct 2005 Aron Griffis <agriffis@gentoo.org>
* Fix handling of comments
* Add support for bare ~ as a synonym for ~all
diff --git a/src/ekeyword/ekeyword b/src/ekeyword/ekeyword
index e75ce93..2e49ac0 100644..100755
--- a/src/ekeyword/ekeyword
+++ b/src/ekeyword/ekeyword
@@ -1,6 +1,6 @@
#!/usr/bin/perl -w
#
-# Copyright 2003-2004, Gentoo Foundation
+# Copyright 2003-2009, Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# Written by Aron Griffis <agriffis@gentoo.org>
#
@@ -18,97 +18,110 @@ my (@kw);
# make sure the cmdline consists of keywords and ebuilds
unless (@ARGV > 0) {
- die "syntax: ekeyword { arch | ~[arch] | -[arch] } ebuild...\n"
+ die "syntax: ekeyword { arch | ~[arch] | -[arch] } ebuild...\n"
}
for my $a (@ARGV) {
- $a = '~all' if $a eq '~' or $a eq $ENV{'HOME'}; # for vapier
- next if $a =~ /$kw_re/o; # keyword
- next if $a =~ /^\S+\.ebuild$/; # ebuild
- die "I don't understand $a\n";
+ $a = '~all' if $a eq '~' or $a eq $ENV{'HOME'}; # for vapier
+ next if $a =~ /$kw_re/o; # keyword
+ next if $a =~ /^\S+\.ebuild$/; # ebuild
+ die "I don't understand $a\n";
}
+my $files = 0;
for my $f (@ARGV) {
- if ($f =~ /$kw_re/o) {
- push @kw, $f;
- next;
- }
+ if ($f =~ /$kw_re/o) {
+ push @kw, $f;
+ next;
+ }
- print "$f\n";
+ print "$f\n";
- open I, "<$f" or die "Can't read $f: $!\n";
- open O, ">$f.new" or die "Can't create $f.new: $!\n";
- select O;
+ open I, "<$f" or die "Can't read $f: $!\n";
+ open O, ">$f.new" or die "Can't create $f.new: $!\n";
+ select O;
- while (<I>) {
- /^KEYWORDS/ or print, next;
+ while (<I>) {
+ if (/^\s*KEYWORDS=/) {
- # extract the quoted section from KEYWORDS
- (my $quoted = $_) =~ s/^.*?["'](.*?)["'].*/$1/s;
+ # extract the quoted section from KEYWORDS
+ while (not /^KEYWORDS=["'].*?["']/) {
+ chomp;
+ my $next = <I>;
+ $_ = join " ", $_, $next;
+ }
+ (my $quoted = $_) =~ s/^.*?["'](.*?)["'].*/$1/s;
+
+ # replace -* with -STAR for our convenience below
+ $quoted =~ s/-\*/-STAR/;
+
+ for my $k (@kw) {
+ my ($leader, $arch, $star) = ($k =~ /$kw_re/o);
+
+ # handle -* and ^*
+ if (defined $star) {
+ $leader = substr $star,0,1;
+ $arch = 'STAR';
+ }
+
+ # remove keywords
+ if ($leader eq '^') {
+ if ($arch eq 'all') {
+ $quoted = '';
+ } else {
+ $quoted =~ s/[-~]?\Q$arch\E\b//;
+ }
+
+ # add or modify keywords
+ } else {
+ if ($arch eq 'all') {
+ # modify all non-masked keywords in the list
+ $quoted =~ s/(^|\s)~?(?=\w)/$1$leader/g;
+ } else {
+ # modify or add keyword
+ unless ($quoted =~ s/[-~]?\Q$arch\E(\s|$)/$leader$arch$1/) {
+ # modification failed, need to add
+ if ($arch eq 'STAR') {
+ $quoted = "$leader$arch $quoted";
+ } else {
+ $quoted .= " $leader$arch";
+ }
+ }
+ }
+ }
+ }
- # replace -* with -STAR for our convenience below
- $quoted =~ s/-\*/-STAR/;
+ # replace -STAR with -*
+ $quoted =~ s/-STAR\b/-*/;
- for my $k (@kw) {
- my ($leader, $arch, $star) = ($k =~ /$kw_re/o);
+ # sort keywords and fix spacing
+ $quoted = join " ", sort {
+ (my $sa = $a) =~ s/^\W//;
+ (my $sb = $b) =~ s/^\W//;
+ return -1 if $sa eq '*';
+ return +1 if $sb eq '*';
+ $sa cmp $sb;
+ } split " ", $quoted;
- # handle -* and ^*
- if (defined $star) {
- $leader = substr $star,0,1;
- $arch = 'STAR';
- }
+ # re-insert quoted to KEYWORDS
+ s/(["']).*?["']/$1$quoted$1/;
- # remove keywords
- if ($leader eq '^') {
- if ($arch eq 'all') {
- $quoted = '';
+ print $_ or die "Can't write $f.new: $!\n";
} else {
- $quoted =~ s/[-~]?\Q$arch\E\b//;
+ print, next;
}
- }
-
- # add or modify keywords
- else {
- if ($arch eq 'all') {
- # modify all non-masked keywords in the list
- $quoted =~ s/(^|\s)~?(?=\w)/$1$leader/g;
- } else {
- # modify or add keyword
- unless ($quoted =~ s/[-~]?\Q$arch\E(\s|$)/$leader$arch$1/) {
- # modification failed, need to add
- if ($arch eq 'STAR') {
- $quoted = "$leader$arch $quoted";
- } else {
- $quoted .= " $leader$arch";
- }
- }
- }
- }
}
- # replace -STAR with -*
- $quoted =~ s/-STAR\b/-*/;
-
- # sort keywords and fix spacing
- $quoted = join " ", sort {
- (my $sa = $a) =~ s/^\W//;
- (my $sb = $b) =~ s/^\W//;
- return -1 if $sa eq '*';
- return +1 if $sb eq '*';
- $sa cmp $sb;
- } split " ", $quoted;
-
- # re-insert quoted to KEYWORDS
- s/(["']).*?["']/$1$quoted$1/;
+ close I;
+ close O;
+ select STDOUT;
- print $_, <I> or die "Can't write $f.new: $!\n";
- }
-
- close I;
- close O;
- select STDOUT;
+ system "diff -U 0 $f $f.new | sed -n '/KEYWORDS=/s:^: :p'";
+ rename "$f.new", "$f" or die "Can't rename: $!\n";
+ $files++;
+}
- system "diff $f $f.new | grep -v '^[0-1]'";
- rename "$f.new", "$f" or die "Can't rename: $!\n";
+if ($files == 0) {
+ die "No ebuilds processed!";
}
-# vim:ts=8 sw=4
+# vim:ts=4 sw=4
diff --git a/src/equery/equery b/src/equery/equery
index d5b5945..fd8fa4f 100755
--- a/src/equery/equery
+++ b/src/equery/equery
@@ -17,6 +17,7 @@ import os
import re
import sys
import time
+from glob import glob
# portage (output module) and gentoolkit need special path modifications
sys.path.insert(0, "/usr/lib/gentoolkit/pym")
@@ -529,6 +530,23 @@ class CmdDisplayUSEs(Command):
except IOError:
print_warn(5, "Could not load USE flag descriptions from " + ppath(gentoolkit.settings["PORTDIR"] + "/profiles/use.desc"))
+ # TODO: Add USE_EXPANDED variables to usedesc hash -- Bug #238005
+ # Pseudo-code:
+ # for all files in gentoolkit.settings["PORTDIR"]+"/desc/*.desc
+ # variable name = <filename>_<field1>
+ # description = <field 2>
+ for descfile in glob(gentoolkit.settings["PORTDIR"]+"/profiles/desc/*.desc"):
+ try:
+ fd = open(descfile)
+ for line in fd.readlines():
+ if line[0] == "#":
+ continue
+ fields = [field.strip() for field in line.split(" - ", 1)]
+ if len(fields) == 2:
+ usedesc["%s_%s" % (descfile.split("/")[-1][0:-5], fields[0],)] = fields[1]
+ except IOError:
+ print_warn(5, "Could not load USE flag descriptions from " + descfile)
+
# Load local USE flag descriptions
try:
fd = open(gentoolkit.settings["PORTDIR"]+"/profiles/use.local.desc")
@@ -1607,6 +1625,7 @@ class CmdFindUSEs(Command):
status = 2
useflags = pkg.get_env_var("IUSE").split()
+ useflags = [f.lstrip("+-") for f in useflags]
if query not in useflags:
continue
diff --git a/src/gentoolkit/helpers.py b/src/gentoolkit/helpers.py
index 1823f2c..4652b2d 100644
--- a/src/gentoolkit/helpers.py
+++ b/src/gentoolkit/helpers.py
@@ -130,7 +130,7 @@ def find_all_packages(prefilter=None):
for x in t:
t2 += porttree.dbapi.cp_list(x)
t2 += vartree.dbapi.cp_list(x)
- t2 = unique_array(t2)
+ t2 = unique_array(t2)
return [Package(x) for x in t2]
def split_package_name(name):
diff --git a/src/gentoolkit/package.py b/src/gentoolkit/package.py
index 3319860..4f28671 100644
--- a/src/gentoolkit/package.py
+++ b/src/gentoolkit/package.py
@@ -7,6 +7,7 @@
#
# $Header$
+import os
from errors import FatalError
import portage
from gentoolkit import *
@@ -25,6 +26,7 @@ class Package:
self._db = None
self._settings = settings
self._settingslock = settingslock
+ self._portdir_path = os.path.realpath(settings["PORTDIR"])
def get_name(self):
"""Returns base name of package, no category nor version"""
@@ -151,7 +153,7 @@ class Package:
def is_overlay(self):
"""Returns true if the package is in an overlay."""
dir,ovl = portage.portdb.findname2(self._cpv)
- return ovl != settings["PORTDIR"]
+ return ovl != self._portdir_path
def is_masked(self):
"""Returns true if this package is masked against installation. Note: We blindly assume that
diff --git a/src/gentoolkit/pprinter.py b/src/gentoolkit/pprinter.py
index 39665f8..ff92a26 100644
--- a/src/gentoolkit/pprinter.py
+++ b/src/gentoolkit/pprinter.py
@@ -33,7 +33,7 @@ def print_warn(s):
def die(err, s):
"""Print an error string and die with an error code."""
print_error(s)
- sys.exit(-err)
+ sys.exit(err)
# Colour settings
diff --git a/src/glsa-check/glsa-check b/src/glsa-check/glsa-check
index 98e5708..efb9e91 100644..100755
--- a/src/glsa-check/glsa-check
+++ b/src/glsa-check/glsa-check
@@ -82,10 +82,10 @@ try:
# sanity checking
if len(args) <= 0:
sys.stderr.write("no option given: what should I do ?\n")
- mode="help"
+ mode = "HELP"
elif len(args) > 1:
sys.stderr.write("please use only one command per call\n")
- mode = "help"
+ mode = "HELP"
else:
# in what mode are we ?
args = args[0]
@@ -96,32 +96,37 @@ try:
except GetoptError, e:
sys.stderr.write("unknown option given: ")
sys.stderr.write(str(e)+"\n")
- mode = "help"
+ mode = "HELP"
# we need a set of glsa for most operation modes
if len(params) <= 0 and mode in ["fix", "test", "pretend", "dump", "inject", "mail"]:
sys.stderr.write("\nno GLSA given, so we'll do nothing for now. \n")
sys.stderr.write("If you want to run on all GLSA please tell me so \n")
sys.stderr.write("(specify \"all\" as parameter)\n\n")
- mode = "help"
+ mode = "HELP"
elif len(params) <= 0 and mode == "list":
params.append("new")
# show help message
-if mode == "help":
- sys.stderr.write("\nSyntax: glsa-check <option> [glsa-list]\n\n")
+if mode == "help" or mode == "HELP":
+ msg = "Syntax: glsa-check <option> [glsa-list]\n\n"
for m in optionmap:
- sys.stderr.write(m[0] + "\t" + m[1] + " \t: " + m[-1] + "\n")
+ msg += m[0] + "\t" + m[1] + " \t: " + m[-1] + "\n"
for o in m[2:-1]:
- sys.stderr.write("\t" + o + "\n")
- sys.stderr.write("\nglsa-list can contain an arbitrary number of GLSA ids, \n")
- sys.stderr.write("filenames containing GLSAs or the special identifiers \n")
- sys.stderr.write("'all', 'new' and 'affected'\n")
- sys.exit(1)
+ msg += "\t" + o + "\n"
+ msg += "\nglsa-list can contain an arbitrary number of GLSA ids, \n"
+ msg += "filenames containing GLSAs or the special identifiers \n"
+ msg += "'all', 'new' and 'affected'\n"
+ if mode == "help":
+ sys.stdout.write(msg)
+ sys.exit(0)
+ else:
+ sys.stderr.write("\n" + msg)
+ sys.exit(1)
# we need root priviledges for write access
if mode in ["fix", "inject"] and os.geteuid() != 0:
- sys.stderr.write("\nThis tool needs root access to "+mode+" this GLSA\n\n")
+ sys.stderr.write(__program__ + ": root access is needed for \""+mode+"\" mode\n")
sys.exit(2)
# show version and copyright information
@@ -217,7 +222,7 @@ def summarylist(myglsalist, fd1=sys.stdout, fd2=sys.stderr):
fd1.write("... ")
else:
for pkg in myglsa.packages.keys():
- mylist = vardb.match(portage.dep_getkey(pkg))
+ mylist = vardb.match(portage.dep_getkey(str(pkg)))
if len(mylist) > 0:
pkg = color(" ".join(mylist))
fd1.write(" " + pkg + " ")
@@ -259,6 +264,8 @@ if mode in ["dump", "fix", "inject", "pretend"]:
exitcode >>= 8
if exitcode:
sys.exit(exitcode)
+ if len(mergelist):
+ sys.stdout.write("\n")
myglsa.inject()
elif mode == "pretend":
sys.stdout.write("Checking GLSA "+myid+"\n")
@@ -276,10 +283,10 @@ if mode in ["dump", "fix", "inject", "pretend"]:
sys.stdout.write(" " + pkg + " (" + oldver + ")\n")
else:
sys.stdout.write("Nothing to do for this GLSA\n")
+ sys.stdout.write("\n")
elif mode == "inject":
sys.stdout.write("injecting " + myid + "\n")
myglsa.inject()
- sys.stdout.write("\n")
sys.exit(0)
# test is a bit different as Glsa.test() produces no output
diff --git a/src/revdep-rebuild/revdep-rebuild b/src/revdep-rebuild/revdep-rebuild
index 3ffe904..5177a52 100755
--- a/src/revdep-rebuild/revdep-rebuild
+++ b/src/revdep-rebuild/revdep-rebuild
@@ -123,6 +123,7 @@ rm() {
eerror "I was instructed to rm '$@'"
die 1 "Refusing to delete anything before changing to temporary directory."
}
+: <<'EW'
##
# GNU find has -executable, but if our users' finds do not have that flag
# we emulate it with this function. Also emulates -writable and -readable.
@@ -158,6 +159,7 @@ find() {
fi
find "$@"
}
+EW
print_usage() {
cat << EOF
@@ -222,7 +224,7 @@ countdown() {
# Replace whitespace with linebreaks, normalize repeated '/' chars, and sort -u
# (If any libs have whitespace in their filenames, someone needs punishment.)
clean_var() {
- awk 'BEGIN {RS="[[:space:]]"}
+ gawk 'BEGIN {RS="[[:space:]]"}
/-\*/ {exit}
/[^[:space:]]/ {gsub(/\/\/+/, "/"); print}' | sort -u
}
@@ -264,7 +266,7 @@ normalize_emerge_opts() {
# Normalize some EMERGE_OPTIONS
EMERGE_OPTIONS=(${EMERGE_OPTIONS[@]/%-p/--pretend})
EMERGE_OPTIONS=(${EMERGE_OPTIONS[@]/%-f/--fetchonly})
- EMERGE_OPTIONS=(${EMERGE_OPTIONS[@]/%-f/--verbose})
+ EMERGE_OPTIONS=(${EMERGE_OPTIONS[@]/%-v/--verbose})
}
##
# Use the color preference from portage
@@ -633,8 +635,8 @@ get_files() {
findMask="${findMask[@]/#/-o -path }"
findMask="( ${findMask#-o } ) -prune -o"
fi
- # TODO: Check this
- find ${SEARCH_DIRS[@]} $findMask -type f \( -executable -o \
+ # TODO: Check this -- afaict SEARCH_DIRS isn't an array, so this should just be $SEARCH_DIRS?
+ find ${SEARCH_DIRS[@]} $findMask -type f \( -perm -u+x -o -perm -g+x -o -perm -o+x -o \
-name '*.so' -o -name '*.so.*' -o -name '*.la' \) -print 2> /dev/null |
sort -u > "$FILES_FILE" ||
die $? "find failed to list binary files (This is a bug.)"
@@ -735,18 +737,39 @@ main_checks() {
fi
elif [[ $SEARCH_BROKEN ]]; then
# Look for broken .la files
+ la_SEARCH_DIRS="$SEARCH_DIRS"
+ la_search_dir=""
+ la_broken=""
+ la_lib=""
for depend in $(
- awk -F"[=']" '/^dependency_libs/{
- gsub("^-[^[:space:]]*", "", $3);
- gsub("[[:space:]]-[^[:space:]]*", "", $3);
+ gawk -F"[=']" '/^dependency_libs/{
print $3
}' "$target_file"
); do
if [[ $depend = /* && ! -e $depend ]]; then
echo "obj $target_file" >> "$BROKEN_FILE"
echo_v " broken $target_file (requires $depend)"
+ elif [[ $depend = "-L/"* || $depend = "-R/"* ]]; then
+ if ! [[ $'\n'${la_SEARCH_DIRS}$'\n' == *$'\n'${depend#-?}$'\n'* ]]; then
+ la_SEARCH_DIRS+=$'\n'"${depend#-?}"
+ fi
+ elif [[ $depend = "-l"* ]]; then
+ la_lib="lib${depend#-l}"
+ la_broken="yes"
+ IFS=$'\n'
+ for la_search_dir in $la_SEARCH_DIRS; do
+ if [[ -e ${la_search_dir}/${la_lib}.so || -e ${la_search_dir}/${la_lib}.a ]]; then
+ la_broken="no"
+ fi
+ done
+ IFS="$OIFS"
+ if [[ $la_broken = yes ]]; then
+ echo "obj $target_file" >> "$BROKEN_FILE"
+ echo_v " broken $target_file (requires $depend)"
+ fi
fi
done
+ unset la_SEARCH_DIRS la_search_dir la_broken la_lib
fi
[[ $VERBOSE ]] &&
progress $((++i)) $numFiles $target_file ||
@@ -760,7 +783,7 @@ main_checks() {
done < <(
# Regexify LD_LIBRARY_MASK. Exclude it from the search.
LD_LIBRARY_MASK="${LD_LIBRARY_MASK//$'\n'/|}"
- awk -v ldmask="(${LD_LIBRARY_MASK//./\\\.})" '
+ gawk -v ldmask="(${LD_LIBRARY_MASK//./\\\.})" '
/no version information available/ && $0 !~ ldmask {
gsub(/[()]/, "", $NF)
if (seen[$NF]++) next
@@ -945,7 +968,7 @@ show_unowned_files() {
ewarn "The broken files are:"
while read filename junk; do
[[ $junk = *none* ]] && ewarn " $filename"
- done < "$OWNERS_FILE" | awk '!s[$0]++' # (omit dupes)
+ done < "$OWNERS_FILE" | gawk '!s[$0]++' # (omit dupes)
fi
}
##
@@ -1080,8 +1103,11 @@ cleanup() {
einfo 'Build finished correctly. Removing temporary files...'
einfo
einfo 'You can re-run revdep-rebuild to verify that all libraries and binaries'
- einfo 'are fixed. If some inconsistency remains, it can be orphaned file, deep'
- einfo 'dependency, binary package or specially evaluated library.'
+ einfo 'are fixed. Possible reasons for remaining inconsistencies include:'
+ einfo ' orphaned files'
+ einfo ' deep dependencies'
+ einfo " packages installed outside of portage's control"
+ einfo ' specially-evaluated libraries'
if [[ -r "$OWNERS_FILE" && -s "$OWNERS_FILE" ]]; then
show_unowned_files
fi
diff --git a/src/revdep-rebuild/revdep-rebuild.1 b/src/revdep-rebuild/revdep-rebuild.1
index 267f7f1..bcf1e26 100644
--- a/src/revdep-rebuild/revdep-rebuild.1
+++ b/src/revdep-rebuild/revdep-rebuild.1
@@ -91,6 +91,43 @@ To rebuild packages that depend upon libImlib.so and libImlib2.so:
.br
\fBrevdep\-rebuild \-\-library libImlib[2]*.so.*\fR
+.SH "FILES"
+.P
+revdep\-rebuild keeps several pseudo-temporary files in /var/cache/revdep\-rebuild/. Deleting these files can improve accuracy at the cost of speed:
+.TP 15
+.I 0_env.rr
+Contains environment variables
+.TP
+.I 1_files.rr
+Contains a list of files to search
+.TP
+.I 2_ldpath.rr
+Contains the LDPATH
+.TP
+.I 3_broken.rr
+Contains the list of broken files
+.TP
+.I 3_errors.rr
+Contains the ldd error output
+.TP
+.I 4_raw.rr
+Contains the raw list of packages
+.TP
+.I 4_owners.rr
+Contains the file owners
+.TP
+.I 4_pkgs.rr
+Contains the unsorted bare package names
+.TP
+.I 4_ebuilds.rr
+Contains the unsorted atoms
+.TP
+.I 5_order.rr
+Contains the sorted atoms
+.TP
+.I 6_status.rr
+Contains the ldd error output
+
.SH "EXIT STATUS"
revdep\-rebuild returns a zero exit status if it \fBand emerge\fR succeeds, and a nonzero exit status otherwise.
.SH "BUGS"