diff --git a/ubuntutools/archive.py b/ubuntutools/archive.py index 35402a6..8d6d329 100644 --- a/ubuntutools/archive.py +++ b/ubuntutools/archive.py @@ -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)] diff --git a/ubuntutools/lp/lpapicache.py b/ubuntutools/lp/lpapicache.py index d26863b..ae0f13e 100644 --- a/ubuntutools/lp/lpapicache.py +++ b/ubuntutools/lp/lpapicache.py @@ -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