[Debian-l10n-commits] r1116 - in /dl10n/trunk: Changelog lib/Debian/L10n/Db.pm
nekral-guest at users.alioth.debian.org
nekral-guest at users.alioth.debian.org
Sun Aug 3 18:04:31 UTC 2008
Author: nekral-guest
Date: Sun Aug 3 18:04:31 2008
New Revision: 1116
URL: http://svn.debian.org/wsvn/?sc=1&rev=1116
Log:
* lib/Debian/L10n/Db.pm (del_status): Add support for clearing a
specific line in the database specified by $pkg, $type, and $file.
* lib/Debian/L10n/Db.pm (set_status): Add support to change the
status of a specific line in the database specified by a
statusline.
Modified:
dl10n/trunk/Changelog
dl10n/trunk/lib/Debian/L10n/Db.pm
Modified: dl10n/trunk/Changelog
URL: http://svn.debian.org/wsvn/dl10n/trunk/Changelog?rev=1116&op=diff
==============================================================================
--- dl10n/trunk/Changelog (original)
+++ dl10n/trunk/Changelog Sun Aug 3 18:04:31 2008
@@ -1,3 +1,11 @@
+2008-08-03 Nicolas François <nicolas.francois at centraliens.net>
+
+ * lib/Debian/L10n/Db.pm (del_status): Add support for clearing a
+ specific line in the database specified by $pkg, $type, and $file.
+ * lib/Debian/L10n/Db.pm (set_status): Add support to change the
+ status of a specific line in the database specified by a
+ statusline.
+
2008-08-03 Nicolas François <nicolas.francois at centraliens.net>
* html/pseudo-urls.html: l10n.css is in html/, not ../
Modified: dl10n/trunk/lib/Debian/L10n/Db.pm
URL: http://svn.debian.org/wsvn/dl10n/trunk/lib/Debian/L10n/Db.pm?rev=1116&op=diff
==============================================================================
--- dl10n/trunk/lib/Debian/L10n/Db.pm (original)
+++ dl10n/trunk/lib/Debian/L10n/Db.pm Sun Aug 3 18:04:31 2008
@@ -333,11 +333,13 @@
=cut
sub set_status {
- my ($db,$pkg,$type,$file,$date,$status,$translator,$list,$url,$bug_nb) = @_;
+ my ($db,$pkg,$type,$file,$date,$status,$translator,$list,$url,$bug_nb,$statusline) = @_;
foreach my $line (@{$db->{data}->{$pkg}->{STATUS}}) {
- if (${$line}[0] eq $type
- && ${$line}[1] eq $file) {
+ if ( (defined($statusline) and ($statusline == $line))
+ or ( not defined($statusline)
+ and ${$line}[0] eq $type
+ and ${$line}[1] eq $file)) {
${$line}[2] = $date;
${$line}[3] = $status;
${$line}[4] = $translator;
@@ -352,17 +354,15 @@
=item del_status
-Del the package if there was only one status line.
If a reference to a statusline is provided, it removes the first found
-It should remove the right line from the DB, and empty the package if nothing else is left.
+It should remove the right line (pkg, type, and file) from the DB, and empty the package if nothing else is left.
=cut
sub del_status {
- my ($db,$pkg,$type,$statusline) = @_;
- if (scalar @{$db->{data}->{$pkg}->{STATUS}} == 1) {
- $db->clear_pkg($pkg);
- } elsif ($statusline) {
+ my ($db,$pkg,$type,$file,$statusline) = @_;
+
+ if ($statusline) {
my $ok;
for (my $i=0; $i < @{$db->{data}->{$pkg}->{STATUS}}; $i++) {
my @a = @$statusline;
@@ -377,15 +377,23 @@
splice @{$db->{data}->{$pkg}->{STATUS}}, $i, 1;
last;
}
- print "Cannot del_status, statusline not found\n" unless $ok;
+ print "Cannot del_status, statusline not found in package $pkg\n" unless $ok;
} else {
- print "Ups, sorry, cannot del_status when there is more than one status field in the pkg\n";
+ my $found = 0;
+ for (my $i=@{$db->{data}->{$pkg}->{STATUS}}; $i > 0; $i--) {
+ my @b = @{$db->{data}->{$pkg}->{STATUS}->[$i-1]};
+ if ( ($b[0] eq $type)
+ and ($b[1] eq $file)) {
+ $found = 1;
+ splice @{$db->{data}->{$pkg}->{STATUS}}, $i-1, 1;
+ }
+ }
+ print "Cannot del_status, $type/$file not found in package $pkg\n" unless $found;
}
-# foreach my $line (@{$db->{data}->{$pkg}->{STATUS}}) {
-# if (${$line}[0] eq $type) {
-# print "Do not remove $type from $pkg since it's not implemented yet\n";
-# }
-# }
+
+ if (scalar @{$db->{data}->{$pkg}->{STATUS}} == 0) {
+ $db->clear_pkg($pkg);
+ }
}
More information about the Debian-l10n-commits
mailing list