diff options
-rw-r--r-- | NEWS | 7 | ||||
-rwxr-xr-x | gurpmi2 | 3 | ||||
-rw-r--r-- | urpm.pm | 20 | ||||
-rw-r--r-- | urpm/media.pm | 13 |
4 files changed, 28 insertions, 15 deletions
@@ -1,3 +1,10 @@ +- urpmi: + o fix handling "post-clean: 0" in urpmi.cfg + (#36082, regression introduced 2007-11-28) +- library: + o urpm::media::read_config() doesn't read urpmi.cfg global options anymore, + use urpm->get_global_options or urpm->new_parse_cmdline + Version 4.10.18 - 11 December 2007, by Pascal "Pixel" Rigaux - urpmi: @@ -98,7 +98,8 @@ my ($rpm_lock, $urpmi_lock); #- Creates and configure an urpm object for this application to use. sub configure_urpm() { - my $urpm = new urpm; + my $urpm = urpm->new; + $urpm->get_global_options; $urpm->{fatal} = sub { Gtk2::MessageDialog->new($mainw, [qw(modal destroy-with-parent)], 'error', 'ok', Locale::gettext::iconv($_[1], undef, 'UTF-8'))->run; quit(); @@ -44,7 +44,7 @@ sub new { obsoletes => {}, media => undef, - options => default_options(), + options => {}, fatal => sub { printf STDERR "%s\n", $_[1]; exit($_[0]) }, error => sub { printf STDERR "%s\n", $_[0] }, @@ -65,9 +65,27 @@ sub new_parse_cmdline { my ($class) = @_; my $urpm = $class->new; urpm::args::parse_cmdline(urpm => $urpm); + get_global_options($urpm); $urpm; } +sub _add2hash { my ($a, $b) = @_; while (my ($k, $v) = each %{$b || {}}) { defined $a->{$k} or $a->{$k} = $v } $a } + +sub get_global_options { + my ($urpm) = @_; + + my $config = urpm::cfg::load_config($urpm->{config}) + or $urpm->{fatal}(6, $urpm::cfg::err); + + if (my $global = $config->{global}) { + _add2hash($urpm->{options}, $global); + } + #- remember global options for write_config + $urpm->{global_config} = $config->{global}; + + _add2hash($urpm->{options}, default_options()); +} + sub prefer_rooted { my ($root, $file) = @_; -e "$root$file" ? "$root$file" : $file; diff --git a/urpm/media.pm b/urpm/media.pm index 59ea1cb4..ac9aeb91 100644 --- a/urpm/media.pm +++ b/urpm/media.pm @@ -117,17 +117,7 @@ sub read_config { my $config = urpm::cfg::load_config($urpm->{config}) or $urpm->{fatal}(6, $urpm::cfg::err); - #- global options - if (my $global = $config->{global}) { - foreach my $opt (keys %$global) { - if (defined $global->{$opt} && !exists $urpm->{options}{$opt}) { - $urpm->{options}{$opt} = $global->{$opt}; - } - } - } - #- per-media options - read_config_add_passwords($urpm, $config); foreach my $m (@{$config->{media}}) { @@ -151,9 +141,6 @@ sub read_config { $_->{md5sum} = $md5sum; } } - - #- remember global options for write_config - $urpm->{global_config} = $config->{global}; } #- if invalid, set {ignore} |