aboutsummaryrefslogtreecommitdiff
path: root/scripts/modinfo-generate.py
diff options
context:
space:
mode:
authorJose R. Ziviani <jziviani@suse.de>2021-06-24 12:38:06 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2021-07-09 18:20:27 +0200
commitaf19eecf84e823645a9fb768360c92dc3fa59e65 (patch)
tree65740eb5dd6d754800afd55e7118021911566386 /scripts/modinfo-generate.py
parent5ebbfecc3e6fa443a506ec5fe65f0ca98973d404 (diff)
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>
Diffstat (limited to 'scripts/modinfo-generate.py')
-rwxr-xr-xscripts/modinfo-generate.py15
1 files changed, 14 insertions, 1 deletions
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:])