From 53fa2336b8a2fa7785a9effda7ff36e7da9b5a75 Mon Sep 17 00:00:00 2001 From: Dan Streetman Date: Wed, 22 Jan 2020 14:39:14 -0500 Subject: [PATCH] archive: cache Debian srcpkg when pulling binaries --- ubuntutools/archive.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/ubuntutools/archive.py b/ubuntutools/archive.py index 6d42bcc..aeb8ab7 100644 --- a/ubuntutools/archive.py +++ b/ubuntutools/archive.py @@ -605,11 +605,16 @@ class DebianSPPH(SourcePackagePublishingHistory): """ resource_type = 'source_package_publishing_history' + def __init__(self, *args, **kwargs): + super(DebianSPPH, self).__init__(*args, **kwargs) + self._srcpkg = 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()) - return srcpkg.getSPPH().getBinaries(arch=arch, name=name, ext=ext) + if not self._srcpkg: + Logger.info('Using Snapshot to find binary packages') + self._srcpkg = Snapshot.getSourcePackage(self.getPackageName(), + version=self.getVersion()) + return self._srcpkg.getSPPH().getBinaries(arch=arch, name=name, ext=ext) class DebianSourcePackage(SourcePackage):