init: Drop database from comps repo

It should not be needed there, since the repo is empty anyway. A test is
added for the variant specific comps repo.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2018-05-17 14:47:53 +02:00
parent 89d798006b
commit 1afb709404
2 changed files with 23 additions and 3 deletions

View File

@ -149,10 +149,12 @@ def create_comps_repo(compose, arch, variant):
compose.log_warning("[SKIP ] %s" % msg)
else:
compose.log_info("[BEGIN] %s" % msg)
cmd = repo.get_createrepo_cmd(comps_repo, update=True, database=True, skip_stat=True,
cmd = repo.get_createrepo_cmd(comps_repo, database=False,
outputdir=comps_repo, groupfile=comps_path,
checksum=createrepo_checksum)
run(cmd, logfile=compose.paths.log.log_file(arch, "comps_repo"), show_cmd=True)
logfile = 'comps_repo-%s' % variant if variant else 'comps_repo'
run(cmd, logfile=compose.paths.log.log_file(arch, logfile),
show_cmd=True)
compose.log_info("[DONE ] %s" % msg)

View File

@ -142,11 +142,29 @@ class TestCreateCompsRepo(PungiTestCase):
[mock.call(['createrepo_c', self.topdir + '/work/x86_64/comps_repo',
'--outputdir=%s/work/x86_64/comps_repo' % self.topdir,
'--groupfile=%s/work/x86_64/comps/comps-x86_64.xml' % self.topdir,
'--update', '--skip-stat', '--database', '--checksum=sha256',
'--update', '--no-database', '--checksum=sha256',
'--unique-md-filenames'],
logfile=self.topdir + '/logs/x86_64/comps_repo.x86_64.log',
show_cmd=True)])
@mock.patch('pungi.phases.init.run')
def test_run_with_variant(self, run):
compose = DummyCompose(self.topdir, {
'createrepo_checksum': 'sha256',
})
compose.DEBUG = False
init.create_comps_repo(compose, 'x86_64', compose.variants['Server'])
self.assertEqual(run.mock_calls,
[mock.call(['createrepo_c', self.topdir + '/work/x86_64/comps_repo_Server',
'--outputdir=%s/work/x86_64/comps_repo_Server' % self.topdir,
'--groupfile=%s/work/x86_64/comps/comps-Server.x86_64.xml' % self.topdir,
'--update', '--no-database', '--checksum=sha256',
'--unique-md-filenames'],
logfile=self.topdir + '/logs/x86_64/comps_repo-Server.x86_64.log',
show_cmd=True)])
@mock.patch('pungi.phases.init.run')
def test_run_in_debug(self, run):
compose = DummyCompose(self.topdir, {