[Debian-l10n-commits] r2647 - /dl10n/trunk/dl10n-nmu

bubulle at users.alioth.debian.org bubulle at users.alioth.debian.org
Sat May 28 17:40:47 UTC 2011


Author: bubulle
Date: Sat May 28 17:40:46 2011
New Revision: 2647

URL: http://svn.debian.org/wsvn/?sc=1&rev=2647
Log:
use Debbugs/SOAP instead of bts2ldap (thanks to David Prevot)

Modified:
    dl10n/trunk/dl10n-nmu

Modified: dl10n/trunk/dl10n-nmu
URL: http://svn.debian.org/wsvn/dl10n/trunk/dl10n-nmu?rev=2647&op=diff
==============================================================================
--- dl10n/trunk/dl10n-nmu (original)
+++ dl10n/trunk/dl10n-nmu Sat May 28 17:40:46 2011
@@ -3,6 +3,7 @@
 # dl10n-nmu -- Scoring packages with long-standing po-debconf bugs
 #
 # Copyright (C) 2006 Thomas Huriaux
+# Copyright (C) 2011 David Prévot <taffit at debian.org>
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -12,17 +13,13 @@
 use strict;
 
 use Debian::L10n::Db;
-use Net::LDAP;
+use SOAP::Lite;
 use POSIX qw(strftime);
 my $generation_date = strftime('%a, %d %b %Y %H:%M:%S %z', gmtime);
 
 # TODO: add an option
 my $DB_FILE="/srv/i18n.debian.net/www/debian-l10n-material/data/unstable.gz";
 my $POPCON="./data/by_inst";
-
-my $ldapserver = {
-    'host' => "bts2ldap.debian.net",
-    'port' => "10101" };
 
 print "Read the database...";
 my $data = Debian::L10n::Db->new();
@@ -38,15 +35,11 @@
 $comments->{nodebconf} = "not using debconf";
 
 
-print "Starting ldap query... ";
-my $ldap = Net::LDAP->new($ldapserver->{'host'},
-    'port' => $ldapserver->{'port'})
+print "Starting SOAP query... ";
+my $soap = SOAP::Lite->uri('Debbugs/SOAP')->proxy('http://bugs.debian.org/cgi-bin/soap.cgi')
            or die "failed: $!\n";
-$ldap->bind;
-my $ldap_bugs = $ldap->search(
-    base => "dc=current,dc=bugs,dc=debian,dc=org",
-    filter => "(&(!(debbugsState=done))(debbugsTag=*l10n*))");
-$ldap->unbind;
+my $soap_bugs = $soap->get_bugs(tag=>'l10n')->result or die "failed: $!\n";
+my $soap_status = $soap->get_status($soap_bugs)->result() or die "failed: $!\n";
 print "done.\n";
 
 my $pop = {};
@@ -58,16 +51,17 @@
   }
 }
 
-foreach my $entry ($ldap_bugs->entries) {
-  my $pkg = $entry->get_value( "debbugsSourcePackage" );
-  $pkg = $entry->get_value( "debbugsPackage" ) unless defined $pkg;
-  my $bug_nb = $entry->get_value( "debbugsID" );
-  my $date = $entry->get_value( "debbugsDate" );
+foreach my $bug_nb (@$soap_bugs) {
+  next if $soap_status->{$bug_nb}->{done};
+  next if $soap_status->{$bug_nb}->{archived};
+  my $pkg = $soap_status->{$bug_nb}->{source};
+  $pkg = $soap_status->{$bug_nb}->{package} unless defined $pkg;
+  my $date = $soap_status->{$bug_nb}->{date};
   #these packages are skipped in the database
   next if ($pkg =~ /(kde-i18n|wordtrans|kernel-image-2\.4\.27-m68k|manpages|debian-med|pptpd)/);
-  my @tags = $entry->get_value( "debbugsTag" );
+  my @tags = $soap_status->{$bug_nb}->{tags};
   next if (grep ( /^fixed$/, @tags ));
-  my $bug_title = $entry->get_value( "debbugsTitle" );
+  my $bug_title =  $soap_status->{$bug_nb}->{subject};
   $bugs->{$bug_nb} = $bug_title;
   $packages->{$pkg}->{score} = 0 unless (defined $packages->{$pkg});
   #search for debconf templates bug, adding Clytie's and Daniel's tests.
@@ -88,12 +82,14 @@
 }
 
 my $orphaned = {};
-$ldap = Net::LDAP->new( 'bts2ldap.debian.net', 'port' => 10101 ) or die "Unable to connect to ldap: $!\n";
-$ldap->bind;
-$ldap_bugs = $ldap->search( base => "dc=current,dc=bugs,dc=debian,dc=org" , filter => "(&(!(debbugsState=done))(debbugsPackage=wnpp))");
-$ldap->unbind;
-foreach my $entry ($ldap_bugs->entries) {
-  my $bug_title = $entry->get_value( "debbugsTitle" );
+$soap = SOAP::Lite->uri('Debbugs/SOAP')->proxy('http://bugs.debian.org/cgi-bin/soap.cgi')
+	or die "Unable to connect to SOAP: $!\n";
+$soap_bugs = $soap->get_bugs(
+	package=>'wnpp')->result;
+$soap_status = $soap->get_status($soap_bugs)->result() or die;
+
+foreach my $bug_nb (@$soap_bugs) {
+  my $bug_title =  $soap_status->{$bug_nb}->{subject};
   next unless defined $bug_title; # Bug sent without subject (#537751)
   if ($bug_title =~ /^O: ([+.a-z0-9-]+) -- .+$/) {
     $orphaned->{$1} = 1;
@@ -101,12 +97,14 @@
 }
 
 my $removed = {};
-$ldap = Net::LDAP->new( 'bts2ldap.debian.net', 'port' => 10101 ) or die "Unable to connect to ldap: $!\n";
-$ldap->bind;
-$ldap_bugs = $ldap->search( base => "dc=current,dc=bugs,dc=debian,dc=org" , filter => "(&(!(debbugsState=done))(debbugsPackage=ftp.debian.org))");
-$ldap->unbind;
-foreach my $entry ($ldap_bugs->entries) {
-  my $bug_title = $entry->get_value( "debbugsTitle" );
+$soap = SOAP::Lite->uri('Debbugs/SOAP')->proxy('http://bugs.debian.org/cgi-bin/soap.cgi')
+	or die "Unable to connect to SOAP: $!\n";
+$soap_bugs = $soap->get_bugs(
+	package=>'ftp.debian.org')->result;
+$soap_status = $soap->get_status($soap_bugs)->result() or die;
+
+foreach my $bug_nb (@$soap_bugs) {
+  my $bug_title = $soap_status->{$bug_nb}->{subject};
   next unless defined $bug_title; # Bug sent without subject (#537751)
   if ($bug_title =~ /^RM: ([+.a-z0-9-]+) -- .+$/) {
     $removed->{$1} = 1;




More information about the Debian-l10n-commits mailing list