summaryrefslogtreecommitdiffstats
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
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)
-rw-r--r--NEWS2
-rw-r--r--t/helper.pm26
-rw-r--r--t/superuser--addmedia.t22
-rw-r--r--urpm.pm1
-rw-r--r--urpm/cfg.pm64
-rw-r--r--urpm/media.pm35
6 files changed, 5 insertions, 145 deletions
diff --git a/NEWS b/NEWS
index 185a93ae..0996f79d 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,5 @@
+- drop support for /etc/urpmi/media.d/*.cfg
+ (was partially broken, non documented and hopefully unused)
- only load LDAP binding if needed (saves a couple MB in rpmdrake)
Version 6.21 - 13 January 2009
diff --git a/t/helper.pm b/t/helper.pm
index 005eadfe..a7959dae 100644
--- a/t/helper.pm
+++ b/t/helper.pm
@@ -7,7 +7,6 @@ our @EXPORT = qw(need_root_and_prepare
urpmi_addmedia urpmi_removemedia urpmi_update
urpm_cmd run_urpm_cmd urpmi_cmd urpmi test_urpmi_fail urpme
urpmi_cfg set_urpmi_cfg_global_options
- create_media_d_cfg media_d_cfg
system_ system_should_fail
rpm_is_jbj_version
check_installed_fullnames check_installed_names check_nothing_installed
@@ -102,31 +101,6 @@ sub set_urpmi_cfg_global_options {
ok(urpm::cfg::dump_config(urpmi_cfg(), $config), 'set_urpmi_cfg_global_options');
}
-sub media_d_dir {
- "$::pwd/root/etc/urpmi/media.d";
-}
-sub media_d_cfg {
- my ($name) = @_;
- media_d_dir() . "/$name.cfg";
-}
-sub create_media_d_cfg {
- my ($name, @l) = @_;
-
- system("install -d " . media_d_dir());
- my $cfg = media_d_cfg($name);
- -e $cfg and die "$cfg already exists\n";
- open(my $F, '>', $cfg);
-
- my $cnt = 1;
- foreach my $h (@l) {
- my %h = %$h;
- my $section = delete $h{'with-dir'} || $cnt++;
- print $F "[$section]\n";
- print $F "$_ = $h->{$_}\n" foreach keys %$h;
- }
-}
-
-
sub system_ {
my ($cmd) = @_;
system($cmd);
diff --git a/t/superuser--addmedia.t b/t/superuser--addmedia.t
index d43cbd50..ffe2ff14 100644
--- a/t/superuser--addmedia.t
+++ b/t/superuser--addmedia.t
@@ -17,9 +17,6 @@ my @fields = qw(hdlist synthesis with_synthesis media_info_dir no-media-info lis
test_reconfig();
-try_media_d_1();
-try_media_d_2();
-
try_medium({}, '');
@@ -149,25 +146,6 @@ sub check_urpmi {
check_installed_and_remove(@names);
}
-sub try_media_d_1 {
- create_media_d_cfg($name, { name => $name, url => "$::pwd/media/$name" });
- check_urpmi($name);
-
- create_media_d_cfg($name2, { name => $name2, url => "$::pwd/media/$name2" });
- check_urpmi($name2);
-
- ok(unlink media_d_cfg($name));
- ok(unlink media_d_cfg($name2));
-}
-sub try_media_d_2 {
- create_media_d_cfg($name,
- { name => $name, url => "$::pwd/media/$name" },
- { name => $name2, url => "$::pwd/media/$name2" });
- check_urpmi($name, $name2);
-
- ok(unlink media_d_cfg($name));
-}
-
sub test_reconfig {
urpmi_addmedia("reconfig $::pwd/media/reconfig");
check_conf({ name => 'reconfig', url => "$::pwd/media/$name" });
diff --git a/urpm.pm b/urpm.pm
index bb6ee510..c2504bec 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -162,7 +162,6 @@ sub set_files {
my %h = (
config => "$urpmi_root/etc/urpmi/urpmi.cfg",
- configs_dir => "$urpmi_root/etc/urpmi/media.d",
skiplist => prefer_rooted($urpmi_root, '/etc/urpmi/skip.list'),
instlist => prefer_rooted($urpmi_root, '/etc/urpmi/inst.list'),
prefer_list => prefer_rooted($urpmi_root, '/etc/urpmi/prefer.list'),
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);
}