X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Futils.py;fp=daklib%2Futils.py;h=7ed4089a4dd2610a09a7c5f7a3852eda987b5456;hb=0728f1b55afc80016fe27fada8dc78e635d26c60;hp=c9b54d078db3bc6b85e05e214823eb8b54f2aa74;hpb=a4364fe0acd8ea0c57deb060849318c06154575f;p=dak.git diff --git a/daklib/utils.py b/daklib/utils.py index c9b54d07..7ed4089a 100755 --- a/daklib/utils.py +++ b/daklib/utils.py @@ -1536,3 +1536,38 @@ if not os.getenv("DAK_TEST"): if which_conf_file() != default_config: apt_pkg.ReadConfigFileISC(Cnf,which_conf_file()) + +################################################################################ + +def parse_wnpp_bug_file(file = "/srv/ftp-master.debian.org/scripts/masterfiles/wnpp_rm"): + """ + Parses the wnpp bug list available at http://qa.debian.org/data/bts/wnpp_rm + Well, actually it parsed a local copy, but let's document the source + somewhere ;) + + returns a dict associating source package name with a list of open wnpp + bugs (Yes, there might be more than one) + """ + + line = [] + try: + f = open(file) + lines = f.readlines() + except IOerror, e: + print "Warning: Couldn't open %s; don't know about WNPP bugs, so won't close any." % file + lines = [] + wnpp = {} + + for line in lines: + splited_line = line.split(": ", 1) + if len(splited_line) > 1: + wnpp[splited_line[0]] = splited_line[1].split("|") + + for source in wnpp.keys(): + bugs = [] + for wnpp_bug in wnpp[source]: + bug_no = re.search("(\d)+", wnpp_bug).group() + if bug_no: + bugs.append(bug_no) + wnpp[source] = bugs + return wnpp