summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-06-24 02:44:16 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-06-24 02:44:16 +0000
commit35ca26da6599faf3c677c16171734f905c4d8fc1 (patch)
treee3eabab12c79257b4375e6fe06053c661e419d30
parentcb09736fef2b456d9e0fa0efd886339d26a451bd (diff)
downloadurpmi-35ca26da6599faf3c677c16171734f905c4d8fc1.tar
urpmi-35ca26da6599faf3c677c16171734f905c4d8fc1.tar.gz
urpmi-35ca26da6599faf3c677c16171734f905c4d8fc1.tar.bz2
urpmi-35ca26da6599faf3c677c16171734f905c4d8fc1.tar.xz
urpmi-35ca26da6599faf3c677c16171734f905c4d8fc1.zip
I18N of error messages in urpm::cfg
Normalize key_ids to key-ids
-rw-r--r--t/cfg.t3
-rw-r--r--urpm/cfg.pm9
2 files changed, 8 insertions, 4 deletions
diff --git a/t/cfg.t b/t/cfg.t
index 6845b890..3ea895fb 100644
--- a/t/cfg.t
+++ b/t/cfg.t
@@ -18,6 +18,7 @@ update\\ 1 http://foo/bar/ {
compress: 1
fuzzy: 1
keep: yes
+ key-ids: 123
update
verify-rpm: yes
}
@@ -25,6 +26,7 @@ update\\ 1 http://foo/bar/ {
update_2 ftp://foo/bar/ {
hdlist: hdlist.update2.cz
ignore
+ key_ids: 456
priority-upgrade: kernel
synthesis
with_hdlist: hdlist.update2.cz
@@ -40,6 +42,7 @@ ok( urpm::cfg::dump_config($file.2, $config), 'config written' );
$cfgtext =~ s/\byes\b/1/g;
$cfgtext =~ s/\bno\b/0/g;
+$cfgtext =~ s/\bkey_ids\b/key-ids/g;
my $cfgtext2 = cat_($file.2);
$cfgtext2 =~ s/# generated.*\n//;
is( $cfgtext, $cfgtext2, 'config is the same' )
diff --git a/urpm/cfg.pm b/urpm/cfg.pm
index 2b50c6f9..2dd3a062 100644
--- a/urpm/cfg.pm
+++ b/urpm/cfg.pm
@@ -41,14 +41,14 @@ Returns 1 on success, 0 on failure.
our $err;
-sub _syntax_error () { $err = N("syntax error in config file at line %s") }
+sub _syntax_error () { $err = N("syntax error in config file at line %s", $.) }
sub load_config ($) {
my ($file) = @_;
my %config;
my $medium = undef;
$err = '';
- open my $f, $file or do { $err = "Can't read $file: $!\n"; return };
+ open my $f, $file or do { $err = N("unable to read config file [%s]", $file); return };
local $_;
while (<$f>) {
chomp;
@@ -82,12 +82,13 @@ sub load_config ($) {
|md5sum
|limit-rate
|excludepath
- |key[\-_]ids
|split-(?:level|length)
|priority-upgrade
|downloader
)\s*:\s*(.*)$/x
and $config{$medium}{$1} = $2, next;
+ /^key[-_]ids\s*:\s*(.*)$/
+ and $config{$medium}{'key-ids'} = $1, next;
#- positive flags
/^(update|ignore|synthesis|virtual)$/
and $config{$medium}{$1} = 1, next;
@@ -125,7 +126,7 @@ sub dump_config ($$) {
return $a cmp $b;
} keys %$config;
open my $f, '>', $file or do {
- $err = "Can't write to $file: $!\n";
+ $err = N("unable to write config file [%s]", $file);
return 0;
};
print $f "# generated ".(scalar localtime)."\n";