| 1 |
#!/usr/bin/env python |
#!/usr/bin/env python |
| 2 |
|
|
| 3 |
# Show all bugs with a specific keyword |
# Show all bugs with a specific keyword |
| 4 |
# Copyright (C) 2002 Martin Michlmayr <tbm@cyrius.com> |
# Copyright (C) 2002, 2004 Martin Michlmayr <tbm@cyrius.com> |
| 5 |
# $Id$ |
# $Id$ |
| 6 |
|
|
| 7 |
# This program is free software; you can redistribute it and/or modify |
# This program is free software; you can redistribute it and/or modify |
| 60 |
|
|
| 61 |
def main(keywords): |
def main(keywords): |
| 62 |
try: |
try: |
| 63 |
bts = ldap.open("bugs.debian.org", 35567) |
bts = ldap.open("master.debian.org", 10101) |
| 64 |
except ldap.LDAPError, error: |
except ldap.LDAPError, error: |
| 65 |
print "Cannot connect to LDAP server: %s" % error[1] |
print "Cannot connect to LDAP server: %s" % error[1] |
| 66 |
sys.exit(1) |
sys.exit(1) |
| 67 |
base = "ou=Bugs,o=Debian Project,c=US" |
base = "dc=current,dc=bugs,dc=debian,dc=org" |
| 68 |
bts.bind(base, "", ldap.AUTH_SIMPLE) |
bts.bind(base, "", ldap.AUTH_SIMPLE) |
| 69 |
attrs = ["package", "bugid", "subject", "done", "severity", "keywords"] |
attrs = ["debbugsPackage", "debbugsID", "debbugsTitle", "debbugsState", "debbugsSeverity", "debbugsTag"] |
| 70 |
# Create a well formed LDAP query |
# Create a well formed LDAP query |
| 71 |
query = string.join(map(lambda tag: "(keywords=*%s*)" % tag, keywords), "") |
query = string.join(map(lambda tag: "(debbugsTag=%s)" % tag, keywords), "") |
| 72 |
if len(keywords) > 1: |
if len(keywords) > 1: |
| 73 |
if int(Options["All-Keywords"]): |
if int(Options["All-Keywords"]): |
| 74 |
logic_op = "&" |
logic_op = "&" |
| 99 |
info = {} |
info = {} |
| 100 |
bugs_per_package = {} |
bugs_per_package = {} |
| 101 |
for _, dict in result: |
for _, dict in result: |
| 102 |
if dict.has_key("done") or (dict.has_key("keywords") and ("fixed" in string.split(dict["keywords"][0], " "))): |
if dict["debbugsState"] == "done": |
| 103 |
continue |
continue |
| 104 |
bugid = int(dict["bugid"][0]) |
if dict.has_key("debbugsTag") and "fixed" in dict["debbugsTag"]: |
| 105 |
package = string.strip(dict["package"][0]) |
continue |
| 106 |
|
bugid = int(dict["debbugsID"][0]) |
| 107 |
|
package = string.strip(dict["debbugsPackage"][0]) |
| 108 |
if not bugs_per_package.has_key(package): |
if not bugs_per_package.has_key(package): |
| 109 |
bugs_per_package[package] = [] |
bugs_per_package[package] = [] |
| 110 |
bugs_per_package[package].append(bugid) |
bugs_per_package[package].append(bugid) |
| 111 |
info[bugid] = {} |
info[bugid] = {} |
| 112 |
info[bugid]["package"] = package |
info[bugid]["package"] = package |
| 113 |
info[bugid]["subject"] = dict["subject"][0] |
info[bugid]["subject"] = dict["debbugsTitle"][0] |
| 114 |
info[bugid]["keywords"] = dict.get("keywords", [""])[0] |
info[bugid]["keywords"] = dict.get("debbugsTags", [""]) |
| 115 |
info[bugid]["severity"] = dict["severity"][0] |
info[bugid]["severity"] = dict["debbugsSeverity"][0] |
| 116 |
bug_count = bug_count + 1 |
bug_count = bug_count + 1 |
| 117 |
|
|
| 118 |
if Options["File"]: |
if Options["File"]: |