diff options
author | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2005-02-10 17:37:07 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2005-02-10 17:37:07 +0000 |
commit | 802fd00d095a5f54418dee6ebe5831502f8dd10d (patch) | |
tree | add61fcbfc62f75eb31f14178a4ac4caecf964c6 | |
parent | 2edbe37779e0c7aa1942e2f655d60567243dd596 (diff) | |
download | urpmi-802fd00d095a5f54418dee6ebe5831502f8dd10d.tar urpmi-802fd00d095a5f54418dee6ebe5831502f8dd10d.tar.gz urpmi-802fd00d095a5f54418dee6ebe5831502f8dd10d.tar.bz2 urpmi-802fd00d095a5f54418dee6ebe5831502f8dd10d.tar.xz urpmi-802fd00d095a5f54418dee6ebe5831502f8dd10d.zip |
Patch by Michael Scherer (bug 13525) to refactorize option names; makes
downloader option settable per media.
-rw-r--r-- | urpm.pm | 42 |
1 files changed, 21 insertions, 21 deletions
@@ -26,6 +26,25 @@ BEGIN { } } +#- list of options defined for each media +our @PER_MEDIA_OPT = qw( + downloader + hdlist + ignore + key-ids + list + md5sum + noreconfigure + priority + priority-upgrade + removable + synthesis + update + verify-rpm + virtual + with_hdlist +); + #- create a new urpm object. sub new { my ($class) = @_; @@ -160,24 +179,7 @@ sub read_config { #- per-media options foreach my $m (grep { $_ ne '' } keys %$config) { my $medium = { name => $m, clear_url => $config->{$m}{url} }; - foreach my $opt (qw( - downloader - hdlist - ignore - key-ids - list - md5sum - noreconfigure - priority - removable - synthesis - update - verify-rpm - virtual - with_hdlist - )) { - defined $config->{$m}{$opt} and $medium->{$opt} = $config->{$m}{$opt}; - } + defined $config->{$m}{$_} and $medium->{$_} = $config->{$m}{$_} foreach @PER_MEDIA_OPT; $urpm->probe_medium($medium, %options) and push @{$urpm->{media}}, $medium; } @@ -376,9 +378,7 @@ sub write_config { foreach my $medium (@{$urpm->{media}}) { my $medium_name = $medium->{name}; $config->{$medium_name}{url} = $medium->{clear_url}; - foreach (qw(hdlist with_hdlist list removable key-ids priority priority-upgrade update ignore synthesis virtual)) { - defined $medium->{$_} and $config->{$medium_name}{$_} = $medium->{$_}; - } + defined $medium->{$_} and $config->{$medium_name}{$_} = $medium->{$_} foreach @PER_MEDIA_OPT; } urpm::cfg::dump_config($urpm->{config}, $config) or $urpm->{fatal}(6, N("unable to write config file [%s]", $urpm->{config})); |