summaryrefslogtreecommitdiffstats
path: root/urpm/media.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-02-21 14:14:23 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-02-21 14:14:23 +0000
commit929fa7966aa8b0a619fd50858d51966be2acf2d9 (patch)
tree3a4a9c9cf0e9fbf666108b57c32f6fb72051f6c9 /urpm/media.pm
parent8cb5d5f1b9513ec8e8b67577fbe5d3bea96e2f7b (diff)
downloadurpmi-929fa7966aa8b0a619fd50858d51966be2acf2d9.tar
urpmi-929fa7966aa8b0a619fd50858d51966be2acf2d9.tar.gz
urpmi-929fa7966aa8b0a619fd50858d51966be2acf2d9.tar.bz2
urpmi-929fa7966aa8b0a619fd50858d51966be2acf2d9.tar.xz
urpmi-929fa7966aa8b0a619fd50858d51966be2acf2d9.zip
create _new_distribconf_and_download() and use it
(for future commit)
Diffstat (limited to 'urpm/media.pm')
-rw-r--r--urpm/media.pm21
1 files changed, 15 insertions, 6 deletions
diff --git a/urpm/media.pm b/urpm/media.pm
index 8ca10605..3d0f5c3e 100644
--- a/urpm/media.pm
+++ b/urpm/media.pm
@@ -734,13 +734,9 @@ sub add_distrib_media {
} else {
unlink "$urpm->{cachedir}/partial/media.cfg";
- $distribconf = MDV::Distribconf->new($url, undef);
- $distribconf->settree('mandriva');
+ $distribconf = _new_distribconf_and_download($urpm, $url);
- $urpm->{log}(N("retrieving media.cfg file..."));
- if (urpm::download::sync($urpm, undef,
- [ reduce_pathname($distribconf->getfullpath(undef, 'infodir') . '/media.cfg') ],
- quiet => 1)) {
+ if ($distribconf) {
$distribconf->parse_mediacfg("$urpm->{cachedir}/partial/media.cfg")
or $urpm->{error}(N("unable to parse media.cfg")), return();
} else {
@@ -805,6 +801,19 @@ sub add_distrib_media {
return @newnames;
}
+sub _new_distribconf_and_download {
+ my ($urpm, $url) = @_;
+
+ my $distribconf = MDV::Distribconf->new($url, undef);
+ $distribconf->settree('mandriva');
+
+ $urpm->{log}(N("retrieving media.cfg file..."));
+ urpm::download::sync($urpm, undef,
+ [ reduce_pathname($distribconf->getfullpath(undef, 'infodir') . '/media.cfg') ],
+ quiet => 1) or return;
+ $distribconf;
+}
+
#- deprecated, use select_media_by_name instead
sub select_media {
my $urpm = shift;