diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2007-08-03 14:14:28 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2007-08-03 14:14:28 +0000 |
commit | 49ae8a7ea7b7a258bf6a56377b50d49892b4377e (patch) | |
tree | 31ec618eab6d0d58ab995197986276a956d3dfd9 /urpm/install.pm | |
parent | def94be0af851c56224faa669131439fffe6fb7c (diff) | |
download | urpmi-49ae8a7ea7b7a258bf6a56377b50d49892b4377e.tar urpmi-49ae8a7ea7b7a258bf6a56377b50d49892b4377e.tar.gz urpmi-49ae8a7ea7b7a258bf6a56377b50d49892b4377e.tar.bz2 urpmi-49ae8a7ea7b7a258bf6a56377b50d49892b4377e.tar.xz urpmi-49ae8a7ea7b7a258bf6a56377b50d49892b4377e.zip |
- urpmi
o handle README.<version>.upgrade.urpmi and
README.<version>-<release>.upgrade.urpmi: the content is displayed
when upgrading from rpm older than <version> (#30187)
- fix build of some test rpms
Diffstat (limited to 'urpm/install.pm')
-rw-r--r-- | urpm/install.pm | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/urpm/install.pm b/urpm/install.pm index 29821e90..5f960b0d 100644 --- a/urpm/install.pm +++ b/urpm/install.pm @@ -95,10 +95,33 @@ sub install_logger { } sub get_README_files { - my ($urpm, $pkg) = @_; - my $fullname = $pkg->fullname; - my $trtype = $pkg->flag_installed ? '(upgrade|update)' : 'install'; - foreach ($pkg->files) { /\bREADME(\.$trtype)?\.urpmi$/ and $urpm->{readmes}{$_} = $fullname } + my ($urpm, $trans, $pkg) = @_; + + foreach my $file ($pkg->files) { + my ($kind) = $file =~ m!/README([^/]*)\.urpmi$! or next; + my $valid; + if ($kind eq '') { + $valid = 1; + } elsif ($kind eq '.install' && !$pkg->flag_installed) { + $valid = 1; + } elsif ($kind =~ /(.*)\.(upgrade|update)$/ && $pkg->flag_installed) { + if (!$1) { + $valid = 1; + } else { + my $version = $1; + foreach my $i (0 .. $trans->NElements - 1) { + $trans->Element_name($i) eq $pkg->name or next; + + my $vr = $trans->Element_version($i) . '-' . $trans->Element_release($i); + if (URPM::ranges_overlap("== $vr", "< $version")) { + $valid = 1; + last; + } + } + } + } + $valid and $urpm->{readmes}{$file} = $pkg->fullname; + } } #- install packages according to each hash (remove, install or upgrade). @@ -168,7 +191,7 @@ sub install { $options{callback_close} = sub { my ($urpm, undef, $pkgid) = @_; return unless defined $pkgid; - get_README_files($urpm, $urpm->{depslist}[$pkgid]); + get_README_files($urpm, $trans, $urpm->{depslist}[$pkgid]); close $fh if defined $fh; }; $options{callback_uninst} = sub { |