lpapicache: remove SPPH _have_all_binaries flag

The 'all' arch makes it possible to not actually have all the
BPPH records for all archs, depending on how we've been called
previously (i.e. with which archs and/or no archs).

It's safer to just maintain our cache and recheck it each time if needed.
This commit is contained in:
Dan Streetman 2020-02-07 06:26:11 -05:00
parent 63f614ebe3
commit 5838fa39ff

View File

@ -699,7 +699,6 @@ class SourcePackagePublishingHistory(BaseWrapper):
self._archive = None self._archive = None
self._changelog = None self._changelog = None
self._binaries = {} self._binaries = {}
self._have_all_binaries = False
self._distro_series = None self._distro_series = None
# Don't share _builds between different # Don't share _builds between different
# SourcePackagePublishingHistory objects # SourcePackagePublishingHistory objects
@ -813,10 +812,7 @@ class SourcePackagePublishingHistory(BaseWrapper):
if fallback_arch == 'all': if fallback_arch == 'all':
fallback_arch = host_architecture() fallback_arch = host_architecture()
if self._have_all_binaries: if self.status in ["Pending", "Published"]:
# Great!
pass
elif self.status in ["Pending", "Published"]:
# Published, great! Directly query the list of binaries # Published, great! Directly query the list of binaries
binaries = map(BinaryPackagePublishingHistory, binaries = map(BinaryPackagePublishingHistory,
self._lpobject.getPublishedBinaries()) self._lpobject.getPublishedBinaries())
@ -827,7 +823,6 @@ class SourcePackagePublishingHistory(BaseWrapper):
if a not in self._binaries: if a not in self._binaries:
self._binaries[a] = {} self._binaries[a] = {}
self._binaries[a][b.binary_package_name] = b self._binaries[a][b.binary_package_name] = b
self._have_all_binaries = True
else: else:
# we have to go the long way :( # we have to go the long way :(
Logger.info("Please wait, this may take some time...") Logger.info("Please wait, this may take some time...")
@ -868,9 +863,6 @@ class SourcePackagePublishingHistory(BaseWrapper):
if a not in self._binaries: if a not in self._binaries:
self._binaries[a] = {} self._binaries[a] = {}
self._binaries[a][n] = bpph self._binaries[a][n] = bpph
if not name and not ext and arch == 'all':
# We must have got them all
self._have_all_binaries = True
bpphs = [] bpphs = []
if arch == 'all': if arch == 'all':