diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2007-12-12 11:33:39 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2007-12-12 11:33:39 +0000 |
commit | 4bda2339695fac3b3cc2b73cf3a1d23dcdb569a9 (patch) | |
tree | 93f358657fc9819981adb01686bc0b46d8a05242 /urpm.pm | |
parent | df23d1acfe8752f339f9f69d212cfa240f578796 (diff) | |
download | urpmi-4bda2339695fac3b3cc2b73cf3a1d23dcdb569a9.tar urpmi-4bda2339695fac3b3cc2b73cf3a1d23dcdb569a9.tar.gz urpmi-4bda2339695fac3b3cc2b73cf3a1d23dcdb569a9.tar.bz2 urpmi-4bda2339695fac3b3cc2b73cf3a1d23dcdb569a9.tar.xz urpmi-4bda2339695fac3b3cc2b73cf3a1d23dcdb569a9.zip |
- 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
Diffstat (limited to 'urpm.pm')
-rw-r--r-- | urpm.pm | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -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; |