diff options
-rw-r--r-- | urpm.pm | 44 | ||||
-rw-r--r-- | urpmi.spec | 5 |
2 files changed, 42 insertions, 7 deletions
@@ -86,7 +86,7 @@ sub read_config { my ($urpm) = @_; #- keep in mind if it has been called before. - $urpm->{media} ||= []; + $urpm->{media} and return; $urpm->{media} ||= []; #- check urpmi.cfg content, if the file is old keep track #- of old format used. @@ -982,18 +982,51 @@ sub filter_minimal_packages_to_upgrade { } 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. + my %diffprovides; + rpmtools::db_traverse_tag($db, + 'name', [ $pkg->{name} ], + [ qw(name version release sense provides) ], sub { + my ($p) = @_; + foreach (@{$p->{provides}}) { + s/\[\*\]//; + s/\[([^\]]*)\]/ $1/; + $diffprovides{$_} = "$p->{name}-$p->{version}-$p->{release}"; + } + }); + $ask_child->("$pkg->{name}-$pkg->{version}-$pkg->{release}", "provides", sub { + delete $diffprovides{$_}; + }); + foreach (keys %diffprovides) { + #- check for exact match on it. + if (/^(\S*)\s*(\S*)\s*([^\s-]*)-?(\S*)/) { + rpmtools::db_traverse_tag($db, + 'whatrequires', [ $1 ], + [ qw(name version release sense requires) ], sub{ + my ($p) = @_; + foreach (@{$p->{requires}}) { + s/\[\*\]//; + s/\[([^\]]*)\]/ $1/; + exists $diffprovides{$_} and $provides{$p->{name}} = undef; + } + }); + } + } + #- iterate over requires of the packages, register them. + $provides{$pkg->{name}} = undef; $ask_child->("$pkg->{name}-$pkg->{version}-$pkg->{release}", "requires", sub { if ($_[0] =~ /^(\S*)\s*(\S*)\s*([^\s-]*)-?(\S*)/) { exists $provides{$1} and return; rpmtools::db_traverse_tag($db, 'whatprovides', [ $1 ], [ qw (name version release) ], sub { + $provides{$1} ||= undef; $3 and eval(rpmtools::version_compare($_[0]{version}, $3) . $2 . 0) || return; $4 and eval(rpmtools::version_compare($_[0]{release}, $4) . $2 . 0) || return; - print STDERR "providing [$1] as $_[0]{name}-$_[0]{version}-$_[0]{release}\n"; $provides{$1} = "$_[0]{name}-$_[0]{version}-$_[0]{release}"; - }) or $provides{$1} = undef; + }); } }); @@ -1001,11 +1034,10 @@ sub filter_minimal_packages_to_upgrade { #- provides files, try to minimize choice at this level. foreach (keys %provides) { $provides{$_} and next; - print STDERR "trying to resolve [$_]\n"; my (@choices, @upgradable_choices); foreach (@{$urpm->{params}{provides}{$_}}) { my $pkg = $urpm->{params}{info}{$_}; - if (! exists $packages->{$pkg->{id}}) { + #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, @@ -1015,7 +1047,7 @@ sub filter_minimal_packages_to_upgrade { 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. @@ -2,7 +2,7 @@ Name: urpmi Version: 1.5 -Release: 3mdk +Release: 4mdk License: GPL Source0: %{name}.tar.bz2 Summary: User mode rpm install @@ -113,6 +113,9 @@ autoirpm.uninstall %changelog +* Fri Feb 16 2001 François Pons <fpons@mandrakesoft.com> 1.5-4mdk +- fixed -m mode with failed depandancies. + * Fri Feb 16 2001 François Pons <fpons@mandrakesoft.com> 1.5-3mdk - added -m flag to urpmi for minimal upgrade. - fixed urpmq olding approach of local rpm (added --force too |