Use modifyrepo_c if possible

When configured to use createrepo_c, we should also use modifyrepo_c.
That allows us to relax the check for createrepo package.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2017-12-04 11:08:40 +01:00
parent 970143e59f
commit 001ae1d7b4
3 changed files with 15 additions and 5 deletions

View File

@ -97,13 +97,13 @@ tools = [
("genisoimage", "/usr/bin/genisoimage", is_genisoimage_needed),
("gettext", "/usr/bin/msgfmt", None),
("syslinux", "/usr/bin/isohybrid", is_isohybrid_needed),
# modifyrepo can always be called
("createrepo", "/usr/bin/modifyrepo", None),
# createrepo and mergerepo are not needed by default, only when
# createrepo, modifyrepo and mergerepo are not needed by default, only when
# createrepo_c is not configured
("createrepo", "/usr/bin/createrepo", lambda conf: not is_createrepo_c_needed(conf)),
("createrepo", "/usr/bin/modifyrepo", lambda conf: not is_createrepo_c_needed(conf)),
("createrepo", "/usr/bin/mergerepo", lambda conf: not is_createrepo_c_needed(conf)),
("createrepo_c", "/usr/bin/createrepo_c", is_createrepo_c_needed),
("createrepo_c", "/usr/bin/modifyrepo_c", is_createrepo_c_needed),
("createrepo_c", "/usr/bin/mergerepo_c", is_createrepo_c_needed),
("yum-utils", "/usr/bin/repoquery", None),

View File

@ -22,10 +22,11 @@ class CreaterepoWrapper(object):
if createrepo_c:
self.createrepo = "createrepo_c"
self.mergerepo = "mergerepo_c"
self.modifyrepo = "modifyrepo_c"
else:
self.createrepo = "createrepo"
self.mergerepo = "mergerepo"
self.modifyrepo = "modifyrepo"
self.modifyrepo = "modifyrepo"
def get_createrepo_cmd(self, directory, baseurl=None, outputdir=None, excludes=None,
pkglist=None, groupfile=None, cachedir=None, update=True,

View File

@ -150,11 +150,20 @@ class CheckDependenciesTestCase(unittest.TestCase):
with mock.patch('sys.stdout', new_callable=StringIO) as out:
with mock.patch('os.path.exists') as exists:
exists.side_effect = self.dont_find(['/usr/bin/modifyrepo'])
result = checks.check({})
result = checks.check({'createrepo_c': False})
self.assertIn('createrepo', out.getvalue())
self.assertFalse(result)
def test_requires_modifyrepo_c(self):
with mock.patch('sys.stdout', new_callable=StringIO) as out:
with mock.patch('os.path.exists') as exists:
exists.side_effect = self.dont_find(['/usr/bin/modifyrepo_c'])
result = checks.check({'createrepo_c': True})
self.assertIn('createrepo_c', out.getvalue())
self.assertFalse(result)
def test_requires_createrepo_c(self):
with mock.patch('sys.stdout', new_callable=StringIO) as out:
with mock.patch('os.path.exists') as exists: