Skip to content

Commit 99c921b

Browse files
hack: don't call same function many times
Don't call the same function many times when that function's value is never expected to change at this scope. Signed-off-by: John Mulligan <[email protected]>
1 parent b820ae7 commit 99c921b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

hack/build-image

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -466,16 +466,17 @@ def add_special_tags(img, distro_qualified=True):
466466
# that certain images deserve some extra special tags. Mostly this serves
467467
# to keep us compatible with older tagging schemes from earlier versions of
468468
# the project.
469+
_host_arch = host_arch()
469470
if img.distro in [FEDORA, OPENSUSE]:
470-
if img.arch == host_arch() and img.pkg_source == DEFAULT:
471+
if img.arch == _host_arch and img.pkg_source == DEFAULT:
471472
img.additional_tags.append((LATEST, QUAL_NONE))
472-
if img.arch == host_arch() and img.pkg_source == NIGHTLY:
473+
if img.arch == _host_arch and img.pkg_source == NIGHTLY:
473474
img.additional_tags.append((NIGHTLY, QUAL_NONE))
474475
if not distro_qualified:
475476
return # skip creating "distro qualified" tags
476-
if img.arch == host_arch() and img.pkg_source == DEFAULT:
477+
if img.arch == _host_arch and img.pkg_source == DEFAULT:
477478
img.additional_tags.append((f"{img.distro}-{LATEST}", QUAL_DISTRO))
478-
if img.arch == host_arch() and img.pkg_source == NIGHTLY:
479+
if img.arch == _host_arch and img.pkg_source == NIGHTLY:
479480
img.additional_tags.append((f"{img.distro}-{NIGHTLY}", QUAL_DISTRO))
480481

481482

0 commit comments

Comments
 (0)