[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#574550: www.debian.org/devel/wnpp: move away from bts2ldap.debian.net



tag 574550 patch confirmed
severity 574550 normal
thanks

libsoap-lite-perl needs to be installed on www-master before applying
this patch.

Le 18/03/2010 19:02, Simon Paillard a écrit :

> As suggested by Andi below, bts2ldap.debian.net gateway should no longer
> be used.

I also noticed (after updating a bug title, and while comparing the
output produced before and the patch was applied) that the data of
bts2ldap.debian.net are actually outdated.

> Such scripts (like wnpp ones) should move to SOAP interface.

Couldn't find any other script relying on bts2ldap, so it should be enough.

Cheers

Index: wnpp.pl
===================================================================
RCS file: /cvsroot/webwml/webwml/english/devel/wnpp/wnpp.pl,v
retrieving revision 1.44
diff -u -r1.44 wnpp.pl
--- wnpp.pl	17 Mar 2010 22:30:49 -0000	1.44
+++ wnpp.pl	17 Apr 2011 21:08:12 -0000
@@ -7,29 +7,11 @@
 my $host = `hostname -f`;
 chomp($host);
 
-use Net::LDAP;
+use SOAP::Lite;
 use Date::Parse;
 use HTML::Entities;
 use Encode qw(decode);
 
-# this is ok this way.  It says which server to query, on which port and what
-# to fetch from it.  The attribs array could be reduced.
-
-my $server = "bts2ldap.debian.net";
-my $port = "10101";
-my $base   = "dc=current,dc=bugs,dc=debian,dc=org";
-my $attrs  = [
-    'debbugsID',
-    'debbugsTitle',
-    'debbugsSubmitter',
-    'debbugsPackage',
-    'debbugsSeverity',
-    'debbugsState',
-    'debbugsTag',
-    'debbugsDate',
-    'debbugsMergedWith',
-];
-
 # The maintainers flat database
 my $maintainers_file = "$(ENGLISHDIR)/devel/wnpp/Maintainers";
 
@@ -42,33 +24,27 @@
 }
 close MAINTAINERS;
 
-my $ldap = Net::LDAP->new($server, 'port' => $port) or die "Couldn't make connection to ldap server: $@";
-$ldap->bind;
-my $mesg = $ldap->search('base' => $base,
-                      'filter' => "(&(debbugsPackage=wnpp)(!(debbugsState=done))(!(debbugsState=archived)))",
-                      'attrs' => $attrs) or die;
+my $soap = SOAP::Lite->uri('Debbugs/SOAP')->proxy('http://bugs.debian.org/cgi-bin/soap.cgi')
+       or die "Couldn't make connection to SOAP insterface: $@";;
+my $bugs = $soap->get_bugs(package=>'wnpp')->result;
+my $status = $soap->get_status($bugs)->result() or die;
 
 my $curdate = time;
 
 my ( %rfa, %orphaned, %rfabymaint, %rfp, %ita, %itp, %age,
      %rfh, %oth );
- ALLPKG: foreach my $entry ($mesg->entries) {
+ ALLPKG: foreach my $bugid (@$bugs) {
      use integer;
-     my $bugid = @{$entry->get('debbugsID')}[0];
-     next if @{$entry->get('debbugsState')}[0] eq 'done';
-     next if @{$entry->get('debbugsState')}[0] eq 'archived';
-     my $subject = "";
-     $subject = decode("MIME-Header", @{$entry->get('debbugsTitle')}[0])
-     	if $entry->get('debbugsTitle');
+     next if $status->{$bugid}->{done};
+     next if $status->{$bugid}->{archived};
+     my $subject = $status->{$bugid}->{subject};
      # If a bug is merged with another, then only consider the youngest
      # bug and throw the others away.  This will weed out duplicates.
-     my @mergedwith = ();
-     @mergedwith = @{$entry->get('debbugsMergedWith')} if $entry->get('debbugsMergedWith');
-     foreach my $merged (@mergedwith) {
+     my $mergedwith = $status->{$bugid}->{mergedwith};
+     foreach my $merged (split ' ',$mergedwith) {
          next ALLPKG if int($merged) < int($bugid);
      }
-     $age{$bugid} = ($curdate - @{$entry->get('debbugsDate')}[0])/86400;    
-     chomp $subject;
+     $age{$bugid} = ($curdate - $status->{$bugid}->{date})/86400;
      $subject = encode_entities($subject);    
      # Make order out of chaos    
      if ($subject =~ m/^(?:ITO|RFA):\s*(\S+)(?:\s+-+\s+)?(.*)$/) {
@@ -95,8 +71,6 @@
      }
  }
 
-$ldap->unbind;
-
 my (@rfa_bypackage_html, @rfa_bymaint_html, @orphaned_html);
 my (@being_adopted_html, @being_packaged_html, @requested_html);
 my (@rfh_html, @oth_html);

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: