From d11c39e4ab87021174b797ba52eeddbf66a9aed6 Mon Sep 17 00:00:00 2001 From: Francois Pons Date: Mon, 22 Jul 2002 08:40:00 +0000 Subject: 3.8-3mdk --- urpm.pm | 38 ++++++++++++++++++++++++++------------ urpmi | 15 +++++++++------ urpmi.spec | 8 ++++++-- 3 files changed, 41 insertions(+), 20 deletions(-) diff --git a/urpm.pm b/urpm.pm index 0569ebb5..68f4cbe7 100644 --- a/urpm.pm +++ b/urpm.pm @@ -1417,8 +1417,8 @@ sub search_packages { if ($options{use_provides}) { unless ($options{fuzzy}) { #- try to search through provides. - if (my @l = grep { defined $_ } map { $_ && ($options{src} ? $_->arch eq 'src' : $_->is_arch_compat) && - $_->id || undef } map { $urpm->{depslist}[$_] } + if (my @l = grep { defined $_ } map { $_ && ($options{src} ? $_->arch eq 'src' : $_->is_arch_compat) ? + $_->id : undef } map { $urpm->{depslist}[$_] } keys %{$urpm->{provides}{$v} || {}}) { #- we assume that if the there is at least one package providing the resource exactly, #- this should be the best ones that is described. @@ -1840,17 +1840,31 @@ sub install { $pkg->update_header($upgrade->{$_}); $trans->add($pkg, 1) or $urpm->{error}(_("unable to install package %s", $upgrade->{$_})); } - !$options{nodeps} and @l = $trans->check and return @l; + if (!$options{nodeps} and @l = $trans->check) { + if ($options{translate_message}) { + foreach (@l) { + my ($type, $needs, $conflicts) = split '@', $_; + $_ = ($type eq 'requires' ? + _("%s is needed by %s", $needs, $conflicts) : + _("%s conflicts with %s", $needs, $conflicts)); + } + } + return @l; + } !$options{noorder} and @l = $trans->order and return @l; - @l = $trans->run($urpm, force => $options{force}, nosize => $options{nosize}, delta => 1000, callback_open => sub { - my ($data, $type, $id) = @_; - open F, $install->{$id} || $upgrade->{$id} or - $urpm->{error}(_("unable to access rpm file [%s]", $install->{$id} || $upgrade->{$id})); - return fileno F; - }, callback_close => sub { - my ($data, $type, $id) = @_; - close F; - }, callback_inst => \&install_logger, callback_trans => \&install_logger); + + #- assume default value for some parameter. + $options{delta} ||= 1000; + $options{callback_open} ||= sub { + my ($data, $type, $id) = @_; + open F, $install->{$id} || $upgrade->{$id} or + $urpm->{error}(_("unable to access rpm file [%s]", $install->{$id} || $upgrade->{$id})); + return fileno F; + }; + $options{callback_close} ||= sub { close F }; + $options{callback_inst} ||= \&install_logger; + $options{callback_trans} ||= \&install_logger; + @l = $trans->run($urpm, %options); } 1; diff --git a/urpmi b/urpmi index a7184a09..35576798 100755 --- a/urpmi +++ b/urpmi @@ -476,9 +476,10 @@ if (%sources_install || %sources) { exit(($? >> 8) + 32); #- forward grpmi error + 32 } } else { - my @l = $urpm->install($root, [ keys %{$state->{ask_remove} || {}} ], \%sources_install, \%sources); + my @l = $urpm->install($root, [ keys %{$state->{ask_remove} || {}} ], \%sources_install, \%sources, + translate_message => 1); if (@l) { - message(_("Installation failed") . ":\n" . join("\n", @l)); + message(_("Installation failed") . ":\n" . join("\n", map { "\t$_" } @l)); m|^/| && !-e $_ and exit 2 foreach values %sources_install, values %sources; #- missing local file $auto and exit 1; #- if auto has been set, avoid asking user. @@ -488,14 +489,16 @@ if (%sources_install || %sources) { message_input(_("Try installation without checking dependencies? (y/N) "), $force && $yesexpr) =~ /[$yesexpr]/ or exit 1; $urpm->{log}("starting installing packages without deps"); - @l = $urpm->install($root, [ keys %{$state->{ask_remove} || {}} ], \%sources_install, \%sources, nodeps => 1); + @l = $urpm->install($root, [ keys %{$state->{ask_remove} || {}} ], \%sources_install, \%sources, + translate_message => 1, nodeps => 1); if (@l) { - message(_("Installation failed") . ":\n" . join("\n", @l)); + message(_("Installation failed") . ":\n" . join("\n", map { "\t$_" } @l)); message_input(_("Try installation even more strongly (--force)? (y/N) "), $force && $yesexpr) =~ /[$yesexpr]/ or exit 1; $urpm->{log}("starting force installing packages without deps"); - @l = $urpm->install($root, [ keys %{$state->{ask_remove} || {}} ], \%sources_install, \%sources, nodeps => 1, force => 1); - @l and $urpm->fatal(2, _("Installation failed") . ":\n" . join("\n", @l)); + @l = $urpm->install($root, [ keys %{$state->{ask_remove} || {}} ], \%sources_install, \%sources, + translate_message => 1, nodeps => 1, force => 1); + @l and $urpm->fatal(2, _("Installation failed") . ":\n" . join("\n", map { "\t$_" } @l)); } } } diff --git a/urpmi.spec b/urpmi.spec index 719c8d55..2775b269 100644 --- a/urpmi.spec +++ b/urpmi.spec @@ -2,13 +2,13 @@ Name: urpmi Version: 3.8 -Release: 2mdk +Release: 3mdk License: GPL Source0: %{name}.tar.bz2 Source1: %{name}.logrotate Summary: User mode rpm install Requires: eject webfetch perl-DateManip >= 5.40 -PreReq: perl-Locale-gettext rpmtools >= 4.3-2mdk perl-URPM >= 0.11-1mdk +PreReq: perl-Locale-gettext rpmtools >= 4.3-2mdk perl-URPM >= 0.11-2mdk BuildRequires: bzip2-devel gcc-c++ gettext rpm-devel rpmtools BuildRoot: %{_tmppath}/%{name}-buildroot BuildArch: noarch @@ -144,6 +144,10 @@ fi %changelog +* Mon Jul 22 2002 François Pons 3.8-3mdk +- fixed ldconfig cannot be installed. +- added translation support on error. + * Mon Jul 22 2002 François Pons 3.8-2mdk - fixed no dependencies or forced install error. -- cgit v1.2.1