| 1 |
# Copyright (C) 2001, 2002, 2004 Martin Michlmayr <tbm@cyrius.com>
|
| 2 |
# $Id$
|
| 3 |
|
| 4 |
# This program is free software; you can redistribute it and/or modify
|
| 5 |
# it under the terms of the GNU General Public License as published by
|
| 6 |
# the Free Software Foundation; either version 2 of the License, or
|
| 7 |
# (at your option) any later version.
|
| 8 |
|
| 9 |
# This program is distributed in the hope that it will be useful,
|
| 10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 12 |
# GNU General Public License for more details.
|
| 13 |
|
| 14 |
# You should have received a copy of the GNU General Public License
|
| 15 |
# along with this program; if not, write to the Free Software
|
| 16 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
| 17 |
|
| 18 |
|
| 19 |
import string, sys, time
|
| 20 |
import re
|
| 21 |
import ldap
|
| 22 |
|
| 23 |
config = "/srv/qa.debian.org/data/wnpp/wnpp.conf"
|
| 24 |
|
| 25 |
exists = [ 'O', 'RFA', 'ITA', 'RFH' ]
|
| 26 |
wanted = [ 'ITP', 'RFP' ]
|
| 27 |
valid = exists + wanted
|
| 28 |
|
| 29 |
severities = {'O': ('normal', 'important'), 'RFA': ('normal',),
|
| 30 |
'ITA': ('normal', 'important'), 'RFH': ('normal',), 'ITP': ('wishlist',),
|
| 31 |
'RFP': ('wishlist',)}
|
| 32 |
|
| 33 |
proper_subject = re.compile("(\w+):\s+(\S+) -- (.*)")
|
| 34 |
weak_subject = re.compile("(\w+):\s+(\S+)")
|
| 35 |
|
| 36 |
def query(attrs=('debbugsID', 'debbugsTitle', 'debbugsState', 'debbugsSeverity')):
|
| 37 |
try:
|
| 38 |
wnpp = ldap.open('bts2ldap.debian.net', 10101)
|
| 39 |
except ldap.LDAPError, error:
|
| 40 |
print "Cannot connect to LDAP server: %s" % error[1]
|
| 41 |
sys.exit(1)
|
| 42 |
base = 'dc=current,dc=bugs,dc=debian,dc=org'
|
| 43 |
try:
|
| 44 |
wnpp.bind(base, '', ldap.AUTH_SIMPLE)
|
| 45 |
except ldap.SERVER_DOWN:
|
| 46 |
print "Cannot connect to LDAP server"
|
| 47 |
sys.exit(1)
|
| 48 |
result = wnpp.search_s(base, ldap.SCOPE_BASE, '(debbugsPackage=wnpp)', attrs)
|
| 49 |
wnpp.unbind()
|
| 50 |
|
| 51 |
return result
|
| 52 |
|
| 53 |
def date2days(date):
|
| 54 |
return (int(time.time())-int(date))/86400
|
| 55 |
|
| 56 |
# vim: ts=4:expandtab:shiftwidth=4:
|