From cb09736fef2b456d9e0fa0efd886339d26a451bd Mon Sep 17 00:00:00 2001 From: Rafael Garcia-Suarez Date: Thu, 24 Jun 2004 01:41:00 +0000 Subject: Tests and fixes for the urpmi.cfg parser --- urpm/cfg.pm | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'urpm') 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 -- cgit v1.2.1