summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-06-30 13:05:37 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-06-30 13:05:37 +0000
commit8142e6e95f8ee77c50c026f8e468731c2a26ffb8 (patch)
tree2de0c63fbdd373dedc1b7330c33e24c25b4980bb
parenta1ead6655ba5d07c6adbbe1e82c8d76bb55987e5 (diff)
downloadurpmi-8142e6e95f8ee77c50c026f8e468731c2a26ffb8.tar
urpmi-8142e6e95f8ee77c50c026f8e468731c2a26ffb8.tar.gz
urpmi-8142e6e95f8ee77c50c026f8e468731c2a26ffb8.tar.bz2
urpmi-8142e6e95f8ee77c50c026f8e468731c2a26ffb8.tar.xz
urpmi-8142e6e95f8ee77c50c026f8e468731c2a26ffb8.zip
Don't perform a fuzzy match on media names when removing media
-rw-r--r--urpm.pm8
-rwxr-xr-xurpmi.removemedia2
2 files changed, 7 insertions, 3 deletions
diff --git a/urpm.pm b/urpm.pm
index e1dfa561..4aeb5310 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -722,6 +722,8 @@ sub add_distrib_media {
sub select_media {
my $urpm = shift;
+ my $options = {};
+ if (ref $_[0]) { $options = shift }
my %media; @media{@_} = undef;
foreach (@{$urpm->{media}}) {
@@ -740,9 +742,11 @@ sub select_media {
unless ($media{$_}) {
my $q = quotemeta;
my (@found, @foundi);
+ my $regex = $options->{strict_match} ? qr/\b$q\b/ : qr/$q/;
+ my $regexi = $options->{strict_match} ? qr/\b$q\b/i : qr/$q/i;
foreach my $medium (@{$urpm->{media}}) {
- $medium->{name} =~ /$q/ and push @found, $medium;
- $medium->{name} =~ /$q/i and push @foundi, $medium;
+ $medium->{name} =~ $regex and push @found, $medium;
+ $medium->{name} =~ $regexi and push @foundi, $medium;
}
if (@found == 1) {
$found[0]{modified} = 1;
diff --git a/urpmi.removemedia b/urpmi.removemedia
index f556e158..dd2791e3 100755
--- a/urpmi.removemedia
+++ b/urpmi.removemedia
@@ -49,7 +49,7 @@ where <name> is a medium name to remove.
}
@toremoves == 0 and die N("the entry to remove is missing\n(one of %s)\n", join(", ", @entries));
- $urpm->select_media(@toremoves);
+ $urpm->select_media({ strict_match => 1 }, @toremoves);
$urpm->remove_selected_media;
$urpm->update_media(noclean => $options{noclean});