[checks] Relax check for genisoimage
The rules are similar to isohybrid, but there are no checks for architecture. Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
d8f685000d
commit
0f3bfbbddf
@ -41,6 +41,15 @@ def is_isohybrid_needed(conf):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def is_genisoimage_needed(conf):
|
||||||
|
"""This is only needed locally for productimg and createiso without runroot.
|
||||||
|
"""
|
||||||
|
runroot = conf.get('runroot', False)
|
||||||
|
will_do_productimg = conf.get('productimg', False) and conf.get('bootable', False)
|
||||||
|
if runroot and not will_do_productimg:
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
# The first element in the tuple is package name expected to have the
|
# The first element in the tuple is package name expected to have the
|
||||||
# executable (2nd element of the tuple). The last element is an optional
|
# executable (2nd element of the tuple). The last element is an optional
|
||||||
# function that should determine if the tool is required based on
|
# function that should determine if the tool is required based on
|
||||||
@ -49,7 +58,7 @@ tools = [
|
|||||||
("isomd5sum", "/usr/bin/implantisomd5", None),
|
("isomd5sum", "/usr/bin/implantisomd5", None),
|
||||||
("isomd5sum", "/usr/bin/checkisomd5", None),
|
("isomd5sum", "/usr/bin/checkisomd5", None),
|
||||||
("jigdo", "/usr/bin/jigdo-lite", is_jigdo_needed),
|
("jigdo", "/usr/bin/jigdo-lite", is_jigdo_needed),
|
||||||
("genisoimage", "/usr/bin/genisoimage", None),
|
("genisoimage", "/usr/bin/genisoimage", is_genisoimage_needed),
|
||||||
("gettext", "/usr/bin/msgfmt", None),
|
("gettext", "/usr/bin/msgfmt", None),
|
||||||
("syslinux", "/usr/bin/isohybrid", is_isohybrid_needed),
|
("syslinux", "/usr/bin/isohybrid", is_isohybrid_needed),
|
||||||
("yum-utils", "/usr/bin/createrepo", None),
|
("yum-utils", "/usr/bin/createrepo", None),
|
||||||
|
@ -96,13 +96,38 @@ class CheckDependenciesTestCase(unittest.TestCase):
|
|||||||
'runroot': True,
|
'runroot': True,
|
||||||
}
|
}
|
||||||
|
|
||||||
with mock.patch('platform.machine') as machine:
|
with mock.patch('os.path.exists') as exists:
|
||||||
machine.return_value = 'armhfp'
|
exists.side_effect = self.dont_find(['/usr/bin/isohybrid'])
|
||||||
with mock.patch('os.path.exists') as exists:
|
result = checks.check(conf)
|
||||||
exists.side_effect = self.dont_find(['/usr/bin/isohybrid'])
|
|
||||||
result = checks.check(conf)
|
|
||||||
|
|
||||||
self.assertTrue(result)
|
self.assertTrue(result)
|
||||||
|
|
||||||
|
def test_genisoimg_not_needed_in_runroot(self):
|
||||||
|
conf = {
|
||||||
|
'runroot': True,
|
||||||
|
}
|
||||||
|
|
||||||
|
with mock.patch('os.path.exists') as exists:
|
||||||
|
exists.side_effect = self.dont_find(['/usr/bin/genisoimage'])
|
||||||
|
result = checks.check(conf)
|
||||||
|
|
||||||
|
self.assertTrue(result)
|
||||||
|
|
||||||
|
def test_genisoimg_needed_for_productimg(self):
|
||||||
|
conf = {
|
||||||
|
'runroot': True,
|
||||||
|
'productimg': True,
|
||||||
|
'bootable': True,
|
||||||
|
}
|
||||||
|
|
||||||
|
with mock.patch('sys.stdout', new_callable=StringIO.StringIO) as out:
|
||||||
|
with mock.patch('os.path.exists') as exists:
|
||||||
|
exists.side_effect = self.dont_find(['/usr/bin/genisoimage'])
|
||||||
|
result = checks.check(conf)
|
||||||
|
|
||||||
|
self.assertIn('genisoimage', out.getvalue())
|
||||||
|
self.assertFalse(result)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
Loading…
Reference in New Issue
Block a user