diff options
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | t/data/SPECS/README-urpmi/a.spec | 4 | ||||
-rw-r--r-- | t/data/SPECS/README-urpmi/b.spec | 6 | ||||
-rw-r--r-- | t/data/SPECS/README-urpmi/b_2.spec | 3 | ||||
-rw-r--r-- | t/data/SPECS/README-urpmi/b_3.spec | 24 | ||||
-rw-r--r-- | t/data/SPECS/README-urpmi/c.spec | 4 | ||||
-rw-r--r-- | t/data/SPECS/README-urpmi/d.spec | 4 | ||||
-rw-r--r-- | t/superuser--README-urpmi.t | 7 | ||||
-rw-r--r-- | urpm/install.pm | 33 |
9 files changed, 72 insertions, 17 deletions
@@ -1,3 +1,7 @@ +- 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) - urpmf o handle --license - urpmi.update diff --git a/t/data/SPECS/README-urpmi/a.spec b/t/data/SPECS/README-urpmi/a.spec index d15019af..cd2edfc6 100644 --- a/t/data/SPECS/README-urpmi/a.spec +++ b/t/data/SPECS/README-urpmi/a.spec @@ -10,8 +10,8 @@ BuildRoot: %{_tmppath}/%{name} %description x -%build -rm -rf $RPM_BUILD_ROOT +%prep +rm -rf * echo "installing/upgrading %name" > README.urpmi %clean diff --git a/t/data/SPECS/README-urpmi/b.spec b/t/data/SPECS/README-urpmi/b.spec index 5c7cb4f4..0783995f 100644 --- a/t/data/SPECS/README-urpmi/b.spec +++ b/t/data/SPECS/README-urpmi/b.spec @@ -10,8 +10,8 @@ BuildRoot: %{_tmppath}/%{name} %description x -%build -rm -rf $RPM_BUILD_ROOT +%prep +rm -rf * echo "installing %name" > README.install.urpmi echo "upgrading %name" > README.upgrade.urpmi @@ -20,4 +20,4 @@ rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) -%doc README.install.urpmi README.upgrade.urpmi +%doc README.* diff --git a/t/data/SPECS/README-urpmi/b_2.spec b/t/data/SPECS/README-urpmi/b_2.spec index 15a63678..0f8a0314 100644 --- a/t/data/SPECS/README-urpmi/b_2.spec +++ b/t/data/SPECS/README-urpmi/b_2.spec @@ -14,10 +14,11 @@ x rm -rf $RPM_BUILD_ROOT echo "installing %name" > README.install.urpmi echo "upgrading %name" > README.upgrade.urpmi +echo "upgrading %name 2" > README.2.upgrade.urpmi %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) -%doc README.install.urpmi README.upgrade.urpmi +%doc README.* diff --git a/t/data/SPECS/README-urpmi/b_3.spec b/t/data/SPECS/README-urpmi/b_3.spec new file mode 100644 index 00000000..bab276a0 --- /dev/null +++ b/t/data/SPECS/README-urpmi/b_3.spec @@ -0,0 +1,24 @@ +Summary: b +Name: b +Version: 3 +Release: 1 +License: x +Group: x +Url: x +BuildRoot: %{_tmppath}/%{name} + +%description +x + +%build +rm -rf $RPM_BUILD_ROOT +echo "installing %name" > README.install.urpmi +echo "upgrading %name" > README.upgrade.urpmi +echo "upgrading %name 2" > README.2.upgrade.urpmi + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-,root,root) +%doc README.* diff --git a/t/data/SPECS/README-urpmi/c.spec b/t/data/SPECS/README-urpmi/c.spec index 25f4df37..3da1dcde 100644 --- a/t/data/SPECS/README-urpmi/c.spec +++ b/t/data/SPECS/README-urpmi/c.spec @@ -11,8 +11,8 @@ Conflicts: a %description x -%build -rm -rf $RPM_BUILD_ROOT +%prep +rm -rf * echo "installing %name" > README.install.urpmi echo "upgrading %name" > README.upgrade.urpmi diff --git a/t/data/SPECS/README-urpmi/d.spec b/t/data/SPECS/README-urpmi/d.spec index 2f7d40de..50bffd18 100644 --- a/t/data/SPECS/README-urpmi/d.spec +++ b/t/data/SPECS/README-urpmi/d.spec @@ -10,8 +10,8 @@ BuildRoot: %{_tmppath}/%{name} %description x -%build -rm -rf $RPM_BUILD_ROOT +%prep +rm -rf * echo "installing/upgrading %name" > README.urpmi %clean diff --git a/t/superuser--README-urpmi.t b/t/superuser--README-urpmi.t index 70633c9c..d8d54fc9 100644 --- a/t/superuser--README-urpmi.t +++ b/t/superuser--README-urpmi.t @@ -25,6 +25,7 @@ sub test_a { sub test_b { system_("rpm --root $::pwd/root -i media/$medium_name/b-1-*.rpm"); + test_urpmi('b-2', 'upgrading b', 'upgrading b 2'); test_urpmi('b', 'upgrading b'); check_installed_and_remove('b'); } @@ -41,12 +42,14 @@ sub test_d { } sub test_urpmi { - my ($para, $wanted) = @_; + my ($para, @wanted) = @_; my $urpmi = urpmi_cmd(); print "# $urpmi $para\n"; my $s = `$urpmi $para`; print $s; - my ($msg) = $s =~ /\nMore information on package[^\n]*\n(.*?)\n-{70}/ms; + my @msgs = $s =~ /\nMore information on package[^\n]*\n(.*?)\n-{70}/msg; + my $msg = join(" -- ", sort @msgs); + my $wanted = join(" -- ", sort @wanted); ok($msg eq $wanted, "wanted:$wanted, got:$msg"); } 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 { |