[checks] Don't always require jigdo

If the configuration specifically requests no jigdos, there is no point
in checking for the binary existence.

This is not 100% reliable. The jigdo option defaults to True, so if the
option is not specified the binary is required even if there are no
images configured.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2016-03-10 09:08:19 +01:00
parent d909adf26c
commit 337d2a999c
3 changed files with 32 additions and 19 deletions

View File

@ -149,11 +149,6 @@ def main():
parser.error("please specify a config") parser.error("please specify a config")
opts.config = os.path.abspath(opts.config) opts.config = os.path.abspath(opts.config)
# check if all requirements are met
import pungi.checks
if not pungi.checks.check():
sys.exit(1)
import kobo.conf import kobo.conf
import kobo.log import kobo.log
import productmd.composeinfo import productmd.composeinfo
@ -173,6 +168,11 @@ def main():
conf = kobo.conf.PyConfigParser() conf = kobo.conf.PyConfigParser()
conf.load_from_file(opts.config) conf.load_from_file(opts.config)
# check if all requirements are met
import pungi.checks
if not pungi.checks.check(conf):
sys.exit(1)
if opts.target_dir: if opts.target_dir:
compose_dir = Compose.get_compose_dir(opts.target_dir, conf, compose_type=compose_type, compose_label=opts.label) compose_dir = Compose.get_compose_dir(opts.target_dir, conf, compose_type=compose_type, compose_label=opts.label)
else: else:

View File

@ -18,19 +18,27 @@
import os.path import os.path
def is_jigdo_needed(conf):
return conf.get('create_jigdo', True)
# 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
# function that should determine if the tool is required based on
# configuration.
tools = [ tools = [
("isomd5sum", "/usr/bin/implantisomd5"), ("isomd5sum", "/usr/bin/implantisomd5", None),
("isomd5sum", "/usr/bin/checkisomd5"), ("isomd5sum", "/usr/bin/checkisomd5", None),
("jigdo", "/usr/bin/jigdo-lite"), ("jigdo", "/usr/bin/jigdo-lite", is_jigdo_needed),
("genisoimage", "/usr/bin/genisoimage"), ("genisoimage", "/usr/bin/genisoimage", None),
("gettext", "/usr/bin/msgfmt"), ("gettext", "/usr/bin/msgfmt", None),
("syslinux", "/usr/bin/isohybrid"), ("syslinux", "/usr/bin/isohybrid", None),
("yum-utils", "/usr/bin/createrepo"), ("yum-utils", "/usr/bin/createrepo", None),
("yum-utils", "/usr/bin/mergerepo"), ("yum-utils", "/usr/bin/mergerepo", None),
("yum-utils", "/usr/bin/repoquery"), ("yum-utils", "/usr/bin/repoquery", None),
("git", "/usr/bin/git"), ("git", "/usr/bin/git", None),
("cvs", "/usr/bin/cvs"), ("cvs", "/usr/bin/cvs", None),
("gettext", "/usr/bin/msgfmt"), ("gettext", "/usr/bin/msgfmt", None),
] ]
imports = [ imports = [
@ -42,7 +50,7 @@ imports = [
] ]
def check(): def check(conf):
fail = False fail = False
# Check python modules # Check python modules
@ -54,7 +62,10 @@ def check():
fail = True fail = True
# Check tools # Check tools
for package, path in tools: for package, path, test_if_required in tools:
if test_if_required and not test_if_required(conf):
# The config says this file is not required, so we won't even check it.
continue
if not os.path.exists(path): if not os.path.exists(path):
print("Program '%s' doesn't exist. Install package '%s'." % (path, package)) print("Program '%s' doesn't exist. Install package '%s'." % (path, package))
fail = True fail = True

View File

@ -109,3 +109,5 @@ createiso_skip = [
'src': True 'src': True
}), }),
] ]
create_jigdo = False