[Debian-l10n-commits] r1182 - in /dl10n/trunk: Changelog lib/Debian/L10n/Spider.pm
nekral-guest at users.alioth.debian.org
nekral-guest at users.alioth.debian.org
Mon Aug 11 21:38:11 UTC 2008
Author: nekral-guest
Date: Mon Aug 11 21:38:11 2008
New Revision: 1182
URL: http://svn.debian.org/wsvn/?sc=1&rev=1182
Log:
* lib/Debian/L10n/Spider.pm: Define the SOAP object global. This
removes one argument from check_bts_bug_soap().
* lib/Debian/L10n/Spider.pm: check_bts_bug_soap() does not remove
status lines, there is no need re-read the list of status lines.
* lib/Debian/L10n/Spider.pm: Make sure $soap_bugs is defined
before checking its length.
* lib/Debian/L10n/Spider.pm: Added variable for the BTS location.
* lib/Debian/L10n/Spider.pm (clean_db): Re-read the list of status
lines for a package after each removal.
* lib/Debian/L10n/Spider.pm (clean_db): Indicate the most
recent statusline which can be removed for a file/type. This avoid
that closure of old bugs remove the status for more recent
review cycles.
* lib/Debian/L10n/Spider.pm (clean_db): Log "Remove DONE"
instead of "Remove bug" when a old DONE is removed.
* lib/Debian/L10n/Spider.pm: Only check the BTS status if
$check_bts.
Modified:
dl10n/trunk/Changelog
dl10n/trunk/lib/Debian/L10n/Spider.pm
Modified: dl10n/trunk/Changelog
URL: http://svn.debian.org/wsvn/dl10n/trunk/Changelog?rev=1182&op=diff
==============================================================================
--- dl10n/trunk/Changelog (original)
+++ dl10n/trunk/Changelog Mon Aug 11 21:38:11 2008
@@ -1,3 +1,23 @@
+2008-08-11 Nicolas François <nicolas.francois at centraliens.net>
+
+ * lib/Debian/L10n/Spider.pm: Define the SOAP object global. This
+ removes one argument from check_bts_bug_soap().
+ * lib/Debian/L10n/Spider.pm: check_bts_bug_soap() does not remove
+ status lines, there is no need re-read the list of status lines.
+ * lib/Debian/L10n/Spider.pm: Make sure $soap_bugs is defined
+ before checking its length.
+ * lib/Debian/L10n/Spider.pm: Added variable for the BTS location.
+ * lib/Debian/L10n/Spider.pm (clean_db): Re-read the list of status
+ lines for a package after each removal.
+ * lib/Debian/L10n/Spider.pm (clean_db): Indicate the most
+ recent statusline which can be removed for a file/type. This avoid
+ that closure of old bugs remove the status for more recent
+ review cycles.
+ * lib/Debian/L10n/Spider.pm (clean_db): Log "Remove DONE"
+ instead of "Remove bug" when a old DONE is removed.
+ * lib/Debian/L10n/Spider.pm: Only check the BTS status if
+ $check_bts.
+
2008-08-11 Nicolas François <nicolas.francois at centraliens.net>
* lib/Debian/L10n/Db.pm: if a $type, $file, and $statusline are
Modified: dl10n/trunk/lib/Debian/L10n/Spider.pm
URL: http://svn.debian.org/wsvn/dl10n/trunk/lib/Debian/L10n/Spider.pm?rev=1182&op=diff
==============================================================================
--- dl10n/trunk/lib/Debian/L10n/Spider.pm (original)
+++ dl10n/trunk/lib/Debian/L10n/Spider.pm Mon Aug 11 21:38:11 2008
@@ -379,17 +379,19 @@
check_bts_soap($db);
}
+my $BTS = "http://bugs.debian.org";
+#my $BTS = "http://bugs.donarmstrong.com";
+use Data::Dumper;
+use SOAP::Lite;
+
+my $soap = SOAP::Lite->uri('Debbugs/SOAP')->proxy("$BTS/cgi-bin/soap.cgi");
+
my %seen;
my %opendate;
my %closedate;
my %bugsubmitter;
sub check_bts_soap($) {
my $db = shift;
-
- use Data::Dumper;
- use SOAP::Lite;
-
- my $soap = SOAP::Lite->uri('Debbugs/SOAP')->proxy('http://bugs.debian.org/cgi-bin/soap.cgi');
foreach my $pkg (sort (grep { $db->has_status($_) } $db->list_packages())) {
PKG_BTS:
@@ -402,19 +404,15 @@
next unless ($status_from_db eq 'bts')
|| ($status_from_db eq 'wontfix')
|| ($status_from_db eq 'fix');
- if (check_bts_bug_soap ($db, $soap, $pkg, $statusline)) {
- # The database was changed, we have to check
- # again the list of status line for this
- # package.
- goto PKG_BTS;
- }
- }
- }
-}
-
-sub check_bts_bug_soap ($$$$) {
+ check_bts_bug_soap ($db, $pkg, $statusline);
+ # Note: this will only add the DONE tags if bugs are now closed.
+ # There is no need to parse these additional statusline.
+ }
+ }
+}
+
+sub check_bts_bug_soap ($$$) {
my $db = shift;
- my $soap = shift || SOAP::Lite->uri('Debbugs/SOAP')->proxy('http://bugs.debian.org/cgi-bin/soap.cgi');
my $pkg = shift;
my $statusline = shift;
my $changed = 0; # 0: No changes
@@ -427,9 +425,9 @@
my $bugdone = 0;
my $content;
my $soap_bugs = $soap->get_status($bug_nb)->result();
- if (not length $soap_bugs) {
- warn "Cannot find bug $bug_nb\n";
- next;
+ if (not defined $soap_bugs or not length $soap_bugs) {
+ warn "Cannot find bug '$bug_nb' ($pkg: $type#$file)\n";
+ return 0;
}
my $pkg_bug = $soap_bugs->{$bug_nb}->{package};
@@ -448,11 +446,11 @@
}
if ($bugdone) {
- my $bts_url = "http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=$bug_nb'}";
+ my $bts_url = "$BTS/cgi-bin/bugreport.cgi?bug=$bug_nb'}";
my $answer = $Web_agent -> request(HTTP::Request -> new (GET => $bts_url));
- next unless $answer -> is_success;
+ return 0 unless $answer -> is_success;
$content = $answer -> content_ref;
- next unless $$content;
+ return 0 unless $$content;
$seen{$bug_nb} = 1;
$$content =~ /(.*?)Message #[0-9]+<\/a> received at (?:submit|maintonly)\@bugs\.debian\.org(.*)/ms;
@@ -521,10 +519,9 @@
my $offset = 60 * 60 * 24 * 3; # 3 days in seconds
foreach my $pkg (sort( grep { $db->has_status($_) } $db->list_packages())) {
-# for (my $i = 0; $i < @{$db->status($pkg)}; $i++) {
-# my $statusline = (@{$db->status($pkg)})[$i];
-my @a=(@{$db->status($pkg)});
-foreach my $statusline (@a) {
+READ_LINES:
+ if ($db->has_package($pkg)) { # The package may have disapeared after del_status
+ foreach my $statusline (@{$db->status($pkg)}) {
my ($type, $file, $date, $status_from_db, $translator, $list, $url, $bug_nb) = @{$statusline};
warn "$pkg\:$type\:$file does not specify the status\n"
unless defined $status_from_db;
@@ -536,10 +533,11 @@
$date_done =~ m/(\d\d\d\d)-(\d\d)-(\d+)/;
my $time_done = timelocal(0,0,0, $3,$2-1,$1);
if ($now - $time_done > $offset) {
- print "Remove ".($bug_nb?"#$bug_nb":"bug")." about the $type of $pkg because it's done since more than 3 days old\n";
- $db->del_status($pkg, $type, $file);
-# $i--;
+ print "Remove ".($bug_nb?"#$bug_nb":"DONE")." about the $type of $pkg because it's done since more than 3 days old\n";
+ $db->del_status($pkg, $type, $file, $statusline);
+ goto READ_LINES;
}
+ }
}
}
}
@@ -667,7 +665,7 @@
and $file eq $file_from_db
and $status_from_db eq 'done'
and $status ne 'done') {
- $db->del_status($pkg, $type, $file);
+ $db->del_status($pkg, $type, $file, $statusline);
}
}
}
@@ -678,11 +676,11 @@
$db->add_status($pkg, $type, $file, $date, $status, $translator, $list, $url, ($bug_nb || ""));
print "Insert $pkg: $type#$file#$date#$status#$translator#$list#$url#".($bug_nb ? "$bug_nb" : "")."\n";
- if ($status eq 'bts') {
+ if ($check_bts and $status eq 'bts') {
# Check the status of the bug with the last status line.
# This will set the bug to status to DONE if the bug is an old one.
my @statuslist = @{$db->status($pkg)};
- check_bts_bug_soap ($db, 0, $pkg, pop @statuslist);
+ check_bts_bug_soap ($db, $pkg, pop @statuslist);
}
}
} continue {
More information about the Debian-l10n-commits
mailing list