Add function to get all arches in a compose

The same logic is used in two places. This deserves a common function.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2019-07-26 15:56:45 +02:00
parent 51d638d5db
commit eeaee1c20f
3 changed files with 16 additions and 16 deletions

View File

@ -138,3 +138,12 @@ def materialize_pkgset(compose, pkgset_global, path_prefix):
create_arch_repos(compose, path_prefix)
return package_sets
def get_all_arches(compose):
all_arches = set(["src"])
for arch in compose.get_arches():
is_multilib = is_arch_multilib(compose.conf, arch)
arches = get_valid_arches(arch, is_multilib)
all_arches.update(arches)
return all_arches

View File

@ -26,11 +26,11 @@ from kobo.shortcuts import force_list, relative_path
import pungi.wrappers.kojiwrapper
from pungi.wrappers.comps import CompsWrapper
import pungi.phases.pkgset.pkgsets
from pungi.arch import get_valid_arches, getBaseArch
from pungi.util import is_arch_multilib, retry, find_old_compose
from pungi.arch import getBaseArch
from pungi.util import retry, find_old_compose
from pungi import Modulemd
from pungi.phases.pkgset.common import materialize_pkgset
from pungi.phases.pkgset.common import materialize_pkgset, get_all_arches
from pungi.phases.gather import get_packages_to_gather
import pungi.phases.pkgset.source
@ -492,11 +492,7 @@ def _find_old_file_cache_path(compose):
def populate_global_pkgset(compose, koji_wrapper, path_prefix, event):
all_arches = set(["src"])
for arch in compose.get_arches():
is_multilib = is_arch_multilib(compose.conf, arch)
arches = get_valid_arches(arch, is_multilib)
all_arches.update(arches)
all_arches = get_all_arches(compose)
# List of compose tags from which we create this compose
compose_tags = []

View File

@ -20,11 +20,10 @@ from six.moves import cPickle as pickle
from kobo.shortcuts import run
import pungi.phases.pkgset.pkgsets
from pungi.arch import get_valid_arches
from pungi.util import makedirs, is_arch_multilib
from pungi.util import makedirs
from pungi.wrappers.pungi import PungiWrapper
from pungi.phases.pkgset.common import materialize_pkgset
from pungi.phases.pkgset.common import materialize_pkgset, get_all_arches
from pungi.phases.gather import get_prepopulate_packages, get_packages_to_gather
from pungi.linker import LinkerPool
@ -119,11 +118,7 @@ def get_pkgset_from_repos(compose):
def populate_global_pkgset(compose, file_list, path_prefix):
ALL_ARCHES = set(["src"])
for arch in compose.get_arches():
is_multilib = is_arch_multilib(compose.conf, arch)
arches = get_valid_arches(arch, is_multilib)
ALL_ARCHES.update(arches)
ALL_ARCHES = get_all_arches(compose)
global_pkgset_path = os.path.join(compose.paths.work.topdir(arch="global"), "packages.pickle")