From 830d5819dd6280d8133342d700a26b4f6ee9ec56 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Fri, 14 Nov 2008 15:14:00 +0000 Subject: - urpmi o in --auto, do not allow to install a package substring match (you can use -a to force it) --- NEWS | 2 ++ urpm/select.pm | 13 ++++++++----- urpmi | 1 + 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index 4a6800d4..f2d194ba 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,7 @@ - urpmi o in --auto, do display an error message when rpms are missing + o in --auto, do not allow to install a package substring match + (you can use -a to force it) o revert --auto-update behaviour in case of media update failures (#45417) o ensure download when updating media (with --auto-update) is quiet - urpmi.update diff --git a/urpm/select.pm b/urpm/select.pm index f816bbb7..11a2823e 100644 --- a/urpm/select.pm +++ b/urpm/select.pm @@ -79,6 +79,7 @@ sub build_listid_ { #- all #- caseinsensitive #- fuzzy +#- no_substring #- src #- use_provides #- @@ -166,7 +167,11 @@ sub _search_packages { my $pkg = $urpm->{depslist}[$_]; push @{$l{$pkg->name}}, $pkg; } - if (values(%l) == 0 || values(%l) > 1 && !$options{all}) { + #- non-exact match? + my $is_substring_match = !@{$exact_a{$v} || $exact_ra{$v} || []}; + + if (values(%l) == 0 + || !$options{all} && (values(%l) > 1 || $is_substring_match && $options{no_substring})) { $urpm->{error}(N("No package named %s", $v)); values(%l) != 0 and $urpm->{error}( N("The following packages contain %s: %s", @@ -175,10 +180,8 @@ sub _search_packages { ); $result = 0; } else { - if (!@{$exact_a{$v} || $exact_ra{$v} || []}) { - #- we found a non-exact match - $result = 'substring'; - } + $is_substring_match and $result = 'substring'; + $name2ids{$v} = join('|', map { my $best; foreach (@$_) { diff --git a/urpmi b/urpmi index 6e50cb07..e9e2be6a 100755 --- a/urpmi +++ b/urpmi @@ -388,6 +388,7 @@ if (@names) { all => $all, use_provides => $use_provides, fuzzy => $urpm->{options}{fuzzy}, + no_substring => $urpm->{options}{auto}, # do not allow substring match if we can't prompt the user ) || $force or exit 1; if (%requested) { -- cgit v1.2.1