summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-11-15 10:24:20 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-11-15 10:24:20 +0000
commit9b4d2a055a190d5f110acb9233d503b4c9498c81 (patch)
tree85424665fa3d35d3654209b471b4963fda4a6998
parent5d6d890b544246a36caa4d13a8a4b1e8c1287ac9 (diff)
downloadurpmi-9b4d2a055a190d5f110acb9233d503b4c9498c81.tar
urpmi-9b4d2a055a190d5f110acb9233d503b4c9498c81.tar.gz
urpmi-9b4d2a055a190d5f110acb9233d503b4c9498c81.tar.bz2
urpmi-9b4d2a055a190d5f110acb9233d503b4c9498c81.tar.xz
urpmi-9b4d2a055a190d5f110acb9233d503b4c9498c81.zip
Display a README.urpmi only once. It could be displayed twice if the end of
installation callback was called twice, which happens when a package has both post and posttrans hooks.
-rw-r--r--urpm.pm14
1 files changed, 6 insertions, 8 deletions
diff --git a/urpm.pm b/urpm.pm
index cb8b8bb8..29459d3c 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -2925,7 +2925,7 @@ sub install_logger {
#- install packages according to each hash (remove, install or upgrade).
sub install {
my ($urpm, $remove, $install, $upgrade, %options) = @_;
- my @readmes;
+ my %readmes;
#- allow process to be forked now.
my $pid;
@@ -3022,9 +3022,7 @@ sub install {
my $pkg = $urpm->{depslist}[$pkgid];
my $fullname = $pkg->fullname;
my $trtype = (grep { /$fullname/ } values %$install) ? 'install' : '(upgrade|update)';
- push @readmes, map { [ $_, $fullname ] } grep {
- /\bREADME(\.$trtype)?\.urpmi$/;
- } $pkg->files;
+ for ($pkg->files) { /\bREADME(\.$trtype)?\.urpmi$/ and $readmes{$_} = $fullname }
close $fh if defined $fh;
};
if (scalar keys %$install || scalar keys %$upgrade) {
@@ -3059,10 +3057,10 @@ sub install {
#- keep safe exit now (with destructor call).
exit 0;
} else { #- parent process
- if (@readmes) {
- foreach (@readmes) {
- print "-" x 70, "\n", N("More information on package %s", $_->[1]), "\n";
- my $fh; open $fh, '<', $_->[0] and do {
+ if (keys %readmes) {
+ foreach (keys %readmes) {
+ print "-" x 70, "\n", N("More information on package %s", $readmes{$_}), "\n";
+ my $fh; open $fh, '<', $_ and do {
print while <$fh>;
close $fh;
};