summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS7
-rwxr-xr-xgurpmi23
-rw-r--r--urpm.pm20
-rw-r--r--urpm/media.pm13
4 files changed, 28 insertions, 15 deletions
diff --git a/NEWS b/NEWS
index 5858dc6c..12088542 100644
--- a/NEWS
+++ b/NEWS
@@ -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:
diff --git a/gurpmi2 b/gurpmi2
index 23fda4e9..d677170d 100755
--- a/gurpmi2
+++ b/gurpmi2
@@ -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();
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;
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}