diff options
author | Denis Barbier <barbier> | 2004-02-09 22:55:05 +0000 |
---|---|---|
committer | Denis Barbier <barbier> | 2004-02-09 22:55:05 +0000 |
commit | 719466009c0a313de73e62d9df7147327cd60eed (patch) | |
tree | 5c8b8d32a7aad098ee81bad99a275474bc17d886 /Perl/Webwml | |
parent | d863f98586ec016cf9fd6a068a8e4e7fef5bf294 (diff) |
* Martin Quinson
- Add a new Switch field to gather informations about packages
depending on debconf but without po-debconf support.
- Add a new set_date method.
CVS version numbers
Perl/Webwml/L10n/Db.pm: 1.13 -> 1.14
Diffstat (limited to 'Perl/Webwml')
-rw-r--r-- | Perl/Webwml/L10n/Db.pm | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/Perl/Webwml/L10n/Db.pm b/Perl/Webwml/L10n/Db.pm index 8145fb8ee67..32453a8743e 100644 --- a/Perl/Webwml/L10n/Db.pm +++ b/Perl/Webwml/L10n/Db.pm @@ -54,7 +54,9 @@ sub new { date => 0, # Fields below are written into file in the same order # Package must always be the first field - scalar => [qw(Package Version Section Priority Maintainer PoolDir Type Upstream)], + # Switch is used temporarily to detect packages which + # depend on debconf and did not switch to using po-debconf. + scalar => [qw(Package Version Section Priority Maintainer PoolDir Type Upstream Switch)], array1 => [qw(Errors Catgets Gettext)], array2 => [qw(NLS PO TEMPLATES PODEBCONF MENU DESKTOP MAN)], }; @@ -148,6 +150,7 @@ Read database from a given file. Returns 1 on success and otherwise 0. sub read { my $self = shift; my $file = shift; + my $check = shift || 1; if ($file =~ m/\.gz$/) { open (DB,"gzip -dc $file |") || return 0; @@ -181,13 +184,13 @@ sub read { foreach (@{$self->{scalar}}) { if ($desc =~ m/^$_: (.*)$/m) { - $entry->{$_} = $1; - } elsif ($_ eq 'Package') { - warn "Parse error when reading $file: missing \`$_' field\n"; - next MAIN; - } else { - warn "Parse error when reading $file: Package ".$entry->{Package}.": missing \`$_' field\n"; - delete $self->{data}->{$entry->{Package}}; + if ($_ eq 'Package' && defined $self->{data}->{$1}) { + $entry = $self->{data}->{$1}; + } else { + $entry->{$_} = $1; + } + } elsif ($check && $_ ne 'Switch') { + warn "Parse error when reading $file: Package ".(defined($entry->{Package}) ? $entry->{Package} : "<unknown>").": missing \`$_' field\n"; next MAIN; } } @@ -303,6 +306,19 @@ sub get_date { return $self->{date}; } +=item set_date + +Sets the date of generation + +=cut + +sub set_date { + my $self = shift; + my $date = shift; + $self->{date} = $date; +} + + =back =head2 DATA MANIPULATION |