summaryrefslogtreecommitdiffstats
path: root/urpm.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-12-12 11:33:39 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-12-12 11:33:39 +0000
commit4bda2339695fac3b3cc2b73cf3a1d23dcdb569a9 (patch)
tree93f358657fc9819981adb01686bc0b46d8a05242 /urpm.pm
parentdf23d1acfe8752f339f9f69d212cfa240f578796 (diff)
downloadurpmi-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.pm20
1 files changed, 19 insertions, 1 deletions
diff --git a/urpm.pm b/urpm.pm
index 11a3aec9..d76fffcb 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -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;