[image-build] Refactoring
* Move getting arches to separate method. * Modify git url only if there is going to be a build. This is not very likely to happen, but could save a bit of time if it really does happen. Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
d2ea1dd288
commit
af11bebf1b
@ -71,6 +71,11 @@ class ImageBuildPhase(PhaseBase):
|
|||||||
|
|
||||||
return ",".join(repo)
|
return ",".join(repo)
|
||||||
|
|
||||||
|
def _get_arches(self, image_conf, arches):
|
||||||
|
if 'arches' in image_conf:
|
||||||
|
arches = set(image_conf.get('arches', [])) & arches
|
||||||
|
return ','.join(sorted(arches))
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
for variant in self.compose.get_variants():
|
for variant in self.compose.get_variants():
|
||||||
arches = set([x for x in variant.arches if x != 'src'])
|
arches = set([x for x in variant.arches if x != 'src'])
|
||||||
@ -81,20 +86,16 @@ class ImageBuildPhase(PhaseBase):
|
|||||||
# value is needed.
|
# value is needed.
|
||||||
image_conf = copy.deepcopy(image_conf)
|
image_conf = copy.deepcopy(image_conf)
|
||||||
|
|
||||||
|
# image_conf is passed to get_image_build_cmd as dict
|
||||||
|
|
||||||
|
image_conf['arches'] = self._get_arches(image_conf, arches)
|
||||||
|
if not image_conf['arches']:
|
||||||
|
continue
|
||||||
|
|
||||||
# Replace possible ambiguous ref name with explicit hash.
|
# Replace possible ambiguous ref name with explicit hash.
|
||||||
if 'ksurl' in image_conf:
|
if 'ksurl' in image_conf:
|
||||||
image_conf['ksurl'] = resolve_git_url(image_conf['ksurl'])
|
image_conf['ksurl'] = resolve_git_url(image_conf['ksurl'])
|
||||||
|
|
||||||
# image_conf is passed to get_image_build_cmd as dict
|
|
||||||
|
|
||||||
if 'arches' in image_conf:
|
|
||||||
image_conf["arches"] = ','.join(sorted(set(image_conf.get('arches', [])) & arches))
|
|
||||||
else:
|
|
||||||
image_conf['arches'] = ','.join(sorted(arches))
|
|
||||||
|
|
||||||
if not image_conf['arches']:
|
|
||||||
continue
|
|
||||||
|
|
||||||
image_conf["variant"] = variant
|
image_conf["variant"] = variant
|
||||||
|
|
||||||
image_conf["install_tree"] = self._get_install_tree(image_conf, variant)
|
image_conf["install_tree"] = self._get_install_tree(image_conf, variant)
|
||||||
|
Loading…
Reference in New Issue
Block a user