repoclosure: Don't run build deps check

Fixes: #521
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2017-01-30 10:16:03 +01:00
parent 7feadb14ba
commit dc7d3b36ab
4 changed files with 6 additions and 48 deletions

View File

@ -34,18 +34,13 @@ class TestPhase(PhaseBase):
def run_repoclosure(compose): def run_repoclosure(compose):
# TODO: Special handling for src packages (use repoclosure param builddeps)
msg = "Running repoclosure" msg = "Running repoclosure"
compose.log_info("[BEGIN] %s" % msg) compose.log_info("[BEGIN] %s" % msg)
# Variant repos # Variant repos
all_repos = {} # to be used as lookaside for the self-hosting check
all_arches = set()
for arch in compose.get_arches(): for arch in compose.get_arches():
is_multilib = is_arch_multilib(compose.conf, arch) is_multilib = is_arch_multilib(compose.conf, arch)
arches = get_valid_arches(arch, is_multilib) arches = get_valid_arches(arch, is_multilib)
all_arches.update(arches)
for variant in compose.get_variants(arch=arch): for variant in compose.get_variants(arch=arch):
if variant.is_empty: if variant.is_empty:
continue continue
@ -70,37 +65,11 @@ def run_repoclosure(compose):
# https://bugzilla.redhat.com/show_bug.cgi?id=795137 # https://bugzilla.redhat.com/show_bug.cgi?id=795137
tmp_dir = compose.mkdtemp(prefix="repoclosure_") tmp_dir = compose.mkdtemp(prefix="repoclosure_")
try: try:
run(cmd, logfile=compose.paths.log.log_file(arch, "repoclosure-%s" % variant), show_cmd=True, can_fail=True, workdir=tmp_dir) run(cmd, logfile=compose.paths.log.log_file(arch, "repoclosure-%s" % variant),
show_cmd=True, can_fail=True, workdir=tmp_dir)
finally: finally:
rmtree(tmp_dir) rmtree(tmp_dir)
all_repos.update(repos)
all_repos.update(lookaside)
repo_id = "repoclosure-%s.%s" % (variant.uid, "src")
repo_dir = compose.paths.compose.repository(arch="src", variant=variant)
all_repos[repo_id] = repo_dir
# A SRPM can be built on any arch and is always rebuilt before building on the target arch.
# This means the deps can't be always satisfied within one tree arch.
# As a workaround, let's run the self-hosting check across all repos.
# XXX: This doesn't solve a situation, when a noarch package is excluded due to ExcludeArch/ExclusiveArch and it's still required on that arch.
# In this case, it's an obvious bug in the test.
# check BuildRequires (self-hosting)
try:
cmd = repoclosure.get_repoclosure_cmd(backend=compose.conf['repoclosure_backend'],
repos=all_repos, arch=all_arches, builddeps=True)
except RuntimeError as exc:
compose.log_error('%s, skipping builddeps check...' % str(exc))
# Use temp working directory directory as workaround for
# https://bugzilla.redhat.com/show_bug.cgi?id=795137
tmp_dir = compose.mkdtemp(prefix="repoclosure_")
try:
run(cmd, logfile=compose.paths.log.log_file("global", "repoclosure-builddeps"), show_cmd=True, can_fail=True, workdir=tmp_dir)
finally:
rmtree(tmp_dir)
compose.log_info("[DONE ] %s" % msg) compose.log_info("[DONE ] %s" % msg)

View File

