summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--urpm.pm10
-rw-r--r--urpm/media.pm8
-rw-r--r--urpm/removable.pm4
-rwxr-xr-xurpmi.addmedia2
4 files changed, 16 insertions, 8 deletions
diff --git a/urpm.pm b/urpm.pm
index 85345f66..7699d33c 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -14,7 +14,7 @@ use urpm::md5sum;
our $VERSION = '5.6';
our @ISA = qw(URPM Exporter);
-our @EXPORT_OK = 'file_from_local_url';
+our @EXPORT_OK = ('file_from_local_url', 'is_local_medium');
use URPM;
use URPM::Resolve;
@@ -200,6 +200,14 @@ sub file_from_local_url {
my ($url) = @_;
$url =~ m!^(?:removable[^:]*:/|file:/)?(/.*)! && $1;
}
+sub is_local_url {
+ my ($url) = @_;
+ file_from_local_url($url);
+}
+sub is_local_medium {
+ my ($medium) = @_;
+ is_local_url($medium->{url});
+}
sub db_open_or_die {
my ($urpm, $root, $b_write_perm) = @_;
diff --git a/urpm/media.pm b/urpm/media.pm
index 0ee2eba9..15ccc45c 100644
--- a/urpm/media.pm
+++ b/urpm/media.pm
@@ -2,7 +2,7 @@ package urpm::media;
# $Id$
-use urpm 'file_from_local_url';
+use urpm 'file_from_local_url', 'is_local_medium';
use urpm::msg;
use urpm::util;
use urpm::removable;
@@ -953,7 +953,7 @@ sub may_reconfig_urpmi {
if (-s $f) {
reconfig_urpmi($urpm, $f, $medium);
}
- unlink $f if !file_from_local_url($medium->{url});
+ unlink $f if !is_local_medium($medium);
}
#- read a reconfiguration file for urpmi, and reconfigure media accordingly
@@ -1459,7 +1459,7 @@ sub _update_medium_ {
{
my $rc =
- file_from_local_url($medium->{url})
+ is_local_medium($medium)
? _update_medium__parse_if_unmodified__local($urpm, $medium, \%options)
: _update_medium__parse_if_unmodified__remote($urpm, $medium, \%options);
@@ -1610,7 +1610,7 @@ sub _retrieve_media_info_file_and_check_MD5SUM {
my $name = "$prefix$suffix";
my $cachedir_file =
- file_from_local_url($medium->{url}) ?
+ is_local_medium($medium) ?
_copy_media_info_file($urpm, $medium, $prefix, $suffix) :
_download_media_info_file($urpm, $medium, $prefix, $suffix, $quiet) or
$urpm->{error}(N("retrieval of [%s] failed", _synthesis_dir($medium) . "/$name")), return;
diff --git a/urpm/removable.pm b/urpm/removable.pm
index 77fb5300..19081f7b 100644
--- a/urpm/removable.pm
+++ b/urpm/removable.pm
@@ -6,7 +6,7 @@ use urpm::msg;
use urpm::sys;
use urpm::util;
use urpm::get_pkgs;
-use urpm 'file_from_local_url';
+use urpm 'file_from_local_url', 'is_local_medium';
@@ -131,7 +131,7 @@ sub _examine_removable_medium {
my $medium = $blist->{medium};
- if (file_from_local_url($medium->{url})) {
+ if (is_local_medium($medium)) {
_examine_removable_medium_($urpm, $medium, $blist->{list}, $sources, $o_ask_for_medium);
} else {
#- we have a removable device that is not removable, well...
diff --git a/urpmi.addmedia b/urpmi.addmedia
index 47554222..8a508360 100755
--- a/urpmi.addmedia
+++ b/urpmi.addmedia
@@ -166,7 +166,7 @@ if ($options{distrib}) {
if ($with eq "with") {
$relative_synthesis or usage N("<relative path of synthesis> missing\n");
}
- if ($options{probe_with} && $options{probe_with} eq 'rpms' && !urpm::file_from_local_url($url)) {
+ if ($options{probe_with} && $options{probe_with} eq 'rpms' && !urpm::is_local_url($url)) {
die N("Can't use %s with remote medium", "--probe-rpms");
}