lpapicache: allow getBinaries(arch=None) to get all archs

this was the previous behavior and some scripts still call with no args.

LP: #1862286
This commit is contained in:
Dan Streetman 2020-02-07 06:58:10 -05:00
parent 5553d98e47
commit ebe460aad1
2 changed files with 8 additions and 6 deletions

View File

@ -608,7 +608,7 @@ class DebianSPPH(SourcePackagePublishingHistory):
"""
resource_type = 'source_package_publishing_history'
def getBinaries(self, arch, name=None, ext=None):
def getBinaries(self, arch=None, name=None, ext=None):
Logger.info('Using Snapshot to find binary packages')
srcpkg = Snapshot.getSourcePackage(self.getPackageName(),
version=self.getVersion())
@ -1228,7 +1228,7 @@ class SnapshotSPPH(object):
new_entries.append(str(block))
return ''.join(new_entries)
def getBinaries(self, arch, name=None, ext=None):
def getBinaries(self, arch=None, name=None, ext=None):
return [b.getBPPH()
for b in self._pkg.getBinaryFiles(arch=arch, name=name, ext=ext)]

View File

@ -794,17 +794,19 @@ class SourcePackagePublishingHistory(BaseWrapper):
new_entries.append(str(block))
return ''.join(new_entries)
def getBinaries(self, arch, name=None, ext=None):
def getBinaries(self, arch=None, name=None, ext=None):
'''
Returns the resulting BinaryPackagePublishingHistorys.
Must specify arch, or use 'all' to get all archs.
If arch is specified, it returns binaries for only that arch,
plus any binaries with arch 'all'. If arch is not specified, or
if arch is specified as 'all', all archs are returned.
If name is specified, only returns BPPH matching that (regex) name.
If ext is specified, only returns BPPH matching that (regex) ext.
'''
if not arch:
raise RuntimeError("Must specify arch")
if arch == 'all':
arch = None
if self.status in ["Pending", "Published"]:
# Published, great! Directly query the list of binaries