diff --git a/0006-cli-speedup-request-outputformat-fields-when-doing-q.patch b/0006-cli-speedup-request-outputformat-fields-when-doing-q.patch deleted file mode 100644 index 408fc2c..0000000 --- a/0006-cli-speedup-request-outputformat-fields-when-doing-q.patch +++ /dev/null @@ -1,60 +0,0 @@ -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 deleted file mode 100644 index 15e7aec..0000000 --- a/0007-fixup-for-cli-speedup-with-query-outputformat.patch +++ /dev/null @@ -1,33 +0,0 @@ -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/0013-obfuscated-password-support-in-oscrc.patch b/0013-obfuscated-password-support-in-oscrc.patch deleted file mode 100644 index bb16154..0000000 --- a/0013-obfuscated-password-support-in-oscrc.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 89ca368861e9570639e6873c1c51fb3936dd77d9 Mon Sep 17 00:00:00 2001 -From: Michal Vyskocil -Date: Wed, 26 Aug 2009 11:08:36 +0200 -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 -an ability to read passx options. -It also fixes a small (but mandatory bug) in a condition which decides -about read or not. ---- - bugzilla/nvlbugzilla.py | 11 +++++++++-- - 1 files changed, 9 insertions(+), 2 deletions(-) - -diff --git a/bugzilla/nvlbugzilla.py b/bugzilla/nvlbugzilla.py -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 - for cookie in self._iter_domain_cookies(): - cookie.expires = 0 - -+ @classmethod -+ def _read_osc_password(cls, c): -+ # supports obfuscated passwords introduced in osc-0.121 -+ if c.has_option(cls.obs_url, 'passx'): -+ return c.get(cls.obs_url, 'passx').decode('base64').decode('bz2') -+ return c.get(cls.obs_url, 'pass') -+ - def readconfig(self, configpath=None): - super(NovellBugzilla, self).readconfig(configpath) - - oscrc=os.path.expanduser('~/.oscrc') -- if not self.user and not self.password \ -+ if not self.user or not self.password \ - and os.path.exists(oscrc): - from ConfigParser import SafeConfigParser, NoOptionError - c = SafeConfigParser() -@@ -156,7 +163,7 @@ If you want cache the cookies and speedup the repeated connections, remove it or - - try: - self.user = c.get(obs_url, 'user') -- self.password = c.get(obs_url, 'pass') -+ self.password = self._read_osc_password(c) - bugzilla.base.log.info("Read credentials from ~/.oscrc") - except NoOptionError, ne: - return --- -1.7.6 - diff --git a/0014-fix-typo-in-url-argument.patch b/0014-fix-typo-in-url-argument.patch deleted file mode 100644 index e722c2c..0000000 --- a/0014-fix-typo-in-url-argument.patch +++ /dev/null @@ -1,25 +0,0 @@ -From eab4135a4611823423c1077e8a072943fd6025e9 Mon Sep 17 00:00:00 2001 -From: Michal Vyskocil -Date: Fri, 4 Sep 2009 09:54:42 +0200 -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 8a64f81..6af3238 100644 ---- a/bugzilla/nvlbugzilla.py -+++ b/bugzilla/nvlbugzilla.py -@@ -57,7 +57,7 @@ class NovellBugzilla(Bugzilla32): - self._expires = expires - 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 -+ self.url = self.__class__.bugzilla_url - - def __get_expiration(self): - return self._expires --- -1.7.6 - diff --git a/0015-novell-bugzilla-support-in-getBugzillaClassForURL.patch b/0015-novell-bugzilla-support-in-getBugzillaClassForURL.patch deleted file mode 100644 index a9f9b2c..0000000 --- a/0015-novell-bugzilla-support-in-getBugzillaClassForURL.patch +++ /dev/null @@ -1,26 +0,0 @@ -From ba5277024722c6083e10ddce5e070cb622572148 Mon Sep 17 00:00:00 2001 -From: Jan Matejek -Date: Mon, 23 May 2011 14:20:57 +0200 -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 f60fd54..a3a88d2 100644 ---- a/bugzilla/__init__.py -+++ b/bugzilla/__init__.py -@@ -23,6 +23,9 @@ classlist = ['Bugzilla3', 'Bugzilla32', 'Bugzilla34', 'Bugzilla36', - - def getBugzillaClassForURL(url): - log.debug("Choosing subclass for %s" % url) -+ if url.startswith('https://bugzilla.novell.com'): -+ return NovellBugzilla -+ - s = xmlrpclib.ServerProxy(url) - rhbz = False - bzversion = '' --- -1.7.6 - diff --git a/0016-novell-bugzilla-run-on-3.4.patch b/0016-novell-bugzilla-run-on-3.4.patch deleted file mode 100644 index 0ec027a..0000000 --- a/0016-novell-bugzilla-run-on-3.4.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 514cdd0c94644d1096ae248b8bc4e45c5986e486 Mon Sep 17 00:00:00 2001 -From: Michal Vyskocil -Date: Mon, 23 May 2011 14:24:58 +0200 -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 6af3238..62b75b7 100644 ---- a/bugzilla/nvlbugzilla.py -+++ b/bugzilla/nvlbugzilla.py -@@ -11,7 +11,7 @@ - - #from bugzilla.base import BugzillaError, log - import bugzilla.base --from bugzilla import Bugzilla32 -+from bugzilla import Bugzilla34 - - import urllib - import urllib2 -@@ -21,8 +21,8 @@ import time - import re - import os - --class NovellBugzilla(Bugzilla32): -- '''bugzilla.novell.com is a standard bugzilla 3.2 with some extensions, but -+class NovellBugzilla(Bugzilla34): -+ '''bugzilla.novell.com is a standard bugzilla 3.4 with some extensions, but - it uses an proprietary and non-standard IChain login system. This class - reimplements a login method which is compatible with iChain. - --- -1.7.6 - diff --git a/0017-allow-various-bnc-instances-in-NovellBugzilla.patch b/0017-allow-various-bnc-instances-in-NovellBugzilla.patch deleted file mode 100644 index 5b98a4f..0000000 --- a/0017-allow-various-bnc-instances-in-NovellBugzilla.patch +++ /dev/null @@ -1,52 +0,0 @@ -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.2-backtraces.patch b/python-bugzilla-0.6.2-backtraces.patch new file mode 100644 index 0000000..b12d02a --- /dev/null +++ b/python-bugzilla-0.6.2-backtraces.patch @@ -0,0 +1,62 @@ +diff --git a/bugzilla/base.py b/bugzilla/base.py +index cfaea45..96a05d7 100644 +--- a/bugzilla/base.py ++++ b/bugzilla/base.py +@@ -1050,7 +1050,22 @@ class CookieTransport(xmlrpclib.Transport): + else: + request = request_with_cookies # python 2.6 and earlier + +-class SafeCookieTransport(xmlrpclib.SafeTransport,CookieTransport): ++class BasicAuthTransport(xmlrpclib.SafeTransport): ++ """A subclass of xmlrpclib.SafeTransport that allows setting HTTP Basic Auth ++ without exposing it as part of URL in backtraces.""" ++ auth_params = None ++ ++ def get_host_info(self, host): ++ host, extra_headers, x509 = xmlrpclib.Transport.get_host_info(self, host) ++ if isinstance(self.auth_params, tuple): ++ import base64 ++ auth = base64.encodestring("%s:%s" % self.auth_params).strip() ++ if extra_headers is None: ++ extra_headers = [] ++ extra_headers.append(("Authorization", "Basic " + auth)) ++ return host, extra_headers, x509 ++ ++class SafeCookieTransport(BasicAuthTransport,CookieTransport): + '''SafeTransport subclass that supports cookies.''' + scheme = 'https' + # Override the appropriate request method +diff --git a/bugzilla/nvlbugzilla.py b/bugzilla/nvlbugzilla.py +index 7e2ec32..5804de4 100644 +--- a/bugzilla/nvlbugzilla.py ++++ b/bugzilla/nvlbugzilla.py +@@ -39,8 +39,8 @@ class NovellBugzilla(Bugzilla34): + super(NovellBugzilla, self).__init__(**kwargs) + + def _login(self, user, password): +- # using basic auth, so login happens implicitly at connect +- pass ++ # set up data for basic auth transport ++ self._transport.auth_params = (self.user, self.password) + + def _logout(self): + # using basic auth, no logout +@@ -57,17 +57,9 @@ class NovellBugzilla(Bugzilla34): + if not hostname.startswith('api'): + hostname = 'api'+hostname + +- self.readconfig() +- # set up basic auth url +- if self.user and self.password: +- hostname = self.user + ':' + self.password + '@' + hostname +- + # force https scheme (because of the basic auth) + url = urlparse.urlunsplit(('https', hostname, path, spliturl.query, spliturl.fragment)) +- ret = super(NovellBugzilla, self).connect(url) +- # prevent our username+pass url from showing up in __repr__ +- self.url = origurl +- return ret ++ return super(NovellBugzilla, self).connect(url) + + @classmethod + def _read_osc_password(cls, c): diff --git a/python-bugzilla-0.6.2-openSUSE-1.tar.bz2 b/python-bugzilla-0.6.2-openSUSE-1.tar.bz2 new file mode 100644 index 0000000..3c9add5 --- /dev/null +++ b/python-bugzilla-0.6.2-openSUSE-1.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2597f851fc5189bfa24fb19d5c32a65fc297735f3fa1074e6fc074729d07a5f2 +size 41538 diff --git a/python-bugzilla-0.6.2.tar.bz2 b/python-bugzilla-0.6.2.tar.bz2 deleted file mode 100644 index d0e8958..0000000 --- a/python-bugzilla-0.6.2.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:ac9f6e9761a3b05a57cee6c9a4260b0a50765d30a70205ebd1d8483b89f60f81 -size 40391 diff --git a/python-bugzilla.changes b/python-bugzilla.changes index 519d4b6..1ea9948 100644 --- a/python-bugzilla.changes +++ b/python-bugzilla.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Fri Jan 27 17:53:03 UTC 2012 - jmatejek@suse.com + +- update to openSUSE-1 tag from openSUSE's git branch + * better handling of NovellBugzilla instances + * using HTTP basic auth instead of IChain + ------------------------------------------------------------------- Fri Jul 29 09:04:07 UTC 2011 - mvyskocil@suse.cz diff --git a/python-bugzilla.spec b/python-bugzilla.spec index 859d626..2478ef4 100644 --- a/python-bugzilla.spec +++ b/python-bugzilla.spec @@ -1,7 +1,7 @@ # # spec file for package python-bugzilla # -# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -23,19 +23,13 @@ Version: 0.6.2 Release: 1 Summary: Python library for bugzilla Group: Development/Libraries/Python -License: GPLv2+ +License: GPL-2.0+ 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 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 +#Source: https://fedorahosted.org/releases/p/y/python-bugzilla/%{name}-%{version}.tar.bz2 +Source: %{name}-%{version}-openSUSE-1.tar.bz2 +# https://gitorious.org/opensuse/python-bugzilla +Patch0: %{name}-0.6.2-backtraces.patch + BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: python-devel BuildArch: noarch @@ -54,13 +48,7 @@ but gosh - why not just write something in Python instead? %prep %setup -q -%patch0 -p1 -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 -%patch4 -p1 -%patch5 -p1 -%patch6 -p1 +%patch0 -p1 %build export CFLAGS="%{optflags}"