summaryrefslogtreecommitdiffstats
path: root/urpm/cfg.pm
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-06-24 01:41:00 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-06-24 01:41:00 +0000
commitcb09736fef2b456d9e0fa0efd886339d26a451bd (patch)
tree774461b1a211caa31b2bcd3b85da81d1ec4eae5a /urpm/cfg.pm
parentc13069d9cf136a8f3ae26e9919b278c7414a0086 (diff)
downloadurpmi-cb09736fef2b456d9e0fa0efd886339d26a451bd.tar
urpmi-cb09736fef2b456d9e0fa0efd886339d26a451bd.tar.gz
urpmi-cb09736fef2b456d9e0fa0efd886339d26a451bd.tar.bz2
urpmi-cb09736fef2b456d9e0fa0efd886339d26a451bd.tar.xz
urpmi-cb09736fef2b456d9e0fa0efd886339d26a451bd.zip
Tests and fixes for the urpmi.cfg parser
Diffstat (limited to 'urpm/cfg.pm')
-rw-r--r--urpm/cfg.pm15
1 files changed, 11 insertions, 4 deletions
diff --git a/urpm/cfg.pm b/urpm/cfg.pm
index 0d9238d2..2b50c6f9 100644
--- a/urpm/cfg.pm
+++ b/urpm/cfg.pm
@@ -104,8 +104,9 @@ sub load_config ($) {
|auto
|resume)(?:\s*:\s*(.*))?$/x
) {
- my $yes = !$no;
- $config{$medium}{$k} = $v =~ /^(yes|on|1|)$/i ? $yes : !$yes;
+ my $yes = $no ? 0 : 1;
+ $no = $yes ? 0 : 1;
+ $config{$medium}{$k} = $v =~ /^(yes|on|1|)$/i ? $yes : $no;
next;
}
#- obsolete
@@ -129,8 +130,12 @@ sub dump_config ($$) {
};
print $f "# generated ".(scalar localtime)."\n";
for my $m (@media) {
- print $f quotespace($m), ' ', quotespace($config->{$m}{url}), " {\n";
- for (grep { $_ ne 'url' } keys %{$config->{$m}}) {
+ if ($m) {
+ print $f quotespace($m), ' ', quotespace($config->{$m}{url}), " {\n";
+ } else {
+ print $f "{\n";
+ }
+ for (sort grep { $_ ne 'url' } keys %{$config->{$m}}) {
if (/^(update|ignore|synthesis|virtual)$/) {
print $f " $_\n";
} else {
@@ -143,6 +148,8 @@ sub dump_config ($$) {
return 1;
}
+1;
+
__END__
=back