summaryrefslogtreecommitdiffstats
path: root/src/Backtrace
diff options
context:
space:
mode:
authorKarel Klic <kklic@redhat.com>2010-02-04 14:30:14 +0100
committerKarel Klic <kklic@redhat.com>2010-02-04 14:30:14 +0100
commit03e15f123bf93fe378494fd64ed38ce609827b0b (patch)
tree3a23eda5539de18360054cc0b4c66ffdf5a8ced6 /src/Backtrace
parentd87b8b675af47aa95401ff90764d3331d1aea57c (diff)
downloadabrt-03e15f123bf93fe378494fd64ed38ce609827b0b.tar.gz
abrt-03e15f123bf93fe378494fd64ed38ce609827b0b.tar.xz
abrt-03e15f123bf93fe378494fd64ed38ce609827b0b.zip
Script which checkes duplicate ABRT hashes in Bugzilla
Diffstat (limited to 'src/Backtrace')
-rwxr-xr-xsrc/Backtrace/abrt-bz-hashchecker54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/Backtrace/abrt-bz-hashchecker b/src/Backtrace/abrt-bz-hashchecker
new file mode 100755
index 00000000..fcd18c24
--- /dev/null
+++ b/src/Backtrace/abrt-bz-hashchecker
@@ -0,0 +1,54 @@
+#!/usr/bin/python
+# -*- mode:python -*-
+# Checks how many bugs in Bugzilla have the same hash.
+#
+# Please do not run this script unless it's neccessary to do so.
+# It forces Bugzilla to send data related to thousands of bug reports.
+
+from bugzilla import RHBugzilla
+from optparse import OptionParser
+import sys
+import os.path
+import subprocess
+import re
+
+parser = OptionParser(version="%prog 1.0")
+parser.add_option("-u", "--user", dest="user",
+ help="Bugzilla user name (REQUIRED)", metavar="USERNAME")
+parser.add_option("-p", "--password", dest="password",
+ help="Bugzilla password (REQUIRED)", metavar="PASSWORD")
+parser.add_option("-b", "--bugzilla", dest="bugzilla",
+ help="Bugzilla URL (defaults to Red Hat Bugzilla)", metavar="URL")
+
+(options, args) = parser.parse_args()
+
+if not options.user or len(options.user) == 0:
+ parser.error("User name is required.\nTry {0} --help".format(sys.argv[0]))
+
+if not options.password or len(options.password) == 0:
+ parser.error("Password is required.\nTry {0} --help".format(sys.argv[0]))
+
+if not options.bugzilla or len(options.bugzilla) == 0:
+ options.bugzilla = "https://bugzilla.redhat.com/xmlrpc.cgi"
+
+bz = RHBugzilla()
+bz.connect(options.bugzilla)
+bz.login(options.user, options.password)
+
+buginfos = bz.query({'status_whiteboard_type':'allwordssubstr','status_whiteboard':'abrt_hash'})
+
+print "{0} bugs found.".format(len(buginfos))
+
+hashes = {}
+for buginfo in buginfos:
+ hash = re.match("abrt_hash:([^ ]+)", buginfo.status_whiteboard).group(1)
+ if hash in hashes:
+ hashes[hash].append(buginfo.bug_id)
+ else:
+ hashes[hash] = [ buginfo.bug_id ]
+ print hash
+bz.logout()
+
+for hash, ids in hashes.items():
+ if len(ids) > 1:
+ print "Duplicates found: ", ids.join(", ")