summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-02-27 18:33:13 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-02-27 18:33:13 +0000
commitcd8afebffcca47b25bd5ca8e30f2b3c8ae823a0a (patch)
treea6985d9e4904983ad9aa4de7f73b7cbbc09b534e
parentc82cfab97f95aebcde08ccde1736c4229fd8404c (diff)
downloadurpmi-cd8afebffcca47b25bd5ca8e30f2b3c8ae823a0a.tar
urpmi-cd8afebffcca47b25bd5ca8e30f2b3c8ae823a0a.tar.gz
urpmi-cd8afebffcca47b25bd5ca8e30f2b3c8ae823a0a.tar.bz2
urpmi-cd8afebffcca47b25bd5ca8e30f2b3c8ae823a0a.tar.xz
urpmi-cd8afebffcca47b25bd5ca8e30f2b3c8ae823a0a.zip
- create _migrate_removable_url out of _migrate_removable_device
- do keep our url scheme for cdroms (#30613)
-rw-r--r--NEWS2
-rw-r--r--urpm/media.pm32
2 files changed, 25 insertions, 9 deletions
diff --git a/NEWS b/NEWS
index 5ab2827a..5858e72e 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,7 @@
- all tools:
o cdrom:// replaces removable://
+- urpmi.addmedia:
+ o fix --distrib for cdroms (#30613)
- urpmi:
o fix using proxy with curl (#38143)
diff --git a/urpm/media.pm b/urpm/media.pm
index 6e4f61b0..3a3326d6 100644
--- a/urpm/media.pm
+++ b/urpm/media.pm
@@ -396,16 +396,26 @@ sub _migrate_removable_device {
# (nb: for iso files, {removable} has already been renamed into {iso} internally)
delete $medium->{removable};
- if ($medium->{url} && $medium->{url} =~ /^removable/) {
- $medium->{url} =~ s!^removable(.*?)://!/!;
- #- handle device name in url scheme, this is deprecated
- if ($medium->{url} =~ s!/(mnt|media)/cd\w+/?!cdrom://!i) {
+ if (my $url = _migrate_removable_url($medium->{url})) {
+ $medium->{url} = $url;
+ } else {
+ $urpm->{error}(N("failed to migrate removable device, ignoring media"));
+ $medium->{ignore} = 1;
+ }
+}
+
+sub _migrate_removable_url {
+ my ($url) = @_;
+
+ if ($url && $url =~ /^removable/) {
+ $url =~ s!^removable(.*?)://!/!;
+ if ($url =~ s!/(mnt|media)/cd\w+/?!cdrom://!i) {
# success!
} else {
- $urpm->{error}(N("failed to migrate removable device, ignoring media"));
- $medium->{ignore} = 1;
+ return;
}
}
+ $url;
}
@@ -729,12 +739,16 @@ sub add_distrib_media {
my $distribconf;
if ($url && urpm::is_local_url($url)) {
+ $url = _migrate_removable_url($url) or return();
my $m = { url => $url };
urpm::removable::try_mounting_medium($urpm, $m) or return ();
- my $dir = file_from_local_medium($m);
- $distribconf = MDV::Distribconf->new($dir, undef);
- $distribconf->load
+ $distribconf = MDV::Distribconf->new(file_from_file_url($url) || $url, undef);
+ $distribconf->settree('mandriva');
+
+ my $dir = file_from_local_medium($m);
+ my $media_cfg = reduce_pathname("$dir/" . $distribconf->getpath(undef, 'infodir') . '/media.cfg');
+ $distribconf->parse_mediacfg($media_cfg)
or $urpm->{error}(N("this location doesn't seem to contain any distribution")), return ();
} else {
unlink "$urpm->{cachedir}/partial/media.cfg";