Tweak get_virtinstall_images to not include dupes

Some of the version config directives make it possible to wind
up with dupes - for instance, our config for the 'minimal' image
can result in multiple instances of VirtInstallImage for F31
appearing in the list, meaning we'll build the same image two
or more times in the same run. That's silly! Let's not do that.
Using a dict keyed on the release number and arch we wind up with
after interpreting the config file should avoid it.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
This commit is contained in:
Adam Williamson 2020-05-06 16:04:19 -07:00
parent 05b418b796
commit c9ce6b5d0a

View File

@ -456,7 +456,7 @@ def get_virtinstall_images(imggrp, nextrel=None, releases=None):
-2 means 'two releases lower than the "next" release', and so on. -2 means 'two releases lower than the "next" release', and so on.
The values are the arches to build for that release. The values are the arches to build for that release.
""" """
imgs = [] imgs = {}
# Set this here so if we need to calculate it, we only do it once # Set this here so if we need to calculate it, we only do it once
if not nextrel: if not nextrel:
nextrel = 0 nextrel = 0
@ -502,10 +502,11 @@ def get_virtinstall_images(imggrp, nextrel=None, releases=None):
# we can just ditch them from hdds.json and remove this # we can just ditch them from hdds.json and remove this
if arch == 'i686' and (rel == 'rawhide' or int(rel) > 30): if arch == 'i686' and (rel == 'rawhide' or int(rel) > 30):
continue continue
imgs.append( key = "{0}-{1}".format(rel, arch)
VirtInstallImage(name, rel, arch, variant=variant, size=size, imgver=imgver, # using a dict here avoids dupes
maxage=maxage, bootopts=bootopts)) imgs[key] = VirtInstallImage(name, rel, arch, variant=variant, size=size,
return imgs imgver=imgver, maxage=maxage, bootopts=bootopts)
return list(imgs.values())
def get_all_images(hdds, nextrel=None): def get_all_images(hdds, nextrel=None):
"""Simply iterates over the 'image group' dicts in hdds.json and """Simply iterates over the 'image group' dicts in hdds.json and