From af19eecf84e823645a9fb768360c92dc3fa59e65 Mon Sep 17 00:00:00 2001 From: "Jose R. Ziviani" Date: Thu, 24 Jun 2021 12:38:06 +0200 Subject: [PATCH] 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 Signed-off-by: Gerd Hoffmann Reviewed-by: Jose R. Ziviani Message-Id: <20210624103836.2382472-5-kraxel@redhat.com> Signed-off-by: Paolo Bonzini --- scripts/modinfo-generate.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/scripts/modinfo-generate.py b/scripts/modinfo-generate.py index a6d98a6bc4..f559eed007 100755 --- a/scripts/modinfo-generate.py +++ b/scripts/modinfo-generate.py @@ -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:])