From 15ccd309fafbbf18c564f02cc507ffb26058b436 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Mon, 9 Apr 2018 15:32:33 +0200 Subject: [PATCH] Remove comps from arch repo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The comps could potentially be different in different variants, so instead we can create the comps repo for every variant separately and use two repos instead of one (packages in one repository, comps in another one). Signed-off-by: Lubomír Sedlář --- pungi/paths.py | 4 +- pungi/phases/buildinstall.py | 9 +++- pungi/phases/gather/methods/method_deps.py | 11 ++++- pungi/phases/init.py | 11 ++--- pungi/phases/ostree.py | 6 ++- pungi/phases/ostree_installer.py | 5 ++- pungi/phases/pkgset/common.py | 5 +-- tests/test_buildinstall.py | 51 +++++++++++++++------- tests/test_gather_method_deps.py | 9 ++-- tests/test_initphase.py | 19 ++++++-- tests/test_ostree_installer_phase.py | 17 +++++--- tests/test_ostree_phase.py | 15 ++++++- 12 files changed, 117 insertions(+), 45 deletions(-) diff --git a/pungi/paths.py b/pungi/paths.py index 37c6da13..5234780e 100644 --- a/pungi/paths.py +++ b/pungi/paths.py @@ -153,7 +153,7 @@ class WorkPaths(object): makedirs(path) return path - def comps_repo(self, arch=None, create_dir=True): + def comps_repo(self, arch=None, variant=None, create_dir=True): """ Examples: work/x86_64/comps-repo @@ -161,6 +161,8 @@ class WorkPaths(object): """ arch = arch or "global" path = os.path.join(self.topdir(arch, create_dir=create_dir), "comps_repo") + if variant: + path += '_' + variant.uid if create_dir: makedirs(path) return path diff --git a/pungi/phases/buildinstall.py b/pungi/phases/buildinstall.py index b311ac93..2e9973ce 100644 --- a/pungi/phases/buildinstall.py +++ b/pungi/phases/buildinstall.py @@ -57,7 +57,7 @@ class BuildinstallPhase(PhaseBase): return True return False - def _get_lorax_cmd(self, repo_baseurl, output_dir, variant, arch, buildarch, volid): + def _get_lorax_cmd(self, repo_baseurl, output_dir, variant, arch, buildarch, volid, final_output_dir): noupgrade = True bugurl = None nomacboot = True @@ -97,6 +97,11 @@ class BuildinstallPhase(PhaseBase): repos = [repo_baseurl] + get_arch_variant_data(self.compose.conf, 'lorax_extra_sources', arch, variant) + if self.compose.has_comps: + comps_repo = self.compose.paths.work.comps_repo(arch, variant) + if final_output_dir != output_dir: + comps_repo = translate_path(self.compose, comps_repo) + repos.append(comps_repo) lorax = LoraxWrapper() lorax_cmd = lorax.get_lorax_cmd(self.compose.conf["release_name"], @@ -152,7 +157,7 @@ class BuildinstallPhase(PhaseBase): volid = get_volid(self.compose, arch, variant=variant, disc_type=disc_type) commands.append( (variant, - self._get_lorax_cmd(repo_baseurl, output_dir, variant, arch, buildarch, volid)) + self._get_lorax_cmd(repo_baseurl, output_dir, variant, arch, buildarch, volid, final_output_dir)) ) elif self.buildinstall_method == "buildinstall": volid = get_volid(self.compose, arch, disc_type=disc_type) diff --git a/pungi/phases/gather/methods/method_deps.py b/pungi/phases/gather/methods/method_deps.py index f6784f12..b47f8891 100644 --- a/pungi/phases/gather/methods/method_deps.py +++ b/pungi/phases/gather/methods/method_deps.py @@ -93,7 +93,16 @@ def write_pungi_config(compose, arch, variant, packages, groups, filter_packages compose.log_info(msg) - repos = {"pungi-repo": compose.paths.work.arch_repo(arch=arch)} + repos = { + "pungi-repo": compose.paths.work.arch_repo(arch=arch), + "comps-repo": compose.paths.work.comps_repo(arch=arch, variant=variant), + } + if variant.type == "optional": + for var in variant.parent.get_variants( + arch=arch, types=["self", "variant", "addon", "layered-product"]): + repos['%s-comps' % var.uid] = compose.paths.work.comps_repo(arch=arch, variant=var) + if variant.type in ["addon", "layered-product"]: + repos['parent-comps'] = compose.paths.work.comps_repo(arch=arch, variant=variant.parent) lookaside_repos = {} for i, repo_url in enumerate(pungi.phases.gather.get_lookaside_repos(compose, arch, variant)): diff --git a/pungi/phases/init.py b/pungi/phases/init.py index dc95bde0..c9470f2c 100644 --- a/pungi/phases/init.py +++ b/pungi/phases/init.py @@ -42,12 +42,13 @@ class InitPhase(PhaseBase): write_global_comps(self.compose) for arch in self.compose.get_arches(): write_arch_comps(self.compose, arch) - create_comps_repo(self.compose, arch) + create_comps_repo(self.compose, arch, None) # write variant comps for variant in self.compose.get_variants(): for arch in variant.arches: write_variant_comps(self.compose, arch, variant) + create_comps_repo(self.compose, arch, variant) # download variants.xml / product.xml? @@ -131,13 +132,13 @@ def write_variant_comps(compose, arch, variant): comps.write_comps() -def create_comps_repo(compose, arch): +def create_comps_repo(compose, arch, variant): createrepo_c = compose.conf["createrepo_c"] createrepo_checksum = compose.conf["createrepo_checksum"] repo = CreaterepoWrapper(createrepo_c=createrepo_c) - comps_repo = compose.paths.work.comps_repo(arch=arch) - comps_path = compose.paths.work.comps(arch=arch) - msg = "Creating comps repo for arch '%s'" % arch + comps_repo = compose.paths.work.comps_repo(arch=arch, variant=variant) + comps_path = compose.paths.work.comps(arch=arch, variant=variant) + msg = "Creating comps repo for arch '%s' variant '%s'" % (arch, variant.uid if variant else None) if compose.DEBUG and os.path.isdir(os.path.join(comps_repo, "repodata")): compose.log_warning("[SKIP ] %s" % msg) else: diff --git a/pungi/phases/ostree.py b/pungi/phases/ostree.py index 787bf07a..1a93e112 100644 --- a/pungi/phases/ostree.py +++ b/pungi/phases/ostree.py @@ -59,7 +59,11 @@ class OSTreeThread(WorkerThread): self._clone_repo(repodir, config['config_url'], config.get('config_branch', 'master')) repo_baseurl = compose.paths.work.arch_repo('$basearch', create_dir=False) - repos = get_repo_dicts(shortcuts.force_list(config['repo']) + shortcuts.force_list(translate_path(compose, repo_baseurl)), logger=self.pool) + comps_repo = compose.paths.work.comps_repo('$basearch', variant=variant, create_dir=False) + repos = get_repo_dicts(shortcuts.force_list(config['repo']) + + shortcuts.force_list(translate_path(compose, repo_baseurl)) + + shortcuts.force_list(translate_path(compose, comps_repo)), + logger=self.pool) # copy the original config and update before save to a json file new_config = copy.copy(config) diff --git a/pungi/phases/ostree_installer.py b/pungi/phases/ostree_installer.py index b7843195..a78fccad 100644 --- a/pungi/phases/ostree_installer.py +++ b/pungi/phases/ostree_installer.py @@ -65,8 +65,11 @@ class OstreeInstallerThread(WorkerThread): self.logdir = compose.paths.log.topdir('%s/%s/ostree_installer-%s' % (arch, variant, self.num)) repo_baseurl = compose.paths.work.arch_repo('$basearch', create_dir=False) + comps_baseurl = compose.paths.work.comps_repo('$basearch', variant=variant, create_dir=False) repos = get_repo_urls(None, # compose==None. Special value says that method should ignore deprecated variant-type repo - shortcuts.force_list(config['repo']) + shortcuts.force_list(translate_path(compose, repo_baseurl)), + shortcuts.force_list(config['repo']) + + shortcuts.force_list(translate_path(compose, repo_baseurl)) + + shortcuts.force_list(translate_path(compose, comps_baseurl)), arch=arch, logger=self.pool) repos = [url.replace('$arch', arch) for url in repos] diff --git a/pungi/phases/pkgset/common.py b/pungi/phases/pkgset/common.py index 0ed76e8b..59f77174 100644 --- a/pungi/phases/pkgset/common.py +++ b/pungi/phases/pkgset/common.py @@ -95,12 +95,9 @@ def create_arch_repos(compose, arch, path_prefix): return compose.log_info("[BEGIN] %s" % msg) - comps_path = None - if compose.has_comps: - comps_path = compose.paths.work.comps(arch=arch) cmd = repo.get_createrepo_cmd(path_prefix, update=True, database=True, skip_stat=True, pkglist=compose.paths.work.package_list(arch=arch), outputdir=repo_dir, baseurl="file://%s" % path_prefix, workers=compose.conf["createrepo_num_workers"], - groupfile=comps_path, update_md_path=repo_dir_global, checksum=createrepo_checksum) + update_md_path=repo_dir_global, checksum=createrepo_checksum) run(cmd, logfile=compose.paths.log.log_file(arch, "arch_repo"), show_cmd=True) compose.log_info("[DONE ] %s" % msg) diff --git a/tests/test_buildinstall.py b/tests/test_buildinstall.py index 1757fbbb..19b9b8b9 100644 --- a/tests/test_buildinstall.py +++ b/tests/test_buildinstall.py @@ -30,6 +30,7 @@ class BuildInstallCompose(DummyCompose): is_empty=False), } self.all_variants = self.variants.copy() + self.has_comps = True class TestBuildinstallPhase(PungiTestCase): @@ -114,7 +115,8 @@ class TestBuildinstallPhase(PungiTestCase): self.assertItemsEqual( loraxCls.return_value.get_lorax_cmd.mock_calls, [mock.call('Test', '1', '1', - [self.topdir + '/work/x86_64/repo'], + [self.topdir + '/work/x86_64/repo', + self.topdir + '/work/x86_64/comps_repo_Server'], self.topdir + '/work/x86_64/buildinstall/Server', buildarch='x86_64', is_final=True, nomacboot=True, noupgrade=True, volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'], @@ -123,7 +125,8 @@ class TestBuildinstallPhase(PungiTestCase): add_template_var=[], add_arch_template_var=[], log_dir=self.topdir + '/logs/x86_64/buildinstall-Server-logs'), mock.call('Test', '1', '1', - [self.topdir + '/work/amd64/repo'], + [self.topdir + '/work/amd64/repo', + self.topdir + '/work/amd64/comps_repo_Server'], self.topdir + '/work/amd64/buildinstall/Server', buildarch='amd64', is_final=True, nomacboot=True, noupgrade=True, volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'], @@ -132,7 +135,8 @@ class TestBuildinstallPhase(PungiTestCase): add_template_var=[], add_arch_template_var=[], log_dir=self.topdir + '/logs/amd64/buildinstall-Server-logs'), mock.call('Test', '1', '1', - [self.topdir + '/work/amd64/repo'], + [self.topdir + '/work/amd64/repo', + self.topdir + '/work/amd64/comps_repo_Client'], self.topdir + '/work/amd64/buildinstall/Client', buildarch='amd64', is_final=True, nomacboot=True, noupgrade=True, volid='vol_id', variant='Client', buildinstallpackages=[], @@ -177,7 +181,8 @@ class TestBuildinstallPhase(PungiTestCase): lorax = loraxCls.return_value lorax.get_lorax_cmd.assert_has_calls( [mock.call('Test', '1', '1', - [self.topdir + '/work/amd64/repo'], + [self.topdir + '/work/amd64/repo', + self.topdir + '/work/amd64/comps_repo_Client'], self.topdir + '/work/amd64/buildinstall/Client', buildarch='amd64', is_final=True, nomacboot=True, noupgrade=True, volid='vol_id', variant='Client', buildinstallpackages=[], @@ -277,7 +282,8 @@ class TestBuildinstallPhase(PungiTestCase): self.assertItemsEqual( loraxCls.return_value.get_lorax_cmd.mock_calls, [mock.call('Test', '1', '1', - [self.topdir + '/work/x86_64/repo'], + [self.topdir + '/work/x86_64/repo', + self.topdir + '/work/x86_64/comps_repo_Server'], self.topdir + '/work/x86_64/buildinstall/Server', buildarch='x86_64', is_final=True, nomacboot=True, noupgrade=True, volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'], @@ -286,7 +292,8 @@ class TestBuildinstallPhase(PungiTestCase): bugurl='http://example.com', log_dir=self.topdir + '/logs/x86_64/buildinstall-Server-logs'), mock.call('Test', '1', '1', - [self.topdir + '/work/amd64/repo'], + [self.topdir + '/work/amd64/repo', + self.topdir + '/work/amd64/comps_repo_Server'], self.topdir + '/work/amd64/buildinstall/Server', buildarch='amd64', is_final=True, nomacboot=True, noupgrade=False, volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'], @@ -295,7 +302,8 @@ class TestBuildinstallPhase(PungiTestCase): add_template_var=[], add_arch_template_var=[], log_dir=self.topdir + '/logs/amd64/buildinstall-Server-logs'), mock.call('Test', '1', '1', - [self.topdir + '/work/amd64/repo'], + [self.topdir + '/work/amd64/repo', + self.topdir + '/work/amd64/comps_repo_Client'], self.topdir + '/work/amd64/buildinstall/Client', buildarch='amd64', is_final=True, nomacboot=False, noupgrade=True, volid='vol_id', variant='Client', buildinstallpackages=[], @@ -349,7 +357,8 @@ class TestBuildinstallPhase(PungiTestCase): self.assertItemsEqual( loraxCls.return_value.get_lorax_cmd.mock_calls, [mock.call('Test', '1', '1', - [self.topdir + '/work/x86_64/repo'], + [self.topdir + '/work/x86_64/repo', + self.topdir + '/work/x86_64/comps_repo_Server'], self.topdir + '/work/x86_64/buildinstall/Server', buildarch='x86_64', is_final=True, nomacboot=False, noupgrade=False, volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'], @@ -358,7 +367,8 @@ class TestBuildinstallPhase(PungiTestCase): add_template_var=[], add_arch_template_var=[], log_dir=self.topdir + '/logs/x86_64/buildinstall-Server-logs'), mock.call('Test', '1', '1', - [self.topdir + '/work/amd64/repo'], + [self.topdir + '/work/amd64/repo', + self.topdir + '/work/amd64/comps_repo_Server'], self.topdir + '/work/amd64/buildinstall/Server', buildarch='amd64', is_final=True, nomacboot=True, noupgrade=False, volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'], @@ -367,7 +377,8 @@ class TestBuildinstallPhase(PungiTestCase): add_template_var=[], add_arch_template_var=[], log_dir=self.topdir + '/logs/amd64/buildinstall-Server-logs'), mock.call('Test', '1', '1', - [self.topdir + '/work/amd64/repo'], + [self.topdir + '/work/amd64/repo', + self.topdir + '/work/amd64/comps_repo_Client'], self.topdir + '/work/amd64/buildinstall/Client', buildarch='amd64', is_final=True, nomacboot=True, noupgrade=False, volid='vol_id', variant='Client', buildinstallpackages=[], @@ -421,7 +432,8 @@ class TestBuildinstallPhase(PungiTestCase): self.assertItemsEqual( loraxCls.return_value.get_lorax_cmd.mock_calls, [mock.call('Test', '1', '1', - ['http://localhost/work/x86_64/repo'], + ['http://localhost/work/x86_64/repo', + 'http://localhost/work/x86_64/comps_repo_Server'], buildinstall_topdir + '/x86_64/Server/results', buildarch='x86_64', is_final=True, nomacboot=True, noupgrade=True, volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'], @@ -430,7 +442,8 @@ class TestBuildinstallPhase(PungiTestCase): bugurl=None, log_dir=buildinstall_topdir + '/x86_64/Server/logs'), mock.call('Test', '1', '1', - ['http://localhost/work/amd64/repo'], + ['http://localhost/work/amd64/repo', + 'http://localhost/work/amd64/comps_repo_Server'], buildinstall_topdir + '/amd64/Server/results', buildarch='amd64', is_final=True, nomacboot=True, noupgrade=True, volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'], @@ -439,7 +452,8 @@ class TestBuildinstallPhase(PungiTestCase): add_template_var=[], add_arch_template_var=[], log_dir=buildinstall_topdir + '/amd64/Server/logs'), mock.call('Test', '1', '1', - ['http://localhost/work/amd64/repo'], + ['http://localhost/work/amd64/repo', + 'http://localhost/work/amd64/comps_repo_Client'], buildinstall_topdir + '/amd64/Client/results', buildarch='amd64', is_final=True, nomacboot=True, noupgrade=True, volid='vol_id', variant='Client', buildinstallpackages=[], @@ -481,10 +495,13 @@ class TestBuildinstallPhase(PungiTestCase): phase.run() + self.maxDiff = None self.assertItemsEqual( loraxCls.return_value.get_lorax_cmd.mock_calls, [mock.call('Test', '1', '1', - [self.topdir + '/work/x86_64/repo', "http://example.com/repo1"], + [self.topdir + '/work/x86_64/repo', + "http://example.com/repo1", + self.topdir + '/work/x86_64/comps_repo_Server'], self.topdir + '/work/x86_64/buildinstall/Server', buildarch='x86_64', is_final=True, nomacboot=True, noupgrade=True, volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'], @@ -493,7 +510,8 @@ class TestBuildinstallPhase(PungiTestCase): bugurl=None, log_dir=self.topdir + '/logs/x86_64/buildinstall-Server-logs'), mock.call('Test', '1', '1', - [self.topdir + '/work/amd64/repo'], + [self.topdir + '/work/amd64/repo', + self.topdir + '/work/amd64/comps_repo_Server'], self.topdir + '/work/amd64/buildinstall/Server', buildarch='amd64', is_final=True, nomacboot=True, noupgrade=True, volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'], @@ -504,7 +522,8 @@ class TestBuildinstallPhase(PungiTestCase): mock.call('Test', '1', '1', [self.topdir + '/work/amd64/repo', "http://example.com/repo2", - "http://example.com/repo3"], + "http://example.com/repo3", + self.topdir + '/work/amd64/comps_repo_Client'], self.topdir + '/work/amd64/buildinstall/Client', buildarch='amd64', is_final=True, nomacboot=True, noupgrade=True, volid='vol_id', variant='Client', buildinstallpackages=[], diff --git a/tests/test_gather_method_deps.py b/tests/test_gather_method_deps.py index 0bebb74e..667eaa5e 100644 --- a/tests/test_gather_method_deps.py +++ b/tests/test_gather_method_deps.py @@ -37,7 +37,8 @@ class TestWritePungiConfig(helpers.PungiTestCase): ks_path=self.topdir + '/work/x86_64/pungi/Server.x86_64.conf', lookaside_repos={}, multilib_whitelist=white, multilib_blacklist=black, groups=['grp1'], prepopulate=prepopulate, - repos={'pungi-repo': self.topdir + '/work/x86_64/repo'}, + repos={'pungi-repo': self.topdir + '/work/x86_64/repo', + 'comps-repo': self.topdir + '/work/x86_64/comps_repo_Server'}, exclude_packages=['pkg3', 'pkg4.x86_64'], fulltree_excludes=fulltree, package_whitelist=set()) @@ -53,7 +54,8 @@ class TestWritePungiConfig(helpers.PungiTestCase): lookaside_repos={'lookaside-repo-0': 'http://example.com/repo'}, multilib_whitelist=[], multilib_blacklist=[], groups=[], prepopulate=None, - repos={'pungi-repo': self.topdir + '/work/x86_64/repo'}, + repos={'pungi-repo': self.topdir + '/work/x86_64/repo', + 'comps-repo': self.topdir + '/work/x86_64/comps_repo_Server'}, exclude_packages=[], fulltree_excludes=None, package_whitelist=set()) self.assertEqual(glr.call_args_list, @@ -78,7 +80,8 @@ class TestWritePungiConfig(helpers.PungiTestCase): ks_path=self.topdir + '/work/x86_64/pungi/Server.x86_64.conf', lookaside_repos={}, multilib_whitelist=white, multilib_blacklist=black, groups=['grp1'], prepopulate=prepopulate, - repos={'pungi-repo': self.topdir + '/work/x86_64/repo'}, + repos={'pungi-repo': self.topdir + '/work/x86_64/repo', + 'comps-repo': self.topdir + '/work/x86_64/comps_repo_Server'}, exclude_packages=['pkg3', 'pkg4.x86_64'], fulltree_excludes=fulltree, package_whitelist=set(['pkg-0:1.0.0-1'])) diff --git a/tests/test_initphase.py b/tests/test_initphase.py index 1d28f79b..f541af26 100644 --- a/tests/test_initphase.py +++ b/tests/test_initphase.py @@ -34,7 +34,13 @@ class TestInitPhase(PungiTestCase): self.assertItemsEqual(write_arch.mock_calls, [mock.call(compose, 'x86_64'), mock.call(compose, 'amd64')]) self.assertItemsEqual(create_comps.mock_calls, - [mock.call(compose, 'x86_64'), mock.call(compose, 'amd64')]) + [mock.call(compose, 'x86_64', None), mock.call(compose, 'amd64', None), + mock.call(compose, 'x86_64', compose.variants['Server']), + mock.call(compose, 'amd64', compose.variants['Server']), + mock.call(compose, 'amd64', compose.variants['Client']), + mock.call(compose, 'x86_64', compose.variants['Everything']), + mock.call(compose, 'amd64', compose.variants['Everything']), + mock.call(compose, 'x86_64', compose.all_variants['Server-optional'])]) self.assertItemsEqual(write_variant.mock_calls, [mock.call(compose, 'x86_64', compose.variants['Server']), mock.call(compose, 'amd64', compose.variants['Server']), @@ -63,7 +69,12 @@ class TestInitPhase(PungiTestCase): self.assertItemsEqual(write_arch.mock_calls, [mock.call(compose, 'x86_64'), mock.call(compose, 'amd64')]) self.assertItemsEqual(create_comps.mock_calls, - [mock.call(compose, 'x86_64'), mock.call(compose, 'amd64')]) + [mock.call(compose, 'x86_64', None), mock.call(compose, 'amd64', None), + mock.call(compose, 'x86_64', compose.variants['Server']), + mock.call(compose, 'amd64', compose.variants['Server']), + mock.call(compose, 'amd64', compose.variants['Client']), + mock.call(compose, 'x86_64', compose.variants['Everything']), + mock.call(compose, 'amd64', compose.variants['Everything'])]) self.assertItemsEqual(write_variant.mock_calls, [mock.call(compose, 'x86_64', compose.variants['Server']), mock.call(compose, 'amd64', compose.variants['Server']), @@ -125,7 +136,7 @@ class TestCreateCompsRepo(PungiTestCase): }) compose.DEBUG = False - init.create_comps_repo(compose, 'x86_64') + init.create_comps_repo(compose, 'x86_64', None) self.assertEqual(run.mock_calls, [mock.call(['createrepo_c', self.topdir + '/work/x86_64/comps_repo', '--verbose', @@ -144,7 +155,7 @@ class TestCreateCompsRepo(PungiTestCase): compose.DEBUG = True os.makedirs(self.topdir + '/work/x86_64/comps_repo/repodata') - init.create_comps_repo(compose, 'x86_64') + init.create_comps_repo(compose, 'x86_64', None) self.assertEqual(run.mock_calls, []) diff --git a/tests/test_ostree_installer_phase.py b/tests/test_ostree_installer_phase.py index 1c7af1ad..e3af4468 100644 --- a/tests/test_ostree_installer_phase.py +++ b/tests/test_ostree_installer_phase.py @@ -159,7 +159,8 @@ class OstreeThreadTest(helpers.PungiTestCase): t.process((self.compose, self.compose.variants['Everything'], 'x86_64', cfg), 1) self.assertRunrootCall(koji, - 'http://example.com/work/$basearch/repo', + ['http://example.com/work/$basearch/repo', + 'http://example.com/work/$basearch/comps_repo_Everything'], cfg['release'], extra=['--logfile=%s/%s/lorax.log' % (self.topdir, LOG_PATH)]) self.assertIsoLinked(link, get_file_size, get_mtime, final_iso_path) @@ -196,7 +197,8 @@ class OstreeThreadTest(helpers.PungiTestCase): self.assertRunrootCall(koji, ('http://example.com/repo/x86_64/', - 'http://example.com/work/$basearch/repo'), + 'http://example.com/work/$basearch/repo', + 'http://example.com/work/$basearch/comps_repo_Everything'), cfg['release'], isfinal=True, extra=['--logfile=%s/%s/lorax.log' % (self.topdir, LOG_PATH)]) @@ -237,6 +239,7 @@ class OstreeThreadTest(helpers.PungiTestCase): 'https://example.com/extra-repo1.repo', 'https://example.com/extra-repo2.repo', 'http://example.com/work/$basearch/repo', + 'http://example.com/work/$basearch/comps_repo_Everything', ] self.assertRunrootCall(koji, sources, cfg['release'], isfinal=True, @@ -276,6 +279,7 @@ class OstreeThreadTest(helpers.PungiTestCase): 'https://example.com/extra-repo1.repo', 'https://example.com/extra-repo2.repo', 'http://example.com/work/$basearch/repo', + 'http://example.com/work/$basearch/comps_repo_Everything', ] self.assertRunrootCall(koji, sources, cfg['release'], isfinal=True, @@ -353,7 +357,8 @@ class OstreeThreadTest(helpers.PungiTestCase): 'branch': 'f24', 'dir': '.'}, templ_dir, logger=pool._logger)]) self.assertRunrootCall(koji, - 'http://example.com/work/$basearch/repo', + ['http://example.com/work/$basearch/repo', + 'http://example.com/work/$basearch/comps_repo_Everything'], cfg['release'], isfinal=True, extra=['--add-template=%s/some_file.txt' % templ_dir, @@ -406,7 +411,8 @@ class OstreeThreadTest(helpers.PungiTestCase): self.assertRunrootCall( koji, - 'http://example.com/work/$basearch/repo', + ['http://example.com/work/$basearch/repo', + 'http://example.com/work/$basearch/comps_repo_Everything'], '20151203.t.0', isfinal=True, extra=['--installpkgs=fedora-productimg-atomic', @@ -467,7 +473,8 @@ class OstreeThreadTest(helpers.PungiTestCase): self.assertRunrootCall( koji, - 'http://example.com/work/$basearch/repo', + ['http://example.com/work/$basearch/repo', + 'http://example.com/work/$basearch/comps_repo_Everything'], '20151203.t.0', isfinal=True, extra=['--installpkgs=fedora-productimg-atomic', diff --git a/tests/test_ostree_phase.py b/tests/test_ostree_phase.py index d57dc682..ad14eca4 100644 --- a/tests/test_ostree_phase.py +++ b/tests/test_ostree_phase.py @@ -167,7 +167,15 @@ class OSTreeThreadTest(helpers.PungiTestCase): self.assertTrue(os.path.isfile(extra_config_file)) with open(extra_config_file, 'r') as f: extraconf_content = json.load(f) - proper_extraconf_content = json.loads('{"repo": [{"name": "http:__example.com_work__basearch_repo", "baseurl": "http://example.com/work/$basearch/repo"}]}') + + proper_extraconf_content = { + "repo": [ + {"name": "http:__example.com_work__basearch_repo", + "baseurl": "http://example.com/work/$basearch/repo"}, + {"name": "http:__example.com_work__basearch_comps_repo_Everything", + "baseurl": "http://example.com/work/$basearch/comps_repo_Everything"} + ] + } self.assertEqual(proper_extraconf_content, extraconf_content) @mock.patch('pungi.wrappers.scm.get_dir_from_scm') @@ -453,7 +461,10 @@ class OSTreeThreadTest(helpers.PungiTestCase): with open(extra_config_file, 'r') as extra_config_fd: extra_config = json.load(extra_config_fd) self.assertTrue(extra_config.get('keep_original_sources', False)) - self.assertEqual(len(extra_config.get('repo', [])), 2) # should equal to number of valid repositories in cfg['repo'] + default repository + # should equal to number of valid repositories in cfg['repo'] + default repository + comps repository + self.assertEqual(len(extra_config.get('repo', [])), 3) + self.assertEqual(extra_config.get('repo').pop()['baseurl'], + 'http://example.com/work/$basearch/comps_repo_Everything') self.assertEqual(extra_config.get('repo').pop()['baseurl'], 'http://example.com/work/$basearch/repo') self.assertEqual(extra_config.get('repo').pop()['baseurl'], 'http://url/to/repo/a')