- kojimock is added to pungi.phases.gather._make_lookaside_repo#prefixes

- unittests are fixed
This commit is contained in:
soksanichenko 2022-11-09 20:56:56 +02:00
parent 0b965096ee
commit 364ed6c3af
3 changed files with 18 additions and 7 deletions

View File

@ -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()

View File

@ -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):

View File

@ -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'))))