summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2006-11-07 12:00:29 +0000
committerPascal Rigaux <pixel@mandriva.com>2006-11-07 12:00:29 +0000
commit9c46df437e09357865998ab42cabd0fcf6befb9d (patch)
tree55826e2127a0e4d7035c8af6d4a0ac71e2da9b94
parent4ab87638c1909e87503de5d929440b136e2e6438 (diff)
downloadurpmi-9c46df437e09357865998ab42cabd0fcf6befb9d.tar
urpmi-9c46df437e09357865998ab42cabd0fcf6befb9d.tar.gz
urpmi-9c46df437e09357865998ab42cabd0fcf6befb9d.tar.bz2
urpmi-9c46df437e09357865998ab42cabd0fcf6befb9d.tar.xz
urpmi-9c46df437e09357865998ab42cabd0fcf6befb9d.zip
ask user before installing a package that matching part of the name
-rw-r--r--urpm.pm4
-rwxr-xr-xurpmi25
2 files changed, 21 insertions, 8 deletions
diff --git a/urpm.pm b/urpm.pm
index b6de2d4b..43d6d102 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -2267,6 +2267,10 @@ sub search_packages {
);
$result = 0;
} else {
+ if (!@{$exact_a{$_} || $exact_ra{$_} || []}) {
+ #- we found a non-exact match
+ $result = 'substring';
+ }
foreach (values %l) {
my $best;
foreach (@$_) {
diff --git a/urpmi b/urpmi
index 84198a0b..1679c74d 100755
--- a/urpmi
+++ b/urpmi
@@ -416,16 +416,21 @@ if ($bug) {
}
#- search the packages according to the selection given by the user.
+my $search_result;
if (@names) {
- $urpm->search_packages(
+ $search_result = $urpm->search_packages(
\%requested, [ @names ],
all => $all,
use_provides => $use_provides,
fuzzy => $urpm->{options}{fuzzy},
) || $force or exit 1;
+
+ if (%requested) {
+ $urpm->{log}("found package(s): " . join(" ", map { scalar $urpm->{depslist}[$_]->fullname } keys %requested));
+ }
}
if (@src_names) {
- $urpm->search_packages(\%requested, [ @src_names ],
+ $search_result = $urpm->search_packages(\%requested, [ @src_names ],
all => $all,
use_provides => $use_provides,
fuzzy => $urpm->{options}{fuzzy},
@@ -548,7 +553,7 @@ my @to_install;
#- check if there is at least one package to install that
#- has not been given by the user.
-my $ask_user = $env;
+my $ask_user = $env || $search_result eq 'substring';
my $sum = 0;
my @root_only;
@@ -826,11 +831,15 @@ if ($nok) {
print N("Installation is possible"), "\n";
} elsif (@names || @src_names || @files || @src_files || $auto_select) {
if (@{$state->{transaction} || []} == 0 && @ask_unselect == 0) {
- print N("The package(s) are already installed"), "\n" if $verbose >= 0;
- if ($verbose >= 0 && !$auto_select) {
- my @packages = map { $urpm->{depslist}[$_]->name } keys %requested;
- my @guessed = difference2(\@packages, \(@names, @src_names));
- print N("The following package names were assumed: %s", join ", ", @guessed), "\n" if @guessed;
+ if ($verbose >= 0) {
+ if ($auto_select) {
+ print N("Packages are up to date"), "\n";
+ } else {
+ my @l = map { scalar $urpm->{depslist}[$_]->fullname } keys %requested;
+ my $msg = @l > 1 ? N("Packages %s are already installed", join(', ', @l)) :
+ N("Package %s is already installed", @l);
+ print "$msg\n";
+ }
}
$exit_code = 15 if our $expect_install;
}