summaryrefslogtreecommitdiffstats
path: root/urpm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2009-01-28 13:59:18 +0000
committerPascal Rigaux <pixel@mandriva.com>2009-01-28 13:59:18 +0000
commitb0740bb0a7329249cb0372fe589709b8c8abda6f (patch)
tree08a85bf4092514021d3d6c9cb72f0e4055d7eded /urpm
parent2c647329d1253cabcfe7628376370cb13c311a2e (diff)
downloadurpmi-b0740bb0a7329249cb0372fe589709b8c8abda6f.tar
urpmi-b0740bb0a7329249cb0372fe589709b8c8abda6f.tar.gz
urpmi-b0740bb0a7329249cb0372fe589709b8c8abda6f.tar.bz2
urpmi-b0740bb0a7329249cb0372fe589709b8c8abda6f.tar.xz
urpmi-b0740bb0a7329249cb0372fe589709b8c8abda6f.zip
- drop support for /etc/urpmi/media.d/*.cfg
(was partially broken, non documented and hopefully unused) (mostly reverting commit 234656 which introduced that feature)
Diffstat (limited to 'urpm')
-rw-r--r--urpm/cfg.pm64
-rw-r--r--urpm/media.pm35
2 files changed, 3 insertions, 96 deletions
diff --git a/urpm/cfg.pm b/urpm/cfg.pm
index 8619eda9..149d41fc 100644
--- a/urpm/cfg.pm
+++ b/urpm/cfg.pm
@@ -255,70 +255,6 @@ sub dump_config_raw {
1;
}
-sub load_ini_config_file_raw {
- my ($file, $b_norewrite) = @_;
-
- require Config::IniFiles;
- my $cfg = Config::IniFiles->new('-file' => $file) or return [];
-
- [ map {
- my $section = $_;
- my %h = map {
- my $v = $cfg->val($section, $_);
- $v = expand_line($v) if !$b_norewrite;
- $_ => $v;
- } $cfg->Parameters($section);
- { 'with-dir' => $section, %h };
- } $cfg->Sections ];
-}
-
-sub write_ini_config {
- my ($file, $blocks) = @_;
-
- if (@$blocks == 0) {
- unlink $file;
- return;
- }
- my $modified;
-
- require Config::IniFiles;
- my $cfg = Config::IniFiles->new('-file' => $file);
- if ($cfg) {
- # remove dropped blocks
- foreach (difference2([ $cfg->Sections ], [ map { $_->{name} } @$blocks ])) {
- $cfg->DeleteSection($_);
- $modified = 1;
- }
- } else {
- $cfg = Config::IniFiles->new;
- }
-
- my %uniq;
-
- foreach (@$blocks) {
- my %h = %$_;
- my $section = delete $h{'with-dir'} || '_';
- $uniq{$section}++ or die "conflicting with-dir value $section\n";
-
- foreach (difference2([ $cfg->Parameters($section) ], [ keys %h ])) {
- # remove those options which are no more wanted
- $cfg->delval($section, $_);
- $modified = 1;
- }
- foreach (keys %h) {
- my $old_v = $cfg->getval($section, $_);
- my $v = substitute_back($h{$_}, $old_v);
- if ($old_v ne $v) {
- $cfg->setval($section, $_, $v);
- $modified = 1;
- }
- }
- }
- if ($modified) {
- $cfg->RewriteConfig;
- }
-}
-
1;
__END__
diff --git a/urpm/media.pm b/urpm/media.pm
index 90f32583..4733c014 100644
--- a/urpm/media.pm
+++ b/urpm/media.pm
@@ -165,7 +165,6 @@ sub read_config {
#- per-media options
read_config_add_passwords($urpm, $config);
- my @media;
foreach my $m (@{$config->{media}}) {
my $medium = _only_media_opts_read($m);
@@ -179,17 +178,6 @@ sub read_config {
push @media, $medium;
}
- require File::Glob;
- # we can't use perl's glob() because we allow spaces in filename
- foreach my $conf_file (File::Glob::bsd_glob("$urpm->{configs_dir}/*.cfg")) {
- $urpm->{debug} and $urpm->{debug}("parsing: $conf_file");
- my $conf = urpm::cfg::load_ini_config_file_raw($conf_file);
- foreach my $medium (map { _only_media_opts_read($_) } @$conf) {
- $medium->{conf_file} = $conf_file;
- push @media, $medium;
- }
- }
-
add_existing_medium($urpm, $_, $nocheck) foreach @media;
eval { require urpm::ldap; urpm::ldap::load_ldap_media($urpm) };
@@ -207,12 +195,7 @@ sub check_existing_medium {
N("unable to access list file of \"%s\", medium ignored", $medium->{name});
} elsif (!$medium->{ignore}
&& !-r any_synthesis($urpm, $medium)) {
- if ($medium->{conf_file} && $< == 0) {
- # no pb, we create on the fly
- $medium->{force_auto_update} = 1;
- } else {
- $err = N("unable to access synthesis file of \"%s\", medium ignored", $medium->{name});
- }
+ $err = N("unable to access synthesis file of \"%s\", medium ignored", $medium->{name});
}
if ($err) {
$medium->{ignore} = 1;
@@ -481,16 +464,11 @@ sub write_urpmi_cfg {
#- avoid trashing exiting configuration if it wasn't loaded
$urpm->{media} or return;
- my %media_per_cfg;
- foreach (grep { !$_->{external} } @{$urpm->{media}}) {
- push @{$media_per_cfg{$_->{conf_file} || ''}}, _only_media_opts_write($_);
- }
-
my $config = {
#- global config options found in the config file, without the ones
#- set from the command-line
global => $urpm->{global_config},
- media => delete $media_per_cfg{''},
+ media => [ map { _only_media_opts_write($_) } grep { !$_->{external} } @{$urpm->{media}} ],
};
remove_passwords_and_write_private_netrc($urpm, $config);
@@ -499,13 +477,6 @@ sub write_urpmi_cfg {
$urpm->{log}(N("wrote config file [%s]", $urpm->{config}));
- foreach my $conf_file (sort keys %media_per_cfg) {
- urpm::cfg::write_ini_config($conf_file, $media_per_cfg{$conf_file})
- or $urpm->{fatal}(6, N("unable to write config file [%s]", $conf_file));
-
- $urpm->{log}(N("wrote config file [%s]", $conf_file));
- }
-
#- everything should be synced now.
delete $urpm->{modified};
}
@@ -641,7 +612,7 @@ sub _auto_update_media {
$options{callback} = delete $options{download_callback};
- foreach (grep { $_->{force_auto_update} || _is_remote_virtual($_) || $urpm->{options}{'auto-update'} }
+ foreach (grep { _is_remote_virtual($_) || $urpm->{options}{'auto-update'} }
non_ignored_media($urpm, $options{update})) {
_update_medium($urpm, $_, %options);
}