Remove comps from arch repo

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ář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2018-04-09 15:32:33 +02:00
parent 9daaf1e038
commit 15ccd309fa
12 changed files with 117 additions and 45 deletions

View File

@ -153,7 +153,7 @@ class WorkPaths(object):
makedirs(path) makedirs(path)
return path return path
def comps_repo(self, arch=None, create_dir=True): def comps_repo(self, arch=None, variant=None, create_dir=True):
""" """
Examples: Examples:
work/x86_64/comps-repo work/x86_64/comps-repo
@ -161,6 +161,8 @@ class WorkPaths(object):
""" """
arch = arch or "global" arch = arch or "global"
path = os.path.join(self.topdir(arch, create_dir=create_dir), "comps_repo") path = os.path.join(self.topdir(arch, create_dir=create_dir), "comps_repo")
if variant:
path += '_' + variant.uid
if create_dir: if create_dir:
makedirs(path) makedirs(path)
return path return path

View File

@ -57,7 +57,7 @@ class BuildinstallPhase(PhaseBase):
return True return True
return False 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 noupgrade = True
bugurl = None bugurl = None
nomacboot = True nomacboot = True
@ -97,6 +97,11 @@ class BuildinstallPhase(PhaseBase):
repos = [repo_baseurl] + get_arch_variant_data(self.compose.conf, repos = [repo_baseurl] + get_arch_variant_data(self.compose.conf,
'lorax_extra_sources', arch, variant) '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 = LoraxWrapper()
lorax_cmd = lorax.get_lorax_cmd(self.compose.conf["release_name"], 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) volid = get_volid(self.compose, arch, variant=variant, disc_type=disc_type)
commands.append( commands.append(
(variant, (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": elif self.buildinstall_method == "buildinstall":
volid = get_volid(self.compose, arch, disc_type=disc_type) volid = get_volid(self.compose, arch, disc_type=disc_type)

View File

@ -93,7 +93,16 @@ def write_pungi_config(compose, arch, variant, packages, groups, filter_packages
compose.log_info(msg) 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 = {} lookaside_repos = {}
for i, repo_url in enumerate(pungi.phases.gather.get_lookaside_repos(compose, arch, variant)): for i, repo_url in enumerate(pungi.phases.gather.get_lookaside_repos(compose, arch, variant)):

View File

@ -42,12 +42,13 @@ class InitPhase(PhaseBase):
write_global_comps(self.compose) write_global_comps(self.compose)
for arch in self.compose.get_arches(): for arch in self.compose.get_arches():
write_arch_comps(self.compose, arch) write_arch_comps(self.compose, arch)
create_comps_repo(self.compose, arch) create_comps_repo(self.compose, arch, None)
# write variant comps # write variant comps
for variant in self.compose.get_variants(): for variant in self.compose.get_variants():
for arch in variant.arches: for arch in variant.arches:
write_variant_comps(self.compose, arch, variant) write_variant_comps(self.compose, arch, variant)
create_comps_repo(self.compose, arch, variant)
# download variants.xml / product.xml? # download variants.xml / product.xml?
@ -131,13 +132,13 @@ def write_variant_comps(compose, arch, variant):
comps.write_comps() comps.write_comps()
def create_comps_repo(compose, arch): def create_comps_repo(compose, arch, variant):
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)
comps_repo = compose.paths.work.comps_repo(arch=arch) comps_repo = compose.paths.work.comps_repo(arch=arch, variant=variant)
comps_path = compose.paths.work.comps(arch=arch) comps_path = compose.paths.work.comps(arch=arch, variant=variant)
msg = "Creating comps repo for arch '%s'" % arch 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")): if compose.DEBUG and os.path.isdir(os.path.join(comps_repo, "repodata")):
compose.log_warning("[SKIP ] %s" % msg) compose.log_warning("[SKIP ] %s" % msg)
else: else:

View File

@ -59,7 +59,11 @@ class OSTreeThread(WorkerThread):
self._clone_repo(repodir, config['config_url'], config.get('config_branch', 'master')) self._clone_repo(repodir, config['config_url'], config.get('config_branch', 'master'))
repo_baseurl = compose.paths.work.arch_repo('$basearch', create_dir=False) 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 # copy the original config and update before save to a json file
new_config = copy.copy(config) new_config = copy.copy(config)

View File

@ -65,8 +65,11 @@ class OstreeInstallerThread(WorkerThread):
self.logdir = compose.paths.log.topdir('%s/%s/ostree_installer-%s' % (arch, variant, self.num)) 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) 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 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, arch=arch,
logger=self.pool) logger=self.pool)
repos = [url.replace('$arch', arch) for url in repos] repos = [url.replace('$arch', arch) for url in repos]

View File

@ -95,12 +95,9 @@ def create_arch_repos(compose, arch, path_prefix):
return return
compose.log_info("[BEGIN] %s" % msg) 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, 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, pkglist=compose.paths.work.package_list(arch=arch), outputdir=repo_dir,
baseurl="file://%s" % path_prefix, workers=compose.conf["createrepo_num_workers"], 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) run(cmd, logfile=compose.paths.log.log_file(arch, "arch_repo"), show_cmd=True)
compose.log_info("[DONE ] %s" % msg) compose.log_info("[DONE ] %s" % msg)

View File

@ -30,6 +30,7 @@ class BuildInstallCompose(DummyCompose):
is_empty=False), is_empty=False),
} }
self.all_variants = self.variants.copy() self.all_variants = self.variants.copy()
self.has_comps = True
class TestBuildinstallPhase(PungiTestCase): class TestBuildinstallPhase(PungiTestCase):
@ -114,7 +115,8 @@ class TestBuildinstallPhase(PungiTestCase):
self.assertItemsEqual( self.assertItemsEqual(
loraxCls.return_value.get_lorax_cmd.mock_calls, loraxCls.return_value.get_lorax_cmd.mock_calls,
[mock.call('Test', '1', '1', [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', self.topdir + '/work/x86_64/buildinstall/Server',
buildarch='x86_64', is_final=True, nomacboot=True, noupgrade=True, buildarch='x86_64', is_final=True, nomacboot=True, noupgrade=True,
volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'], volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'],
@ -123,7 +125,8 @@ class TestBuildinstallPhase(PungiTestCase):
add_template_var=[], add_arch_template_var=[], add_template_var=[], add_arch_template_var=[],
log_dir=self.topdir + '/logs/x86_64/buildinstall-Server-logs'), log_dir=self.topdir + '/logs/x86_64/buildinstall-Server-logs'),
mock.call('Test', '1', '1', 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', self.topdir + '/work/amd64/buildinstall/Server',
buildarch='amd64', is_final=True, nomacboot=True, noupgrade=True, buildarch='amd64', is_final=True, nomacboot=True, noupgrade=True,
volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'], volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'],
@ -132,7 +135,8 @@ class TestBuildinstallPhase(PungiTestCase):
add_template_var=[], add_arch_template_var=[], add_template_var=[], add_arch_template_var=[],
log_dir=self.topdir + '/logs/amd64/buildinstall-Server-logs'), log_dir=self.topdir + '/logs/amd64/buildinstall-Server-logs'),
mock.call('Test', '1', '1', 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', self.topdir + '/work/amd64/buildinstall/Client',
buildarch='amd64', is_final=True, nomacboot=True, noupgrade=True, buildarch='amd64', is_final=True, nomacboot=True, noupgrade=True,
volid='vol_id', variant='Client', buildinstallpackages=[], volid='vol_id', variant='Client', buildinstallpackages=[],
@ -177,7 +181,8 @@ class TestBuildinstallPhase(PungiTestCase):
lorax = loraxCls.return_value lorax = loraxCls.return_value
lorax.get_lorax_cmd.assert_has_calls( lorax.get_lorax_cmd.assert_has_calls(
[mock.call('Test', '1', '1', [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', self.topdir + '/work/amd64/buildinstall/Client',
buildarch='amd64', is_final=True, nomacboot=True, noupgrade=True, buildarch='amd64', is_final=True, nomacboot=True, noupgrade=True,
volid='vol_id', variant='Client', buildinstallpackages=[], volid='vol_id', variant='Client', buildinstallpackages=[],
@ -277,7 +282,8 @@ class TestBuildinstallPhase(PungiTestCase):
self.assertItemsEqual( self.assertItemsEqual(
loraxCls.return_value.get_lorax_cmd.mock_calls, loraxCls.return_value.get_lorax_cmd.mock_calls,
[mock.call('Test', '1', '1', [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', self.topdir + '/work/x86_64/buildinstall/Server',
buildarch='x86_64', is_final=True, nomacboot=True, noupgrade=True, buildarch='x86_64', is_final=True, nomacboot=True, noupgrade=True,
volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'], volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'],
@ -286,7 +292,8 @@ class TestBuildinstallPhase(PungiTestCase):
bugurl='http://example.com', bugurl='http://example.com',
log_dir=self.topdir + '/logs/x86_64/buildinstall-Server-logs'), log_dir=self.topdir + '/logs/x86_64/buildinstall-Server-logs'),
mock.call('Test', '1', '1', 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', self.topdir + '/work/amd64/buildinstall/Server',
buildarch='amd64', is_final=True, nomacboot=True, noupgrade=False, buildarch='amd64', is_final=True, nomacboot=True, noupgrade=False,
volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'], volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'],
@ -295,7 +302,8 @@ class TestBuildinstallPhase(PungiTestCase):
add_template_var=[], add_arch_template_var=[], add_template_var=[], add_arch_template_var=[],
log_dir=self.topdir + '/logs/amd64/buildinstall-Server-logs'), log_dir=self.topdir + '/logs/amd64/buildinstall-Server-logs'),
mock.call('Test', '1', '1', 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', self.topdir + '/work/amd64/buildinstall/Client',
buildarch='amd64', is_final=True, nomacboot=False, noupgrade=True, buildarch='amd64', is_final=True, nomacboot=False, noupgrade=True,
volid='vol_id', variant='Client', buildinstallpackages=[], volid='vol_id', variant='Client', buildinstallpackages=[],
@ -349,7 +357,8 @@ class TestBuildinstallPhase(PungiTestCase):
self.assertItemsEqual( self.assertItemsEqual(
loraxCls.return_value.get_lorax_cmd.mock_calls, loraxCls.return_value.get_lorax_cmd.mock_calls,
[mock.call('Test', '1', '1', [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', self.topdir + '/work/x86_64/buildinstall/Server',
buildarch='x86_64', is_final=True, nomacboot=False, noupgrade=False, buildarch='x86_64', is_final=True, nomacboot=False, noupgrade=False,
volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'], volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'],
@ -358,7 +367,8 @@ class TestBuildinstallPhase(PungiTestCase):
add_template_var=[], add_arch_template_var=[], add_template_var=[], add_arch_template_var=[],
log_dir=self.topdir + '/logs/x86_64/buildinstall-Server-logs'), log_dir=self.topdir + '/logs/x86_64/buildinstall-Server-logs'),
mock.call('Test', '1', '1', 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', self.topdir + '/work/amd64/buildinstall/Server',
buildarch='amd64', is_final=True, nomacboot=True, noupgrade=False, buildarch='amd64', is_final=True, nomacboot=True, noupgrade=False,
volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'], volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'],
@ -367,7 +377,8 @@ class TestBuildinstallPhase(PungiTestCase):
add_template_var=[], add_arch_template_var=[], add_template_var=[], add_arch_template_var=[],
log_dir=self.topdir + '/logs/amd64/buildinstall-Server-logs'), log_dir=self.topdir + '/logs/amd64/buildinstall-Server-logs'),
mock.call('Test', '1', '1', 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', self.topdir + '/work/amd64/buildinstall/Client',
buildarch='amd64', is_final=True, nomacboot=True, noupgrade=False, buildarch='amd64', is_final=True, nomacboot=True, noupgrade=False,
volid='vol_id', variant='Client', buildinstallpackages=[], volid='vol_id', variant='Client', buildinstallpackages=[],
@ -421,7 +432,8 @@ class TestBuildinstallPhase(PungiTestCase):
self.assertItemsEqual( self.assertItemsEqual(
loraxCls.return_value.get_lorax_cmd.mock_calls, loraxCls.return_value.get_lorax_cmd.mock_calls,
[mock.call('Test', '1', '1', [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', buildinstall_topdir + '/x86_64/Server/results',
buildarch='x86_64', is_final=True, nomacboot=True, noupgrade=True, buildarch='x86_64', is_final=True, nomacboot=True, noupgrade=True,
volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'], volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'],
@ -430,7 +442,8 @@ class TestBuildinstallPhase(PungiTestCase):
bugurl=None, bugurl=None,
log_dir=buildinstall_topdir + '/x86_64/Server/logs'), log_dir=buildinstall_topdir + '/x86_64/Server/logs'),
mock.call('Test', '1', '1', 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', buildinstall_topdir + '/amd64/Server/results',
buildarch='amd64', is_final=True, nomacboot=True, noupgrade=True, buildarch='amd64', is_final=True, nomacboot=True, noupgrade=True,
volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'], volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'],
@ -439,7 +452,8 @@ class TestBuildinstallPhase(PungiTestCase):
add_template_var=[], add_arch_template_var=[], add_template_var=[], add_arch_template_var=[],
log_dir=buildinstall_topdir + '/amd64/Server/logs'), log_dir=buildinstall_topdir + '/amd64/Server/logs'),
mock.call('Test', '1', '1', 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', buildinstall_topdir + '/amd64/Client/results',
buildarch='amd64', is_final=True, nomacboot=True, noupgrade=True, buildarch='amd64', is_final=True, nomacboot=True, noupgrade=True,
volid='vol_id', variant='Client', buildinstallpackages=[], volid='vol_id', variant='Client', buildinstallpackages=[],
@ -481,10 +495,13 @@ class TestBuildinstallPhase(PungiTestCase):
phase.run() phase.run()
self.maxDiff = None
self.assertItemsEqual( self.assertItemsEqual(
loraxCls.return_value.get_lorax_cmd.mock_calls, loraxCls.return_value.get_lorax_cmd.mock_calls,
[mock.call('Test', '1', '1', [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', self.topdir + '/work/x86_64/buildinstall/Server',
buildarch='x86_64', is_final=True, nomacboot=True, noupgrade=True, buildarch='x86_64', is_final=True, nomacboot=True, noupgrade=True,
volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'], volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'],
@ -493,7 +510,8 @@ class TestBuildinstallPhase(PungiTestCase):
bugurl=None, bugurl=None,
log_dir=self.topdir + '/logs/x86_64/buildinstall-Server-logs'), log_dir=self.topdir + '/logs/x86_64/buildinstall-Server-logs'),
mock.call('Test', '1', '1', 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', self.topdir + '/work/amd64/buildinstall/Server',
buildarch='amd64', is_final=True, nomacboot=True, noupgrade=True, buildarch='amd64', is_final=True, nomacboot=True, noupgrade=True,
volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'], volid='vol_id', variant='Server', buildinstallpackages=['bash', 'vim'],
@ -504,7 +522,8 @@ class TestBuildinstallPhase(PungiTestCase):
mock.call('Test', '1', '1', mock.call('Test', '1', '1',
[self.topdir + '/work/amd64/repo', [self.topdir + '/work/amd64/repo',
"http://example.com/repo2", "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', self.topdir + '/work/amd64/buildinstall/Client',
buildarch='amd64', is_final=True, nomacboot=True, noupgrade=True, buildarch='amd64', is_final=True, nomacboot=True, noupgrade=True,
volid='vol_id', variant='Client', buildinstallpackages=[], volid='vol_id', variant='Client', buildinstallpackages=[],

View File

@ -37,7 +37,8 @@ class TestWritePungiConfig(helpers.PungiTestCase):
ks_path=self.topdir + '/work/x86_64/pungi/Server.x86_64.conf', ks_path=self.topdir + '/work/x86_64/pungi/Server.x86_64.conf',
lookaside_repos={}, multilib_whitelist=white, multilib_blacklist=black, lookaside_repos={}, multilib_whitelist=white, multilib_blacklist=black,
groups=['grp1'], prepopulate=prepopulate, 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'], exclude_packages=['pkg3', 'pkg4.x86_64'],
fulltree_excludes=fulltree, package_whitelist=set()) fulltree_excludes=fulltree, package_whitelist=set())
@ -53,7 +54,8 @@ class TestWritePungiConfig(helpers.PungiTestCase):
lookaside_repos={'lookaside-repo-0': 'http://example.com/repo'}, lookaside_repos={'lookaside-repo-0': 'http://example.com/repo'},
multilib_whitelist=[], multilib_blacklist=[], multilib_whitelist=[], multilib_blacklist=[],
groups=[], prepopulate=None, 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, exclude_packages=[], fulltree_excludes=None,
package_whitelist=set()) package_whitelist=set())
self.assertEqual(glr.call_args_list, 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', ks_path=self.topdir + '/work/x86_64/pungi/Server.x86_64.conf',
lookaside_repos={}, multilib_whitelist=white, multilib_blacklist=black, lookaside_repos={}, multilib_whitelist=white, multilib_blacklist=black,
groups=['grp1'], prepopulate=prepopulate, 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'], exclude_packages=['pkg3', 'pkg4.x86_64'],
fulltree_excludes=fulltree, fulltree_excludes=fulltree,
package_whitelist=set(['pkg-0:1.0.0-1'])) package_whitelist=set(['pkg-0:1.0.0-1']))

View File

@ -34,7 +34,13 @@ class TestInitPhase(PungiTestCase):
self.assertItemsEqual(write_arch.mock_calls, self.assertItemsEqual(write_arch.mock_calls,
[mock.call(compose, 'x86_64'), mock.call(compose, 'amd64')]) [mock.call(compose, 'x86_64'), mock.call(compose, 'amd64')])
self.assertItemsEqual(create_comps.mock_calls, 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, self.assertItemsEqual(write_variant.mock_calls,
[mock.call(compose, 'x86_64', compose.variants['Server']), [mock.call(compose, 'x86_64', compose.variants['Server']),
mock.call(compose, 'amd64', compose.variants['Server']), mock.call(compose, 'amd64', compose.variants['Server']),
@ -63,7 +69,12 @@ class TestInitPhase(PungiTestCase):
self.assertItemsEqual(write_arch.mock_calls, self.assertItemsEqual(write_arch.mock_calls,
[mock.call(compose, 'x86_64'), mock.call(compose, 'amd64')]) [mock.call(compose, 'x86_64'), mock.call(compose, 'amd64')])
self.assertItemsEqual(create_comps.mock_calls, 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, self.assertItemsEqual(write_variant.mock_calls,
[mock.call(compose, 'x86_64', compose.variants['Server']), [mock.call(compose, 'x86_64', compose.variants['Server']),
mock.call(compose, 'amd64', compose.variants['Server']), mock.call(compose, 'amd64', compose.variants['Server']),
@ -125,7 +136,7 @@ class TestCreateCompsRepo(PungiTestCase):
}) })
compose.DEBUG = False compose.DEBUG = False
init.create_comps_repo(compose, 'x86_64') init.create_comps_repo(compose, 'x86_64', None)
self.assertEqual(run.mock_calls, self.assertEqual(run.mock_calls,
[mock.call(['createrepo_c', self.topdir + '/work/x86_64/comps_repo', '--verbose', [mock.call(['createrepo_c', self.topdir + '/work/x86_64/comps_repo', '--verbose',
@ -144,7 +155,7 @@ class TestCreateCompsRepo(PungiTestCase):
compose.DEBUG = True compose.DEBUG = True
os.makedirs(self.topdir + '/work/x86_64/comps_repo/repodata') 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, []) self.assertEqual(run.mock_calls, [])

View File

@ -159,7 +159,8 @@ class OstreeThreadTest(helpers.PungiTestCase):
t.process((self.compose, self.compose.variants['Everything'], 'x86_64', cfg), 1) t.process((self.compose, self.compose.variants['Everything'], 'x86_64', cfg), 1)
self.assertRunrootCall(koji, 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'], cfg['release'],
extra=['--logfile=%s/%s/lorax.log' % (self.topdir, LOG_PATH)]) extra=['--logfile=%s/%s/lorax.log' % (self.topdir, LOG_PATH)])
self.assertIsoLinked(link, get_file_size, get_mtime, final_iso_path) self.assertIsoLinked(link, get_file_size, get_mtime, final_iso_path)
@ -196,7 +197,8 @@ class OstreeThreadTest(helpers.PungiTestCase):
self.assertRunrootCall(koji, self.assertRunrootCall(koji,
('http://example.com/repo/x86_64/', ('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'], cfg['release'],
isfinal=True, isfinal=True,
extra=['--logfile=%s/%s/lorax.log' % (self.topdir, LOG_PATH)]) 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-repo1.repo',
'https://example.com/extra-repo2.repo', 'https://example.com/extra-repo2.repo',
'http://example.com/work/$basearch/repo', 'http://example.com/work/$basearch/repo',
'http://example.com/work/$basearch/comps_repo_Everything',
] ]
self.assertRunrootCall(koji, sources, cfg['release'], isfinal=True, 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-repo1.repo',
'https://example.com/extra-repo2.repo', 'https://example.com/extra-repo2.repo',
'http://example.com/work/$basearch/repo', 'http://example.com/work/$basearch/repo',
'http://example.com/work/$basearch/comps_repo_Everything',
] ]
self.assertRunrootCall(koji, sources, cfg['release'], isfinal=True, self.assertRunrootCall(koji, sources, cfg['release'], isfinal=True,
@ -353,7 +357,8 @@ class OstreeThreadTest(helpers.PungiTestCase):
'branch': 'f24', 'dir': '.'}, 'branch': 'f24', 'dir': '.'},
templ_dir, logger=pool._logger)]) templ_dir, logger=pool._logger)])
self.assertRunrootCall(koji, 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'], cfg['release'],
isfinal=True, isfinal=True,
extra=['--add-template=%s/some_file.txt' % templ_dir, extra=['--add-template=%s/some_file.txt' % templ_dir,
@ -406,7 +411,8 @@ class OstreeThreadTest(helpers.PungiTestCase):
self.assertRunrootCall( self.assertRunrootCall(
koji, koji,
'http://example.com/work/$basearch/repo', ['http://example.com/work/$basearch/repo',
'http://example.com/work/$basearch/comps_repo_Everything'],
'20151203.t.0', '20151203.t.0',
isfinal=True, isfinal=True,
extra=['--installpkgs=fedora-productimg-atomic', extra=['--installpkgs=fedora-productimg-atomic',
@ -467,7 +473,8 @@ class OstreeThreadTest(helpers.PungiTestCase):
self.assertRunrootCall( self.assertRunrootCall(
koji, koji,
'http://example.com/work/$basearch/repo', ['http://example.com/work/$basearch/repo',
'http://example.com/work/$basearch/comps_repo_Everything'],
'20151203.t.0', '20151203.t.0',
isfinal=True, isfinal=True,
extra=['--installpkgs=fedora-productimg-atomic', extra=['--installpkgs=fedora-productimg-atomic',

View File

@ -167,7 +167,15 @@ class OSTreeThreadTest(helpers.PungiTestCase):
self.assertTrue(os.path.isfile(extra_config_file)) self.assertTrue(os.path.isfile(extra_config_file))
with open(extra_config_file, 'r') as f: with open(extra_config_file, 'r') as f:
extraconf_content = json.load(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) self.assertEqual(proper_extraconf_content, extraconf_content)
@mock.patch('pungi.wrappers.scm.get_dir_from_scm') @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: with open(extra_config_file, 'r') as extra_config_fd:
extra_config = json.load(extra_config_fd) extra_config = json.load(extra_config_fd)
self.assertTrue(extra_config.get('keep_original_sources', False)) 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://example.com/work/$basearch/repo')
self.assertEqual(extra_config.get('repo').pop()['baseurl'], 'http://url/to/repo/a') self.assertEqual(extra_config.get('repo').pop()['baseurl'], 'http://url/to/repo/a')