From 8142e6e95f8ee77c50c026f8e468731c2a26ffb8 Mon Sep 17 00:00:00 2001 From: Rafael Garcia-Suarez Date: Wed, 30 Jun 2004 13:05:37 +0000 Subject: Don't perform a fuzzy match on media names when removing media --- urpm.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'urpm.pm') 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; -- cgit v1.2.1