summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2001-02-19 14:57:00 +0000
committerFrancois Pons <fpons@mandriva.com>2001-02-19 14:57:00 +0000
commit6ddaba111cd902eca907f80d3fb13ee5807be4f4 (patch)
treee524564f8c72718c2bc2b5a4363748c6cc4d0c71
parent455e08ae4e2cd042766999d9948744fa45ff12b1 (diff)
downloadurpmi-6ddaba111cd902eca907f80d3fb13ee5807be4f4.tar
urpmi-6ddaba111cd902eca907f80d3fb13ee5807be4f4.tar.gz
urpmi-6ddaba111cd902eca907f80d3fb13ee5807be4f4.tar.bz2
urpmi-6ddaba111cd902eca907f80d3fb13ee5807be4f4.tar.xz
urpmi-6ddaba111cd902eca907f80d3fb13ee5807be4f4.zip
*** empty log message ***
-rw-r--r--urpm.pm61
-rwxr-xr-xurpmi2
-rw-r--r--urpmi.spec9
3 files changed, 51 insertions, 21 deletions
diff --git a/urpm.pm b/urpm.pm
index 912d3aca..dfb8477d 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -771,7 +771,24 @@ sub search_packages {
} else {
my $l = $found{$_} || $foundi{$_};
if (@{$l || []} == 0) {
- $urpm->{error}(sprintf("no package named %s\n", $_)); $result = 0;
+ my ($name, $version, $release) = /(.*)-([^-]*)-([^-]*)/;
+ $urpm->{params}{info}{$1} or ($name, $version, $release) = /(.*)-([^-]*)/;
+ $urpm->{params}{info}{$1} or ($name, $version, $release) = ();
+ if ($name) {
+ my $ipkg;
+ foreach (0..$#{$urpm->{params}{depslist}}) {
+ my $pkg = $urpm->{params}{depslist}[$_];
+ if ($pkg->{name} eq $name && $pkg->{version} eq $version && $pkg->{release} eq $release) {
+ $packages->{$_} = undef;
+ $ipkg = $_;
+ last;
+ }
+ }
+ defined $ipkg or ($name, $version, $release) = ();
+ }
+ unless ($name) {
+ $urpm->{error}(sprintf("no package named %s\n", $_)); $result = 0;
+ }
} elsif (@$l > 1 && !$options{all}) {
$urpm->{error}(sprintf("The following packages contain %s: %s\n", $_, join(' ', map { $_->{name} } @$l))); $result = 0;
} else {
@@ -924,6 +941,10 @@ sub filter_packages_to_upgrade {
$packages;
}
+#- filter minimal list, upgrade packages only according to rpm requires
+#- satisfied, remove upgrade for package already installed or with a better
+#- version, try to upgrade to minimize upgrade errors.
+#- all additional package selected have a true value.
sub filter_minimal_packages_to_upgrade {
my ($urpm, $packages, $select_choices, %options) = @_;
@@ -977,13 +998,14 @@ sub filter_minimal_packages_to_upgrade {
my @selection = $select_choices ? ($select_choices->($urpm, @$id)) : ($id->[0]);
foreach (@selection) {
unshift @packages, $_;
- $packages->{$_} = undef;
+ exists $packages->{$_} or $packages->{$_} = 1;
}
}
my $pkg = $urpm->{params}{depslist}[$id];
#- search for package that will be upgraded, and check the difference
#- of provides to see if something will be altered and need to be upgraded.
+ #- this is bogus as it only take care of == operator if any.
my %diffprovides;
rpmtools::db_traverse_tag($db,
'name', [ $pkg->{name} ],
@@ -992,15 +1014,21 @@ sub filter_minimal_packages_to_upgrade {
foreach (@{$p->{provides}}) {
s/\[\*\]//;
s/\[([^\]]*)\]/ $1/;
- $diffprovides{$_} = "$p->{name}-$p->{version}-$p->{release}";
+ /^(\S*\s*\S*\s*)(\d+:)?([^\s-]*)(-?\S*)/;
+ foreach ($_, "$1$3", "$1$2$3", "$1$3$4") {
+ $diffprovides{$_} = "$p->{name}-$p->{version}-$p->{release}";
+ }
}
});
$ask_child->("$pkg->{name}-$pkg->{version}-$pkg->{release}", "provides", sub {
- delete $diffprovides{$_};
+ /^(\S*\s*\S*\s*)(\d+:)?([^\s-]*)-?\S*/;
+ foreach ($_, "$1$3", "$1$2$3", "$1$3$4") {
+ delete $diffprovides{$_};
+ }
});
foreach (keys %diffprovides) {
#- check for exact match on it.
- if (/^(\S*)\s*(\S*)\s*([^\s-]*)-?(\S*)/) {
+ if (/^(\S*)\s*(\S*)\s*(\d+:)?([^\s-]*)-?(\S*)/) {
rpmtools::db_traverse_tag($db,
'whatrequires', [ $1 ],
[ qw(name version release sense requires) ], sub{
@@ -1036,18 +1064,16 @@ sub filter_minimal_packages_to_upgrade {
$provides{$_} and next;
my (@choices, @upgradable_choices);
foreach (@{$urpm->{params}{provides}{$_}}) {
+ #- prefer upgrade package that need to be upgraded, if they are present in the choice.
my $pkg = $urpm->{params}{info}{$_};
- #if (! exists $packages->{$pkg->{id}}) {
- #- prefer upgrade package that need to be upgraded, if they are present in the choice.
- push @choices, $pkg;
- rpmtools::db_traverse_tag($db,
- 'name', [ $_ ],
- [ qw(name version release) ], sub {
- my ($p) = @_;
- my $cmp = rpmtools::version_compare($pkg->{version}, $p->{version});
- $installed{$pkg->{id}} ||= !($cmp > 0 || $cmp == 0 && rpmtools::version_compare($pkg->{release}, $p->{release}) > 0)
- });
- #}
+ push @choices, $pkg;
+ rpmtools::db_traverse_tag($db,
+ 'name', [ $_ ],
+ [ qw(name version release) ], sub {
+ my ($p) = @_;
+ my $cmp = rpmtools::version_compare($pkg->{version}, $p->{version});
+ $installed{$pkg->{id}} ||= !($cmp > 0 || $cmp == 0 && rpmtools::version_compare($pkg->{release}, $p->{release}) > 0)
+ });
$installed{$pkg->{id}} and delete $packages->{$pkg->{id}};
if (exists $packages->{$pkg->{id}} || $installed{$pkg->{id}}) {
#- the package is already selected, or installed with a better version and release.
@@ -1059,7 +1085,7 @@ sub filter_minimal_packages_to_upgrade {
@upgradable_choices > 0 and @choices = @upgradable_choices;
if (@choices > 0) {
if (@choices == 1) {
- $packages->{$choices[0]{id}} = undef;
+ exists $packages->{$choices[0]{id}} or $packages->{$choices[0]{id}} = 1;
unshift @packages, $choices[0]{id};
} else {
push @packages, [ sort { $a->{id} <=> $b->{id} } @choices ];
@@ -1082,7 +1108,6 @@ sub filter_minimal_packages_to_upgrade {
exec "parsehdlist", "--interactive", map { "$urpm->{statedir}/$_->{hdlist}" } grep { ! $_->{ignore} } @{$urpm->{media}}
or rpmtools::_exit(1);
}
-
}
#- select source for package selected.
diff --git a/urpmi b/urpmi
index b7526097..bf550956 100755
--- a/urpmi
+++ b/urpmi
@@ -200,7 +200,7 @@ foreach (keys %packages) {
}
if (!$auto) {
if ($ask_user) {
- my $msg = ( _("To satisfy dependencies, the following packages are going to be installed (%d MB)"), toMb($sum));
+ my $msg = sprintf(_("To satisfy dependencies, the following packages are going to be installed (%d MB)"), toMb($sum));
my $msg2 = _("Is it ok?");
if ($X) {
my $p = join "\n", @to_install;
diff --git a/urpmi.spec b/urpmi.spec
index 51d2138e..ebee155b 100644
--- a/urpmi.spec
+++ b/urpmi.spec
@@ -2,7 +2,7 @@
Name: urpmi
Version: 1.5
-Release: 4mdk
+Release: 5mdk
License: GPL
Source0: %{name}.tar.bz2
Summary: User mode rpm install
@@ -75,8 +75,8 @@ fi
exit 0
%post
+[ -z "$DURING_INSTALL" -a -f /var/lig/urpmi/depslist ] && %{_sbindir}/urpmi.update -a
rm -f /var/lib/urpmi/depslist
-[ -z "$DURING_INSTALL" ] && %{_sbindir}/urpmi.update -a
%preun -n autoirpm
autoirpm.uninstall
@@ -113,6 +113,11 @@ autoirpm.uninstall
%changelog
+* Mon Feb 19 2001 François Pons <fpons@mandrakesoft.com> 1.5-5mdk
+- fixed -m mode for prompting user if needed.
+- fixed -m mode with depandancies resolving.
+- avoid update urpmi db except if old urpmi.
+
* Fri Feb 16 2001 François Pons <fpons@mandrakesoft.com> 1.5-4mdk
- fixed -m mode with failed depandancies.