diff options
author | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2004-07-27 06:06:53 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2004-07-27 06:06:53 +0000 |
commit | 21b7551db1452f05322209b8f4d9c9064e8eefeb (patch) | |
tree | 65dd67813c365195cbe866198219613ad8e1c13e /urpm.pm | |
parent | ee5df142c4a44ab7bdd50f675f558e7b87713c8d (diff) | |
download | urpmi-21b7551db1452f05322209b8f4d9c9064e8eefeb.tar urpmi-21b7551db1452f05322209b8f4d9c9064e8eefeb.tar.gz urpmi-21b7551db1452f05322209b8f4d9c9064e8eefeb.tar.bz2 urpmi-21b7551db1452f05322209b8f4d9c9064e8eefeb.tar.xz urpmi-21b7551db1452f05322209b8f4d9c9064e8eefeb.zip |
Make the leading "file://" optional in local media URLs.
Diffstat (limited to 'urpm.pm')
-rw-r--r-- | urpm.pm | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -483,7 +483,7 @@ sub configure { foreach (grep { !$_->{ignore} && (!$options{update} || $_->{update}) } @{$urpm->{media} || []}) { delete @$_{qw(start end)}; if ($_->{virtual}) { - my $path = $_->{url} =~ m|^file:/*(/[^/].*[^/])/*$| && $1; + my $path = $_->{url} =~ m{^(?:file:/*)?(/[^/].*[^/])/*$} && $1; if ($path) { if ($_->{synthesis}) { $urpm->{log}(N("examining synthesis file [%s]", "$path/$_->{with_hdlist}")); @@ -618,7 +618,7 @@ sub add_medium { #- creating the medium info. if ($options{virtual}) { - $url =~ m{^file:/} or $urpm->{fatal}(1, N("virtual medium needs to be local")); + $url =~ m{^(?:file:)?/} or $urpm->{fatal}(1, N("virtual medium needs to be local")); $medium = { name => $name, url => $url, @@ -640,7 +640,7 @@ sub add_medium { } #- local media have priority, other are added at the end. - if ($url =~ m!^file:/!) { + if ($url =~ m{^(?:file:)?/}) { $medium->{priority} = 0.5; } else { $medium->{priority} = 1 + @{$urpm->{media}}; @@ -882,7 +882,7 @@ sub reconfig_urpmi { } } #- check that the new url exists before committing changes (local mirrors) - if ($medium->{$k} =~ m#^file:/*(/[^/].*[^/])/*$# && !-e $1) { + if ($medium->{$k} =~ m#^(?:file:/*)?(/[^/].*[^/])/*$# && !-e $1) { $medium->{$k} = $orig{$k} for @reconfigurable; $reconfigured = 0; $urpm->{log}(N("...reconfiguration failed")); @@ -951,7 +951,7 @@ sub update_media { #- to speed up the process, we only read the synthesis at the beginning. delete @$medium{qw(start end)}; if ($medium->{virtual}) { - my ($path) = $medium->{url} =~ m|^file:/*(/[^/].*[^/])/*$|; + my ($path) = $medium->{url} =~ m{^(?:file:)?/*(/[^/].*[^/])/*$}; if ($path) { my $with_hdlist_file = "$path/$medium->{with_hdlist}"; if ($medium->{synthesis}) { @@ -1828,7 +1828,7 @@ this could happen if you mounted manually the directory when creating the medium } elsif ($medium->{synthesis}) { if ($second_pass) { if ($medium->{virtual}) { - my ($path) = $medium->{url} =~ m|^file:/*(/[^/].*[^/])/*$|; + my ($path) = $medium->{url} =~ m{^(?:file:/*)?(/[^/].*[^/])/*$}; my $with_hdlist_file = "$path/$medium->{with_hdlist}"; if ($path) { $urpm->{log}(N("examining synthesis file [%s]", $with_hdlist_file)); |