Merge ubottu Bugtracker with bzr.

Treat the Architecture key from apt-cache as a list, rather than a single string.
This commit is contained in:
tsimpson 2012-04-10 14:05:29 +01:00
parent 3d087845f1
commit f0d7e799d1
2 changed files with 29 additions and 5 deletions

View File

@ -772,8 +772,22 @@ class Launchpad(IBugtracker):
if tasks.total_size != 1:
tasks = list(tasks)
tasks.sort(self._sort)
taskdata = tasks[-1]
try:
tasks.sort(self._sort)
taskdata = tasks[-1]
except ValueError:
tasks = [_ for _ in tasks if _.bug_target_name.endswith(u'(Ubuntu)')]
if tasks:
if len(tasks) != 1:
try:
tasks.sort(self._sort)
taskdata = tasks[-1]
except ValueError:
taskdata = bugdata.bug_tasks[bugdata.bug_tasks.total_size - 1]
else:
taskdata = tasks[-1]
else:
taskdata = tasks[-1]
else:
taskdata = tasks[0]

View File

@ -45,7 +45,8 @@ class Apt:
self.aptfilecommand = """apt-file -s %s/%%s.list -c %s/apt-file/%%s -l search %%s""" % (self.aptdir, self.aptdir)
def find(self, pkg, chkdistro, filelookup=True):
_pkg = ''.join([x for x in pkg.strip().split(None,1)[0] if x.isalnum() or x in '.-_+'])
_pkg = ''.join([x for x in pkg.strip().split(None,1)[0] if x.isalnum() or x in '.-_+/'])
distro = ''
if len(pkg.strip().split()) > 1:
distro = ''.join([x for x in pkg.strip().split(None,2)[1] if x.isalnum() or x in '.-_+'])
if not distro:
@ -129,8 +130,17 @@ class Apt:
del parser
archs = ''
if maxp2.has_key('Architecture'):
if maxp2['Architecture'] not in ('all','any'):
archs = ' (Only available for %s)' % maxp2['Architecture']
archs = [_.strip() for _ in maxp2['Architecture'].split() if _.strip()]
for arch in archs:
if arch not in ('any', 'all'):
continue
else:
archs = ''
break
if archs:
archs = ' (Only available for %s)' % '; '.join(archs)
maxp["Distrobution"] = distro
return("%s (source: %s): %s. In component %s, is %s. Version %s (%s), package size %s kB, installed size %s kB%s" %
(maxp['Package'], maxp['Source'] or maxp['Package'], maxp['Description'].split('\n')[0], component(maxp['Section']),