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

Adding RC information (qa.d.o/orphaned.html).



Hi list,

I'm extending gen-orphaned a qa script[0] (tbm wrote) that can 
be seen in action at qa.d.o/orphaned.html. I've some comments:

- I did a rc.py (see attached) that is something like wnpp.py.

- Look at rc.py code, i guess that we can merge rc.py:query()
and wnpp.py:query() it requires change each call to 
wnpp.py:query().Do you see?

- I'm not sending a gen-orphaned patch as suggested by tbm 
because i'm not sure that i can test it without doing something
really wrong.


Question about gen-orphaned: I guess that i can add the RC info
at orphaned[package] (line 86) writing it to orphaned.txt in the
end. right?  Not sure about the output format and what is needed to
change in orphaned.wml.

[0] = cvs.d.o:qa/data/wnpp


Thanks,
Gustavo Franco -- <stratus@debian.org>
#!/usr/bin/env python

# Copyright (C) 2001, 2002, 2004  Martin Michlmayr <tbm@cyrius.com>
# Copyright (C) 2005  Gustavo Franco <stratus@debian.org>
# $Id$

# 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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

# TODO:
# - Add has_"release"_rc() function to display RC bugs considered only for
#   "release" (e.g: sarge).

import sys
import ldap

rc = [ 'critical', 'grave', 'serious' ]

def query(package,attrs=('debbugsID', 'debbugsTitle', 'debbugsState', 'debbugsSeverity')):
    try:
        bts = ldap.open('bugs.debian.org', 10101)
    except ldap.LDAPError, error:
        print "Cannot connect to LDAP server: %s" % error[1]
        sys.exit(1)
    base = 'dc=current,dc=bugs,dc=debian,dc=org'
    try:
        bts.bind(base, '', ldap.AUTH_SIMPLE)
    except ldap.SERVER_DOWN:
        print "Cannot connect to LDAP server"
        sys.exit(1)
    result = bts.search_s(base, ldap.SCOPE_BASE, '(debbugsPackage=' + package + ')', attrs)
    bts.unbind()

    return result

def has_rc(package):
    ldap_result = query(package, ['debbugsID', 'debbugsState', 'debbugsSeverity'])

    if not ldap_result:
        print 'Problem with LDAP search'
        sys.exit(1)
    else:
        buginfo = {}
	rcinfo = [] 
        for _, dict in ldap_result: 
            if not dict:
                continue

            if dict['debbugsState'][0] == 'done':
                continue
	    
	    bugid = int(dict['debbugsID'][0])
            severity = dict['debbugsSeverity'][0]
            
            if severity in rc:
		buginfo = { 'bugid' : bugid, 'severity' : severity }
		rcinfo.append(buginfo)
		
    return rcinfo

if __name__ == '__main__':
    
    if len(sys.argv) == 2:
        rcinfo = has_rc(sys.argv[1])
        if rcinfo:
            print sys.argv[1] + " has rc bug(s) - ",
	    for rcbug in rcinfo:
	        print "#" + str(rcbug['bugid']),
	    print	
        else:
            print sys.argv[1] + " hasn't rc bug."
            
    else:
        print """Usage: rc <package>
Check if <package> has release critical bug(s) reported.

Example: rc libc6
"""

Reply to: