From ab6ad72f9f7379713af3cb358d2f829acebed5c4 Mon Sep 17 00:00:00 2001 From: Francois Pons Date: Mon, 2 Jul 2001 12:40:31 +0000 Subject: 1.6-8mdk --- urpm.pm | 60 +++++++++++++++++++++++++++++++++++++--------------------- urpmi.addmedia | 5 +++-- urpmi.spec | 10 ++++++++-- 3 files changed, 49 insertions(+), 26 deletions(-) diff --git a/urpm.pm b/urpm.pm index 30ca038d..2b6b16e2 100644 --- a/urpm.pm +++ b/urpm.pm @@ -837,22 +837,20 @@ sub filter_active_media { #- reorder info hashes to give only access to best packages. sub relocate_depslist { my ($urpm, %options) = @_; - my $relocated_entries = 0; + my $relocated_entries = undef; foreach (@{$urpm->{params}{depslist} || []}) { - #- disable non active package if active flag should be checked. if ($options{use_active} && !$_->{active}) { + #- disable non active package if active flag should be checked. $urpm->{params}{info}{$_->{name}} == $_ and delete $urpm->{params}{info}{$_->{name}}; - next; - } - - if ($urpm->{params}{info}{$_->{name}} != $_) { + } elsif ($urpm->{params}{info}{$_->{name}} != $_) { #- at this point, it is sure there is a package that #- is multiply defined and this should be fixed. #- remove access to info if arch is incompatible and only #- take into account compatible arch to examine. #- correct info hash by prefering first better version, #- then better release, then better arch. + $relocated_entries ||= 0; my $p = $urpm->{params}{info}{$_->{name}}; if ($p && (!rpmtools::compat_arch($p->{arch}) || $options{use_active} && !$p->{active})) { delete $urpm->{params}{info}{$_->{name}}; @@ -878,13 +876,17 @@ sub relocate_depslist { #- relocate id used in depslist array, delete id if the package #- should NOT be used. - if ($relocated_entries) { + if (defined $relocated_entries) { foreach (@{$urpm->{params}{depslist}}) { - $_->{source} and next; #- hack to avoid losing local package. - if (defined $urpm->{params}{info}{$_->{name}}) { - $_->{id} = $urpm->{params}{info}{$_->{name}}{id}; - } else { - delete $_->{id}; + unless ($_->{source}) { #- hack to avoid losing local package. + my $p = $urpm->{params}{info}{$_->{name}}; + if (defined $p) { + if ($_->{id} != $p->{id}) { + $p->{relocated} .= " $_->{id}"; + } + } else { + delete $_->{id}; + } } } } @@ -1014,7 +1016,8 @@ sub search_packages { if ($best) { my $cmp_version = ($_->{info}{serial} == $best->{info}{serial} && rpmtools::version_compare($_->{info}{version}, $best->{info}{version})); - my $cmp_release = $cmp_version == 0 && version_compare($_->{info}{release}, $best->{info}{release}); + my $cmp_release = $cmp_version == 0 && rpmtools::version_compare($_->{info}{release}, + $best->{info}{release}); if ($_->{info}{serial} > $best->{info}{serial} || $cmp_version > 0 || $cmp_release > 0 || ($_->{info}{serial} == $best->{info}{serial} && $cmp_version == 0 && $cmp_release == 0 && better_arch($_->{info}{arch}, $best->{info}{arch}))) { @@ -1214,11 +1217,13 @@ sub filter_minimal_packages_to_upgrade { foreach (@{$info{provides}}) { if (/(\S*)\s*==\s*(?:\d+:)?([^-]*)-([^-]*)/ && $info{name} eq $1) { $found = $urpm->{params}{info}{$info{name}}; - if ($found->{version} eq $2 && $found->{release} eq $3) { - foreach (keys %info) { - $urpm->{params}{info}{$info{name}}{$_} ||= $info{$_}; + foreach ($found, map { $urpm->{params}{depslist}[$_] } split ' ', $found->{relocated}) { + if ($_->{version} eq $2 && $_->{release} eq $3) { + foreach my $tag (keys %info) { + $_->{$tag} ||= $info{$tag}; + } + return 1; #- we have found the right info. } - return 1; #- we have found the right info. } } } @@ -1254,8 +1259,15 @@ sub filter_minimal_packages_to_upgrade { my ($name, $tag, $code) = @_; $code or die "no callback code for parsehdlist output"; if ($pid == 1) { - $urpm->{params}{info}{$name} or $name =~ s/(.*)-[^-]+-[^-]+$/$1/; - foreach (@{$urpm->{params}{info}{$name}{$tag} || []}) { + my $p = $urpm->{params}{info}{$name}; + if (!$p && $name =~ /(.*)-([^\-]*)-([^\-]*)\.([^\-\.]*)$/) { + foreach ($urpm->{params}{info}{$1}{id}, split ' ', $urpm->{params}{info}{$1}{relocated}) { + $p = $urpm->{params}{depslist}[$_]; + $p->{version} eq $2 && $p->{release} eq $3 && $p->{arch} eq $4 and last; + $p = undef; + } + } + foreach (@{$p->{$tag} || []}) { $code->($_); } } else { @@ -1316,7 +1328,7 @@ sub filter_minimal_packages_to_upgrade { } } }); - $ask_child->("$pkg->{name}-$pkg->{version}-$pkg->{release}", "provides", sub { + $ask_child->("$pkg->{name}-$pkg->{version}-$pkg->{release}.$pkg->{arch}", "provides", sub { $_[0] =~ /^(\S*\s*\S*\s*)(\d+:)?([^\s-]*)(-?\S*)/; foreach ($_[0], "$1$3", "$1$2$3", "$1$3$4") { delete $diffprovides{$_[0]}; @@ -1344,8 +1356,8 @@ sub filter_minimal_packages_to_upgrade { } #- iterate over requires of the packages, register them. - $provides{$pkg->{name}} = undef; - $ask_child->("$pkg->{name}-$pkg->{version}-$pkg->{release}", "requires", sub { + $provides{$pkg->{name}} = undef; #"$pkg->{name}-$pkg->{version}-$pkg->{release}"; + $ask_child->("$pkg->{name}-$pkg->{version}-$pkg->{release}.$pkg->{arch}", "requires", sub { if ($_[0] =~ /^(\S*)\s*(\S*)\s*([^\s\-]*)-?(\S*)/) { exists $provides{$1} and return; #- if the provides is not found, it will be resolved at next step, else @@ -1371,6 +1383,10 @@ sub filter_minimal_packages_to_upgrade { 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 (my @best = grep { exists $packages->{$_->{id}} } + ($pkg, map { $urpm->{params}{depslist}[$_] } split ' ', $pkg->{relocated})) { + $pkg = $best[0]; #- keep already requested packages. + } push @choices, $pkg; rpmtools::db_traverse_tag($db, 'name', [ $_ ], diff --git a/urpmi.addmedia b/urpmi.addmedia index 9e5a9e7a..c08e5214 100755 --- a/urpmi.addmedia +++ b/urpmi.addmedia @@ -26,7 +26,8 @@ import urpm _; sub main { my ($name, $url, $with, $relative_hdlist) = @_; - my $usage = _("usage: urpmi.addmedia + $name =~ /^--?update/ and (my $update, $name, $url, $with, $relative_hdlist) = @_; + my $usage = _("usage: urpmi.addmedia [--update] where is one of file:// ftp://:@/ with @@ -48,7 +49,7 @@ where is one of my $urpm = new urpm; $urpm->read_config; - $urpm->add_medium($name, $url, $relative_hdlist); + $urpm->add_medium($name, $url, $relative_hdlist, update => $update); $urpm->update_media(noclean => 1); #- check creation of media (during update has been successfull) diff --git a/urpmi.spec b/urpmi.spec index 7f9dc5d9..0e3f36de 100644 --- a/urpmi.spec +++ b/urpmi.spec @@ -2,12 +2,12 @@ Name: urpmi Version: 1.6 -Release: 7mdk +Release: 8mdk License: GPL Source0: %{name}.tar.bz2 Summary: User mode rpm install Requires: eject, wget -PreReq: perl-gettext, rpmtools >= 2.3-25mdk +PreReq: perl-gettext, rpmtools >= 3.0-7mdk BuildRequires: libbzip2-devel rpm-devel BuildRoot: %{_tmppath}/%{name}-buildroot @@ -106,6 +106,12 @@ rm -f /var/lib/urpmi/depslist %changelog +* Mon Jul 2 2001 François Pons 1.6-8mdk +- fixed typo by pixel. +- fixed bad reference in urpm reported by Michael Reinsch. +- fixed dependencies for closure with old packages. +- added --update flag to urpmi.addmedia + * Thu Jun 28 2001 François Pons 1.6-7mdk - added update flag to medium. - fixed -M algortihms with epoch (serial) uses. -- cgit v1.2.1