Le 28/05/2011 07:08, Christian PERRIER a écrit : > […] see if it could be adapted to another BTS gateway (such as UDD, probably). Here is a proposition, locally tested, to use the Debbugs' SOAP interface. Regards David
From a80bb3b4533ba023456a383b6cffaaac0fdf6a26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Pr=C3=A9vot?= <taffit@debian.org> Date: Sat, 28 May 2011 11:39:36 -0400 Subject: [PATCH] dl10n-nmu: use Debbugs/SOAP instead of bts2ldap --- dl10n-nmu | 62 +++++++++++++++++++++++++++++------------------------------- 1 files changed, 30 insertions(+), 32 deletions(-) diff --git a/dl10n-nmu b/dl10n-nmu index 90c11f1..5da655e 100755 --- a/dl10n-nmu +++ b/dl10n-nmu @@ -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@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,7 +13,7 @@ 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); @@ -20,10 +21,6 @@ my $generation_date = strftime('%a, %d %b %Y %H:%M:%S %z', gmtime); 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(); $data->read($DB_FILE); @@ -38,15 +35,11 @@ $comments->{normal} = " "; $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 @@ while (my $line = <POPCON>) { } } -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 @@ foreach my $entry ($ldap_bugs->entries) { } 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 @@ foreach my $entry ($ldap_bugs->entries) { } 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; -- 1.7.5.3
Attachment:
signature.asc
Description: OpenPGP digital signature