@ -19,11 +19,7 @@ import os
from kobo.shortcuts import force_list from kobo.shortcuts import force_list
def get_repoclosure_cmd(backend='yum', arch=None, builddeps=False, def get_repoclosure_cmd(backend='yum', arch=None, repos=None, lookaside=None):
repos=None, lookaside=None):
if backend == 'dnf' and builddeps:
raise RuntimeError('dnf repoclosure does not support builddeps')
cmds = { cmds = {
'yum': {'cmd': ['/usr/bin/repoclosure'], 'repoarg': '--repoid=%s', 'lookaside': '--lookaside=%s'}, 'yum': {'cmd': ['/usr/bin/repoclosure'], 'repoarg': '--repoid=%s', 'lookaside': '--lookaside=%s'},
'dnf': {'cmd': ['dnf', 'repoclosure'], 'repoarg': '--repo=%s', 'lookaside': '--repo=%s'}, 'dnf': {'cmd': ['dnf', 'repoclosure'], 'repoarg': '--repo=%s', 'lookaside': '--repo=%s'},
@ -39,9 +35,6 @@ def get_repoclosure_cmd(backend='yum', arch=None, builddeps=False,
for i in force_list(arch or []): for i in force_list(arch or []):
cmd.append("--arch=%s" % i) cmd.append("--arch=%s" % i)
if builddeps:
cmd.append("--builddeps")
repos = repos or {} repos = repos or {}
for repo_id, repo_path in repos.iteritems(): for repo_id, repo_path in repos.iteritems():
cmd.append("--repofrompath=%s,%s" % (repo_id, _to_url(repo_path))) cmd.append("--repofrompath=%s,%s" % (repo_id, _to_url(repo_path)))

View File

@ -36,13 +36,11 @@ class RepoclosureWrapperTestCase(unittest.TestCase):
repos = {'my-repo': '/mnt/koji/repo'} repos = {'my-repo': '/mnt/koji/repo'}
lookaside = {'fedora': 'http://kojipkgs.fp.o/repo'} lookaside = {'fedora': 'http://kojipkgs.fp.o/repo'}
cmd = rc.get_repoclosure_cmd(arch='x86_64', builddeps=True, cmd = rc.get_repoclosure_cmd(arch='x86_64', repos=repos, lookaside=lookaside)
repos=repos, lookaside=lookaside)
self.assertEqual(cmd[0], '/usr/bin/repoclosure') self.assertEqual(cmd[0], '/usr/bin/repoclosure')
self.assertItemsEqual( self.assertItemsEqual(
cmd[1:], cmd[1:],
['--arch=x86_64', ['--arch=x86_64',
'--builddeps',
'--repofrompath=my-repo,file:///mnt/koji/repo', '--repofrompath=my-repo,file:///mnt/koji/repo',
'--repofrompath=fedora,http://kojipkgs.fp.o/repo', '--repofrompath=fedora,http://kojipkgs.fp.o/repo',
'--repoid=my-repo', '--repoid=my-repo',

View File

@ -198,8 +198,7 @@ class TestRepoclosure(PungiTestCase):
mock.call(backend='yum', arch=['x86_64', 'noarch'], lookaside={}, mock.call(backend='yum', arch=['x86_64', 'noarch'], lookaside={},
repos=self._get_repo('Server', 'x86_64')), repos=self._get_repo('Server', 'x86_64')),
mock.call(backend='yum', arch=['x86_64', 'noarch'], lookaside={}, mock.call(backend='yum', arch=['x86_64', 'noarch'], lookaside={},
repos=self._get_repo('Everything', 'x86_64')), repos=self._get_repo('Everything', 'x86_64'))])
mock.call(backend='yum', arch={'x86_64', 'amd64', 'noarch'}, builddeps=True, repos=all_repos)])
@mock.patch('pungi.wrappers.repoclosure.get_repoclosure_cmd') @mock.patch('pungi.wrappers.repoclosure.get_repoclosure_cmd')
@mock.patch('pungi.phases.test.run') @mock.patch('pungi.phases.test.run')
@ -224,8 +223,7 @@ class TestRepoclosure(PungiTestCase):
mock.call(backend='dnf', arch=['x86_64', 'noarch'], lookaside={}, mock.call(backend='dnf', arch=['x86_64', 'noarch'], lookaside={},
repos=self._get_repo('Server', 'x86_64')), repos=self._get_repo('Server', 'x86_64')),
mock.call(backend='dnf', arch=['x86_64', 'noarch'], lookaside={}, mock.call(backend='dnf', arch=['x86_64', 'noarch'], lookaside={},
repos=self._get_repo('Everything', 'x86_64')), repos=self._get_repo('Everything', 'x86_64'))])
mock.call(backend='dnf', arch={'x86_64', 'amd64', 'noarch'}, builddeps=True, repos=all_repos)])
if __name__ == "__main__": if __name__ == "__main__":