diff options
author | Thierry Vignaud <tv@mageia.org> | 2013-05-17 12:35:07 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mageia.org> | 2013-05-17 12:35:07 +0000 |
commit | 342c51b281dac91d3bb95bcf0d9fd4b36d14982a (patch) | |
tree | ea91be1b6cd95d870eeaf15ddfebb2876957f9a7 /urpm | |
parent | 0de497b50811cfa096871eff490dc77ec1f35450 (diff) | |
download | urpmi-342c51b281dac91d3bb95bcf0d9fd4b36d14982a.tar urpmi-342c51b281dac91d3bb95bcf0d9fd4b36d14982a.tar.gz urpmi-342c51b281dac91d3bb95bcf0d9fd4b36d14982a.tar.bz2 urpmi-342c51b281dac91d3bb95bcf0d9fd4b36d14982a.tar.xz urpmi-342c51b281dac91d3bb95bcf0d9fd4b36d14982a.zip |
(is_media_to_add_by_default) split it out of add_distrib_media()
(needed for next commit)
Diffstat (limited to 'urpm')
-rw-r--r-- | urpm/media.pm | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/urpm/media.pm b/urpm/media.pm index 81da468d..5adb67d4 100644 --- a/urpm/media.pm +++ b/urpm/media.pm @@ -776,6 +776,19 @@ sub needed_extra_media { ($nonfree, $tainted); } +sub is_media_to_add_by_default { + my ($urpm, $distribconf, $medium, $product_id) = @_; + my $add_by_default = !$distribconf->getvalue($medium, 'noauto'); + my @media_types = split(':', $distribconf->getvalue($medium, 'media_type')); + if ($product_id->{product} eq 'Free') { + if (member('non-free', @media_types)) { + $urpm->{log}(N("ignoring non-free medium `%s'", $medium)); + $add_by_default = 0; + } + } + $add_by_default; +} + sub non_ignored_media { my ($urpm, $b_only_marked_update) = @_; @@ -1129,14 +1142,8 @@ sub add_distrib_media { $is_update_media or next; } - my $add_by_default = !$distribconf->getvalue($media, 'noauto'); - my @media_types = split(':', $distribconf->getvalue($media, 'media_type')); - if ($product_id->{product} eq 'Free') { - if (member('non-free', @media_types)) { - $urpm->{log}(N("ignoring non-free medium `%s'", $media)); - $add_by_default = 0; - } - } + my $add_by_default = is_media_to_add_by_default($urpm, $distribconf, $media, $product_id); + my $ignore; if ($options{ask_media}) { $options{ask_media}->($media_name, $add_by_default) or next; |