diff --git a/pungi/phases/gather/__init__.py b/pungi/phases/gather/__init__.py index 72843571..32e85eef 100644 --- a/pungi/phases/gather/__init__.py +++ b/pungi/phases/gather/__init__.py @@ -651,6 +651,10 @@ def _make_lookaside_repo(compose, variant, arch, pkg_map, package_sets=None): compose ).koji_module.config.topdir.rstrip("/") + "/", + "kojimock": lambda: pungi.wrappers.kojiwrapper.KojiMockWrapper( + compose + ).koji_module.config.topdir.rstrip("/") + + "/", } path_prefix = prefixes[compose.conf["pkgset_source"]]() package_list = set() diff --git a/pungi/wrappers/kojiwrapper.py b/pungi/wrappers/kojiwrapper.py index cfdc28be..de405815 100644 --- a/pungi/wrappers/kojiwrapper.py +++ b/pungi/wrappers/kojiwrapper.py @@ -868,10 +868,13 @@ class KojiWrapper(object): class KojiMockWrapper(object): lock = threading.Lock() - def __init__(self, profile): - self.profile = profile + def __init__(self, compose): + try: + self.profile = self.compose.conf["koji_profile"] + except KeyError: + raise RuntimeError("Koji profile must be configured") with self.lock: - self.koji_module = koji.get_profile_module(profile) + self.koji_module = koji.get_profile_module(self.profile) session_opts = {} for key in ( "timeout", @@ -891,7 +894,11 @@ class KojiMockWrapper(object): session_opts[key] = value self.koji_proxy = KojiMock( packages_dir=self.koji_module.config.topdir, - modules_dir=os.path.join(self.koji_module.config.topdir, 'modules')) + modules_dir=os.path.join( + self.koji_module.config.topdir, + 'modules', + ) + ) def get_buildroot_rpms(compose, task_id): diff --git a/tests/test_gather_modules.py b/tests/test_gather_modules.py index 427285d1..67cbaa7a 100644 --- a/tests/test_gather_modules.py +++ b/tests/test_gather_modules.py @@ -110,13 +110,13 @@ class TestModulesYamlParser(TestCase): os.listdir(os.path.join(PATH_TO_KOJI, 'module_defaults'))) # check that modules were exported - self.assertEqual(MARIADB_MODULE, yaml.load( + self.assertEqual(MARIADB_MODULE, yaml.safe_load( open(os.path.join(PATH_TO_KOJI, 'modules/x86_64', 'mariadb-devel-10.3_1-8010020200108182321.cdc1202b')))) - self.assertEqual(JAVAPACKAGES_TOOLS_MODULE, yaml.load( + self.assertEqual(JAVAPACKAGES_TOOLS_MODULE, yaml.safe_load( open(os.path.join(PATH_TO_KOJI, 'modules/x86_64', 'javapackages-tools-201801-8000020190628172923.b07bea58')))) # check that defaults were copied - self.assertEqual(ANT_DEFAULTS, yaml.load( + self.assertEqual(ANT_DEFAULTS, yaml.safe_load( open(os.path.join(PATH_TO_KOJI, 'module_defaults', 'ant.yaml'))))