diff --git a/0006-cli-speedup-request-outputformat-fields-when-doing-q.patch b/0006-cli-speedup-request-outputformat-fields-when-doing-q.patch new file mode 100644 index 0000000..408fc2c --- /dev/null +++ b/0006-cli-speedup-request-outputformat-fields-when-doing-q.patch @@ -0,0 +1,60 @@ +From 94338c8d931cae0d40a0343ec85018b36f7c8695 Mon Sep 17 00:00:00 2001 +From: Will Woods +Date: Mon, 13 Jun 2011 13:15:06 -0400 +Subject: [PATCH 06/17] cli speedup: request --outputformat fields when doing + query + +Add the fields listed in --outputformat to the query's 'column_list' +argument. This should give us all the data we want to display right in +the query result, which should greatly speed up query --outputformat. +--- + bin/bugzilla | 14 +++++++++++--- + 1 files changed, 11 insertions(+), 3 deletions(-) + +diff --git a/bin/bugzilla b/bin/bugzilla +index e0810eb..833c5a2 100755 +--- a/bin/bugzilla ++++ b/bin/bugzilla +@@ -41,6 +41,8 @@ def to_encoding(ustring): + return ustring + return u'' + ++format_field_re = re.compile("%{([a-z0-9_]+)(?::([^}]*))?}") ++ + def setup_parser(): + u = "%prog [global options] COMMAND [command-options]" + u += "\nCommands: %s" % ', '.join(cmdlist) +@@ -551,6 +553,14 @@ def main(): + if opt.output == 'oneline': + q['column_list'] = [ 'bug_id', 'bug_status', 'assigned_to', 'component', + 'target_milestone', 'short_desc', 'flags', 'keywords', 'blockedby' ] ++ if opt.outputformat: ++ aliases = dict(bz.field_aliases) ++ for fieldname, sub in format_field_re.findall(opt.outputformat): ++ fields.append(fieldname) ++ if fieldname in aliases: ++ fields.append(aliases.get(fieldname)) ++ q['column_list'] = fields ++ + log.debug("bz.query: %s", q) + if not q: + parser.error("'query' command requires additional arguments") +@@ -692,14 +702,12 @@ def main(): + # If we're doing new/query/modify, output our results + if action in ['new','query']: + if opt.outputformat: +- format_field_re = re.compile("%{([a-z0-9_]+)(?::([^}]*))?}") + special_fields = { + 'flag': lambda b,f: b.get_flag_status(f), + 'whiteboard': lambda b,wb: b.getwhiteboard(wb), + } + def bug_field(matchobj): +- fieldname = matchobj.group(1) +- rest = matchobj.group(2) ++ (fieldname, rest) = matchobj.groups() + + if special_fields.has_key(fieldname): + val = special_fields[fieldname](b, rest) +-- +1.7.6 + diff --git a/0007-fixup-for-cli-speedup-with-query-outputformat.patch b/0007-fixup-for-cli-speedup-with-query-outputformat.patch new file mode 100644 index 0000000..15e7aec --- /dev/null +++ b/0007-fixup-for-cli-speedup-with-query-outputformat.patch @@ -0,0 +1,33 @@ +From 1a37173fc0e63f116878d6e99718ae12708a3174 Mon Sep 17 00:00:00 2001 +From: Will Woods +Date: Mon, 13 Jun 2011 18:02:27 -0400 +Subject: [PATCH 07/17] fixup for cli speedup with query --outputformat + +Forgot to initialize a variable. whoops. +--- + bin/bugzilla | 7 ++++--- + 1 files changed, 4 insertions(+), 3 deletions(-) + +diff --git a/bin/bugzilla b/bin/bugzilla +index 833c5a2..b0eeeaa 100755 +--- a/bin/bugzilla ++++ b/bin/bugzilla +@@ -555,11 +555,12 @@ def main(): + 'target_milestone', 'short_desc', 'flags', 'keywords', 'blockedby' ] + if opt.outputformat: + aliases = dict(bz.field_aliases) ++ req_fields = [] + for fieldname, sub in format_field_re.findall(opt.outputformat): +- fields.append(fieldname) ++ req_fields.append(fieldname) + if fieldname in aliases: +- fields.append(aliases.get(fieldname)) +- q['column_list'] = fields ++ req_fields.append(aliases.get(fieldname)) ++ q['column_list'] = req_fields + + log.debug("bz.query: %s", q) + if not q: +-- +1.7.6 + diff --git a/0012-Fix-for-httplib-xmlrpclib-changes-in-py2.7.patch b/0012-Fix-for-httplib-xmlrpclib-changes-in-py2.7.patch deleted file mode 100644 index 34c43a7..0000000 --- a/0012-Fix-for-httplib-xmlrpclib-changes-in-py2.7.patch +++ /dev/null @@ -1,104 +0,0 @@ -From 120e4196f219ad92358a279c42bb771b3a9aad9e Mon Sep 17 00:00:00 2001 -From: Will Woods -Date: Thu, 5 Aug 2010 14:10:46 -0400 -Subject: [PATCH 12/19] Fix for httplib/xmlrpclib changes in py2.7 - ---- - bugzilla/base.py | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++-- - 1 files changed, 67 insertions(+), 3 deletions(-) - -diff --git a/bugzilla/base.py b/bugzilla/base.py -index 7f2bb88..d1a6d61 100644 ---- a/bugzilla/base.py -+++ b/bugzilla/base.py -@@ -936,9 +936,9 @@ class CookieTransport(xmlrpclib.Transport): - else: - log.debug("send_cookies(): cookiejar empty. Nothing to send.") - -- # This is the same request() method from xmlrpclib.Transport, -+ # This is the same request() method from python 2.6's xmlrpclib.Transport, - # with a couple additions noted below -- def request(self, host, handler, request_body, verbose=0): -+ def request_with_cookies(self, host, handler, request_body, verbose=0): - h = self.make_connection(host) - if verbose: - h.set_debuglevel(1) -@@ -985,10 +985,74 @@ class CookieTransport(xmlrpclib.Transport): - - return self._parse_response(h.getfile(), sock) - -+ # This is just python 2.7's xmlrpclib.Transport.single_request, with -+ # send additions noted below to send cookies along with the request -+ def single_request_with_cookies(self, host, handler, request_body, verbose=0): -+ h = self.make_connection(host) -+ if verbose: -+ h.set_debuglevel(1) -+ -+ # ADDED: construct the URL and Request object for proper cookie handling -+ request_url = "%s://%s%s" % (self.scheme,host,handler) -+ log.debug("request_url is %s" % request_url) -+ cookie_request = urllib2.Request(request_url) -+ -+ try: -+ self.send_request(h,handler,request_body) -+ self.send_host(h,host) -+ self.send_cookies(h,cookie_request) # ADDED. creates cookiejar if None. -+ self.send_user_agent(h) -+ self.send_content(h,request_body) -+ -+ response = h.getresponse(buffering=True) -+ -+ # ADDED: parse headers and get cookies here -+ cookie_response = CookieResponse(response.msg) -+ # Okay, extract the cookies from the headers -+ self.cookiejar.extract_cookies(cookie_response,cookie_request) -+ log.debug("cookiejar now contains: %s" % self.cookiejar._cookies) -+ # And write back any changes -+ if hasattr(self.cookiejar,'save'): -+ try: -+ self.cookiejar.save(self.cookiejar.filename) -+ except Exception, e: -+ log.error("Couldn't write cookiefile %s: %s" % \ -+ (self.cookiejar.filename,str(e))) -+ -+ if response.status == 200: -+ self.verbose = verbose -+ return self.parse_response(response) -+ except xmlrpclib.Fault: -+ raise -+ except Exception: -+ # All unexpected errors leave connection in -+ # a strange state, so we clear it. -+ self.close() -+ raise -+ -+ #discard any response data and raise exception -+ if (response.getheader("content-length", 0)): -+ response.read() -+ raise xmlrpclib.ProtocolError( -+ host + handler, -+ response.status, response.reason, -+ response.msg, -+ ) -+ -+ # Override the appropriate request method -+ if hasattr(xmlrpclib.Transport, 'single_request'): -+ single_request = single_request_with_cookies # python 2.7+ -+ else: -+ request = request_with_cookies # python 2.6 and earlier -+ - class SafeCookieTransport(xmlrpclib.SafeTransport,CookieTransport): - '''SafeTransport subclass that supports cookies.''' - scheme = 'https' -- request = CookieTransport.request -+ # Override the appropriate request method -+ if hasattr(xmlrpclib.Transport, 'single_request'): -+ single_request = CookieTransport.single_request_with_cookies -+ else: -+ request = CookieTransport.request_with_cookies - - class _User(object): - '''Container object for a bugzilla User. --- -1.7.4.1 - diff --git a/0016-obfuscated-password-support-in-oscrc.patch b/0013-obfuscated-password-support-in-oscrc.patch similarity index 92% rename from 0016-obfuscated-password-support-in-oscrc.patch rename to 0013-obfuscated-password-support-in-oscrc.patch index 6e70bf6..bb16154 100644 --- a/0016-obfuscated-password-support-in-oscrc.patch +++ b/0013-obfuscated-password-support-in-oscrc.patch @@ -1,7 +1,7 @@ -From b8de888a2b4aad939ff4373893210334e581f270 Mon Sep 17 00:00:00 2001 +From 89ca368861e9570639e6873c1c51fb3936dd77d9 Mon Sep 17 00:00:00 2001 From: Michal Vyskocil Date: Wed, 26 Aug 2009 11:08:36 +0200 -Subject: [PATCH 16/19] obfuscated password support in oscrc +Subject: [PATCH 13/17] obfuscated password support in oscrc The osc client introduced an obfuscated passwords (not secure, but many times requested by a community), so this patch to readconfig method adds @@ -13,7 +13,7 @@ about read or not. 1 files changed, 9 insertions(+), 2 deletions(-) diff --git a/bugzilla/nvlbugzilla.py b/bugzilla/nvlbugzilla.py -index 35202a4..0d88db1 100644 +index ec2b74a..8a64f81 100644 --- a/bugzilla/nvlbugzilla.py +++ b/bugzilla/nvlbugzilla.py @@ -138,11 +138,18 @@ If you want cache the cookies and speedup the repeated connections, remove it or @@ -46,5 +46,5 @@ index 35202a4..0d88db1 100644 except NoOptionError, ne: return -- -1.7.4.1 +1.7.6 diff --git a/0017-fix-typo-in-url-argument.patch b/0014-fix-typo-in-url-argument.patch similarity index 82% rename from 0017-fix-typo-in-url-argument.patch rename to 0014-fix-typo-in-url-argument.patch index 77a44ce..e722c2c 100644 --- a/0017-fix-typo-in-url-argument.patch +++ b/0014-fix-typo-in-url-argument.patch @@ -1,14 +1,14 @@ -From 77bbfe33af859cde6a0cf3423aa5f52748dfed50 Mon Sep 17 00:00:00 2001 +From eab4135a4611823423c1077e8a072943fd6025e9 Mon Sep 17 00:00:00 2001 From: Michal Vyskocil Date: Fri, 4 Sep 2009 09:54:42 +0200 -Subject: [PATCH 17/19] fix typo in url argument +Subject: [PATCH 14/17] fix typo in url argument --- bugzilla/nvlbugzilla.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/bugzilla/nvlbugzilla.py b/bugzilla/nvlbugzilla.py -index 0d88db1..fe15fd6 100644 +index 8a64f81..6af3238 100644 --- a/bugzilla/nvlbugzilla.py +++ b/bugzilla/nvlbugzilla.py @@ -57,7 +57,7 @@ class NovellBugzilla(Bugzilla32): @@ -21,5 +21,5 @@ index 0d88db1..fe15fd6 100644 def __get_expiration(self): return self._expires -- -1.7.4.1 +1.7.6 diff --git a/0018-novell-bugzilla-support-in-getBugzillaClassForURL.patch b/0015-novell-bugzilla-support-in-getBugzillaClassForURL.patch similarity index 79% rename from 0018-novell-bugzilla-support-in-getBugzillaClassForURL.patch rename to 0015-novell-bugzilla-support-in-getBugzillaClassForURL.patch index 9e0de21..a9f9b2c 100644 --- a/0018-novell-bugzilla-support-in-getBugzillaClassForURL.patch +++ b/0015-novell-bugzilla-support-in-getBugzillaClassForURL.patch @@ -1,14 +1,14 @@ -From ccea238ede22c81100c0456ede42642f2f82947b Mon Sep 17 00:00:00 2001 +From ba5277024722c6083e10ddce5e070cb622572148 Mon Sep 17 00:00:00 2001 From: Jan Matejek Date: Mon, 23 May 2011 14:20:57 +0200 -Subject: [PATCH 18/19] novell bugzilla support in getBugzillaClassForURL +Subject: [PATCH 15/17] novell bugzilla support in getBugzillaClassForURL --- bugzilla/__init__.py | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/bugzilla/__init__.py b/bugzilla/__init__.py -index 97d8706..8b26835 100644 +index f60fd54..a3a88d2 100644 --- a/bugzilla/__init__.py +++ b/bugzilla/__init__.py @@ -23,6 +23,9 @@ classlist = ['Bugzilla3', 'Bugzilla32', 'Bugzilla34', 'Bugzilla36', @@ -22,5 +22,5 @@ index 97d8706..8b26835 100644 rhbz = False bzversion = '' -- -1.7.4.1 +1.7.6 diff --git a/0019-novell-bugzilla-run-on-3.4.patch b/0016-novell-bugzilla-run-on-3.4.patch similarity index 86% rename from 0019-novell-bugzilla-run-on-3.4.patch rename to 0016-novell-bugzilla-run-on-3.4.patch index 2591712..0ec027a 100644 --- a/0019-novell-bugzilla-run-on-3.4.patch +++ b/0016-novell-bugzilla-run-on-3.4.patch @@ -1,14 +1,14 @@ -From 82b1b6bdac75814fc94843934d9cfe4fcdef06d4 Mon Sep 17 00:00:00 2001 +From 514cdd0c94644d1096ae248b8bc4e45c5986e486 Mon Sep 17 00:00:00 2001 From: Michal Vyskocil Date: Mon, 23 May 2011 14:24:58 +0200 -Subject: [PATCH] novell bugzilla run on 3.4 +Subject: [PATCH 16/17] novell bugzilla run on 3.4 --- bugzilla/nvlbugzilla.py | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bugzilla/nvlbugzilla.py b/bugzilla/nvlbugzilla.py -index fe15fd6..4acae00 100644 +index 6af3238..62b75b7 100644 --- a/bugzilla/nvlbugzilla.py +++ b/bugzilla/nvlbugzilla.py @@ -11,7 +11,7 @@ @@ -32,5 +32,5 @@ index fe15fd6..4acae00 100644 reimplements a login method which is compatible with iChain. -- -1.7.4.1 +1.7.6 diff --git a/0017-allow-various-bnc-instances-in-NovellBugzilla.patch b/0017-allow-various-bnc-instances-in-NovellBugzilla.patch new file mode 100644 index 0000000..5b98a4f --- /dev/null +++ b/0017-allow-various-bnc-instances-in-NovellBugzilla.patch @@ -0,0 +1,52 @@ +From 25f24e68d5005b500dd000f90ae5ebec8a2ba70d Mon Sep 17 00:00:00 2001 +From: Michal Vyskocil +Date: Thu, 26 May 2011 11:00:33 +0200 +Subject: [PATCH 17/17] allow various bnc instances in NovellBugzilla + +The older NovellBugzilla implementation was limited to +bugzilla.novell.com, so using of internal testing instace was not +possible. So code in NovellBugzilla.__init__ and getBugzillaClassForURL +search for 'novell.com' string only. + +In adition NovellBugzilla.__init__ add a url= argument to kwargs if not +exists or if it does not contain novell.com, so this class can be simple +instantiated without arguments in some cases. +--- + bugzilla/__init__.py | 2 +- + bugzilla/nvlbugzilla.py | 6 ++++-- + 2 files changed, 5 insertions(+), 3 deletions(-) + +diff --git a/bugzilla/__init__.py b/bugzilla/__init__.py +index a3a88d2..fcfffd6 100644 +--- a/bugzilla/__init__.py ++++ b/bugzilla/__init__.py +@@ -23,7 +23,7 @@ classlist = ['Bugzilla3', 'Bugzilla32', 'Bugzilla34', 'Bugzilla36', + + def getBugzillaClassForURL(url): + log.debug("Choosing subclass for %s" % url) +- if url.startswith('https://bugzilla.novell.com'): ++ if 'novell.com' in url: + return NovellBugzilla + + s = xmlrpclib.ServerProxy(url) +diff --git a/bugzilla/nvlbugzilla.py b/bugzilla/nvlbugzilla.py +index 62b75b7..15879f1 100644 +--- a/bugzilla/nvlbugzilla.py ++++ b/bugzilla/nvlbugzilla.py +@@ -55,9 +55,11 @@ class NovellBugzilla(Bugzilla34): + + def __init__(self, expires=300, **kwargs): + self._expires = expires ++ # allow proper usage of NovellBugzilla with a wrong url argument ++ # (without it or with an another location) ++ if not 'novell.com' in kwargs.get('url', ''): ++ kwargs['url'] = self.__class__.bugzilla_url + super(NovellBugzilla, self).__init__(**kwargs) +- # url argument exists only for backward compatibility, but is always set to same url +- self.url = self.__class__.bugzilla_url + + def __get_expiration(self): + return self._expires +-- +1.7.6 + diff --git a/python-bugzilla-0.6.1.tar.bz2 b/python-bugzilla-0.6.1.tar.bz2 deleted file mode 100644 index 78b32df..0000000 --- a/python-bugzilla-0.6.1.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f17e9dad067461d070a27b17c917b7ae20e6bbf1d7db561b2a8608c9aa4a1d03 -size 38743 diff --git a/python-bugzilla-0.6.2.tar.bz2 b/python-bugzilla-0.6.2.tar.bz2 new file mode 100644 index 0000000..d0e8958 --- /dev/null +++ b/python-bugzilla-0.6.2.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ac9f6e9761a3b05a57cee6c9a4260b0a50765d30a70205ebd1d8483b89f60f81 +size 40391 diff --git a/python-bugzilla.changes b/python-bugzilla.changes index b5d36bb..519d4b6 100644 --- a/python-bugzilla.changes +++ b/python-bugzilla.changes @@ -1,3 +1,15 @@ +------------------------------------------------------------------- +Fri Jul 29 09:04:07 UTC 2011 - mvyskocil@suse.cz + +- update to 0.6.2, rebased all patches + * backport --outputformat feature from git + +------------------------------------------------------------------- +Fri Jul 29 08:50:47 UTC 2011 - mvyskocil@suse.cz + +- add 0005-Add-Bugzilla34._query.patch fixing query command +- add 0020-allow-various-bnc-instances-in-NovellBugzilla.patch + ------------------------------------------------------------------- Mon May 23 12:36:47 UTC 2011 - mvyskocil@suse.cz diff --git a/python-bugzilla.spec b/python-bugzilla.spec index 2f23e22..859d626 100644 --- a/python-bugzilla.spec +++ b/python-bugzilla.spec @@ -19,7 +19,7 @@ Name: python-bugzilla -Version: 0.6.1 +Version: 0.6.2 Release: 1 Summary: Python library for bugzilla Group: Development/Libraries/Python @@ -28,12 +28,14 @@ Url: https://fedorahosted.org/python-bugzilla/ Source: https://fedorahosted.org/releases/p/y/python-bugzilla/%{name}-%{version}.tar.bz2 # generated from python-bugzilla/suse # https://gitorious.org/opensuse/python-bugzilla/commits/suse -# cherry-picked patches from git format-patch suse...0.6.1 -Patch0: 0012-Fix-for-httplib-xmlrpclib-changes-in-py2.7.patch -Patch1: 0016-obfuscated-password-support-in-oscrc.patch -Patch2: 0017-fix-typo-in-url-argument.patch -Patch3: 0018-novell-bugzilla-support-in-getBugzillaClassForURL.patch -Patch4: 0019-novell-bugzilla-run-on-3.4.patch +# cherry-picked patches from git format-patch 0.6.2...suse +Patch0: 0006-cli-speedup-request-outputformat-fields-when-doing-q.patch +Patch1: 0007-fixup-for-cli-speedup-with-query-outputformat.patch +Patch2: 0013-obfuscated-password-support-in-oscrc.patch +Patch3: 0014-fix-typo-in-url-argument.patch +Patch4: 0015-novell-bugzilla-support-in-getBugzillaClassForURL.patch +Patch5: 0016-novell-bugzilla-run-on-3.4.patch +Patch6: 0017-allow-various-bnc-instances-in-NovellBugzilla.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: python-devel BuildArch: noarch @@ -57,6 +59,8 @@ but gosh - why not just write something in Python instead? %patch2 -p1 %patch3 -p1 %patch4 -p1 +%patch5 -p1 +%patch6 -p1 %build export CFLAGS="%{optflags}"