modules: check if all dependencies can be satisfied

Verifies if all dependencies are correctly listed in the modinfo.c too
and stop the builds if they're not.

Signed-off-by: Jose R. Ziviani <jziviani@suse.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jose R. Ziviani <jziviani@suse.de>
Message-Id: <20210624103836.2382472-5-kraxel@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Jose R. Ziviani 2021-06-24 12:38:06 +02:00 committed by Paolo Bonzini
parent 5ebbfecc3e
commit af19eecf84

View File

@ -59,6 +59,7 @@ def generate(name, lines):
print_array("deps", deps)
print_array("opts", opts)
print("},{");
return deps
def print_pre():
print("/* generated by scripts/modinfo-generate.py */")
@ -71,14 +72,26 @@ def print_post():
print("}};")
def main(args):
deps = {}
print_pre()
for modinfo in args:
with open(modinfo) as f:
lines = f.readlines()
print(" /* %s */" % modinfo)
(basename, ext) = os.path.splitext(modinfo)
generate(basename, lines)
deps[basename] = generate(basename, lines)
print_post()
flattened_deps = {flat.strip('" ') for dep in deps.values() for flat in dep}
error = False
for dep in flattened_deps:
if dep not in deps.keys():
print("Dependency {} cannot be satisfied".format(dep),
file=sys.stderr)
error = True
if error:
exit(1)
if __name__ == "__main__":
main(sys.argv[1:])