summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-07-27 06:06:53 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-07-27 06:06:53 +0000
commit21b7551db1452f05322209b8f4d9c9064e8eefeb (patch)
tree65dd67813c365195cbe866198219613ad8e1c13e
parentee5df142c4a44ab7bdd50f675f558e7b87713c8d (diff)
downloadurpmi-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.
-rw-r--r--urpm.pm12
-rwxr-xr-xurpmi.addmedia6
-rwxr-xr-xurpmq4
3 files changed, 11 insertions, 11 deletions
diff --git a/urpm.pm b/urpm.pm
index ddd6412d..e1759706 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -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));
diff --git a/urpmi.addmedia b/urpmi.addmedia
index ca73dc57..7e93498a 100755
--- a/urpmi.addmedia
+++ b/urpmi.addmedia
@@ -37,7 +37,7 @@ sub usage {
# Translator: only what is between <brakets> can be translated.
my $usage = N("usage: urpmi.addmedia [options] <name> <url> [with <relative_path>]
where <url> is one of
- file://<path> with <relative filename of hdlist>
+ [file:/]/<path> with <relative filename of hdlist>
ftp://<login>:<password>@<host>/<path> with <relative filename of hdlist>
ftp://<host>/<path> with <relative filename of hdlist>
http://<host>/<path> with <relative filename of hdlist>
@@ -109,7 +109,7 @@ sub main {
#- allow not to give name immediately.
$options{distrib} or $url or ($url, $name) = ($name, '');
- my ($type) = $url =~ m,^([^:]*)://, or $options{distrib} or usage;
+ my ($type) = $url =~ m,^(([^:]*):/)?/, or $options{distrib} or usage;
if ($< != 0) {
$urpm->{fatal}(1, N("Only superuser is allowed to add media"));
@@ -227,7 +227,7 @@ sub main {
}
}
- #- try to umount removable device which may have been mounted.
+ #- try to umount removable devices which may have been mounted.
$urpm->try_umounting_removables;
}
diff --git a/urpmq b/urpmq
index 77d27984..476b8224 100755
--- a/urpmq
+++ b/urpmq
@@ -311,7 +311,7 @@ if ($urpm::args::options{list_aliases}) {
require packdrake;
my $packer = new packdrake(
$urpm->{media}[$_]{virtual} ?
- ("$urpm->{media}[$_]{url}/$urpm->{media}[$_]{with_hdlist}" =~ m!^file:/*(/.*)!)[0] :
+ ("$urpm->{media}[$_]{url}/$urpm->{media}[$_]{with_hdlist}" =~ m!^(?:file:/*)?(/[^/].*)!)[0] :
"$urpm->{statedir}/$urpm->{media}[$_]{hdlist}");
$packer->extract_archive(undef, @headers);
} else {
@@ -339,7 +339,7 @@ if ($urpm::args::options{list_aliases}) {
require packdrake;
my $packer = new packdrake(
$urpm->{media}[$_]{virtual} ?
- ("$urpm->{media}[$_]{url}/$urpm->{media}[$_]{with_hdlist}" =~ m!^file:/*(/.*)!)[0] :
+ ("$urpm->{media}[$_]{url}/$urpm->{media}[$_]{with_hdlist}" =~ m!^(?:file:/*)?(/[^/].*)!)[0] :
"$urpm->{statedir}/$urpm->{media}[$_]{hdlist}");
$packer->extract_archive($< == 0 ? "$urpm->{cachedir}/headers" : $tmp_header_dir, @headers);
} elsif (!%downloads) {