[master/rhel6] Add debug option to bumpver

Brian C. Lane bcl at redhat.com
Thu Sep 20 22:19:31 UTC 2012


From: "Brian C. Lane" <bcl at redhat.com>

---
 Makefile.am         |  3 +++
 scripts/makebumpver | 17 ++++++++++++++---
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 733a575..4f76895 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -76,6 +76,9 @@ bumpver: po-pull
 	if [ ! -z "$(MAP)" ]; then \
 		opts="$${opts} -m $(MAP)" ; \
 	fi ; \
+	if [ ! -z "$(BZDEBUG)" ]; then \
+		opts="$${opts} -d" ; \
+	fi ; \
 	scripts/makebumpver $${opts} || exit 1 ; \
 	$(MAKE) -C po $(PACKAGE_NAME).pot-update ; \
 	tx push $(TX_PUSH_ARGS)
diff --git a/scripts/makebumpver b/scripts/makebumpver
index e497fea..9fe577c 100755
--- a/scripts/makebumpver
+++ b/scripts/makebumpver
@@ -20,6 +20,11 @@
 #
 # Author: David Cantrell <dcantrell at redhat.com>
 
+import logging
+logging.basicConfig(level=logging.DEBUG)
+log = logging.getLogger("bugzilla")
+log.setLevel(logging.INFO)
+
 import bugzilla
 import datetime
 import getopt
@@ -32,6 +37,7 @@ import textwrap
 
 class MakeBumpVer:
     def __init__(self, *args, **kwargs):
+        log.debug("%s" % (kwargs,))
         self.bzserver = 'bugzilla.redhat.com'
         self.bzurl = "https://%s/xmlrpc.cgi" % self.bzserver
         self.username = None
@@ -134,9 +140,11 @@ class MakeBumpVer:
             print
 
         if not self.bz.logged_in:
-            self.bz.login(self.username, self.password)
+            rc = self.bz.login(self.username, self.password)
+            log.debug("login rc = %s" % (rc,))
 
         bugs = self.bz.query({'bug_id': bug})
+        log.debug("bugs = %s" % (bugs))
 
         if len(bugs) != 1:
             return None
@@ -372,6 +380,7 @@ def usage(cmd):
     sys.stdout.write("    -b, --bugreport  Bug reporting email address.\n")
     sys.stdout.write("    -i, --ignore     Comma separated list of git commits to ignore.\n")
     sys.stdout.write("    -m, --map        Comma separated list of FEDORA_BZ=RHEL_BZ mappings.\n")
+    sys.stdout.write("    -d, --debug      Turn on debug logging to stdout\n")
     sys.stdout.write("\nThe -i switch is intended for use with utility commits that we do not need to\n")
     sys.stdout.write("reference in the spec file changelog.  The -m switch is used to map a Fedora\n")
     sys.stdout.write("BZ number to a RHEL BZ number for the spec file changelog.  Use -m if you have\n")
@@ -389,10 +398,10 @@ def main(argv):
     opts, args = [], []
 
     try:
-        opts, args = getopt.getopt(sys.argv[1:], 'n:v:r:b:i:m:?',
+        opts, args = getopt.getopt(sys.argv[1:], 'n:v:r:b:i:m:d?',
                                    ['name=', 'version=', 'release=',
                                     'bugreport=', 'ignore=', 'map=',
-                                    'help'])
+                                    'debug', 'help'])
     except getopt.GetoptError:
         help = True
 
@@ -409,6 +418,8 @@ def main(argv):
             ignore = a
         elif o in ('-m', '--map'):
             bugmap = a
+        elif o in ('-d', '--debug'):
+            log.setLevel(logging.DEBUG)
         elif o in ('-?', '--help'):
             help = True
         else:
-- 
1.7.11.4



More information about the anaconda-patches mailing list