Fix crash when pkgset phase is skipped

JIRA: COMPOSE-3832
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2019-09-18 13:54:18 +02:00
parent 3e263f33f2
commit 150f5f0cb6
2 changed files with 8 additions and 2 deletions

View File

@ -70,7 +70,7 @@ class CreaterepoPhase(PhaseBase):
def run(self): def run(self):
get_productids_from_scm(self.compose) get_productids_from_scm(self.compose)
reference_pkgset = None reference_pkgset = None
if self.pkgset_phase: if self.pkgset_phase and self.pkgset_phase.package_sets:
reference_pkgset = self.pkgset_phase.package_sets[-1] reference_pkgset = self.pkgset_phase.package_sets[-1]
for i in range(self.compose.conf['createrepo_num_threads']): for i in range(self.compose.conf['createrepo_num_threads']):
self.pool.add( self.pool.add(
@ -109,7 +109,9 @@ def create_variant_repo(compose, arch, variant, pkg_type, pkgset, modules_metada
createrepo_c = compose.conf["createrepo_c"] createrepo_c = compose.conf["createrepo_c"]
createrepo_checksum = compose.conf["createrepo_checksum"] createrepo_checksum = compose.conf["createrepo_checksum"]
repo = CreaterepoWrapper(createrepo_c=createrepo_c) repo = CreaterepoWrapper(createrepo_c=createrepo_c)
repo_dir_arch = pkgset.paths["global" if pkg_type == "srpm" else arch] repo_dir_arch = None
if pkgset:
repo_dir_arch = pkgset.paths["global" if pkg_type == "srpm" else arch]
try: try:
repo_dir = types[pkg_type][1]() repo_dir = types[pkg_type][1]()

View File

@ -21,6 +21,10 @@ class PkgsetPhase(PhaseBase):
"""PKGSET""" """PKGSET"""
name = "pkgset" name = "pkgset"
def __init__(self, *args, **kwargs):
super(PkgsetPhase, self).__init__(*args, **kwargs)
self.package_sets = []
def run(self): def run(self):
pkgset_source = "PkgsetSource%s" % self.compose.conf["pkgset_source"] pkgset_source = "PkgsetSource%s" % self.compose.conf["pkgset_source"]
from .source import PkgsetSourceContainer from .source import PkgsetSourceContainer