diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2008-02-27 18:33:13 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2008-02-27 18:33:13 +0000 |
commit | cd8afebffcca47b25bd5ca8e30f2b3c8ae823a0a (patch) | |
tree | a6985d9e4904983ad9aa4de7f73b7cbbc09b534e | |
parent | c82cfab97f95aebcde08ccde1736c4229fd8404c (diff) | |
download | urpmi-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-- | NEWS | 2 | ||||
-rw-r--r-- | urpm/media.pm | 32 |
2 files changed, 25 insertions, 9 deletions
@@ -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"; |