summary refs log tree commit diff stats
path: root/scripts/nsis.py
diff options
context:
space:
mode:
authorStefan Weil <sw@weilnetz.de>2025-01-16 16:03:06 +0000
committerAlex Bennée <alex.bennee@linaro.org>2025-01-17 10:46:15 +0000
commitb9eab5efc1a631b476656859beb8eaaa895eb202 (patch)
treeb94ab8310bfd293709fb19d9f49b3c143082684c /scripts/nsis.py
parenta4340e7c522e3f20abeac061a5a8b319f715c1d0 (diff)
downloadfocaccia-qemu-b9eab5efc1a631b476656859beb8eaaa895eb202.tar.gz
focaccia-qemu-b9eab5efc1a631b476656859beb8eaaa895eb202.zip
scripts/nsis.py: Run dependency check for each DLL file only once
Each DLL should only be checked once for dependencies, but
several hundred (781 in my test) unneeded checks were done.

Now the script is significantly faster (16 s in my build).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20250111215244.1680931-1-sw@weilnetz.de>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20250116160306.1709518-38-alex.bennee@linaro.org>
Diffstat (limited to 'scripts/nsis.py')
-rw-r--r--scripts/nsis.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/scripts/nsis.py b/scripts/nsis.py
index 03ed7608a2..af4e064819 100644
--- a/scripts/nsis.py
+++ b/scripts/nsis.py
@@ -37,10 +37,10 @@ def find_deps(exe_or_dll, search_path, analyzed_deps):
 
         analyzed_deps.add(dep)
         # locate the dll dependencies recursively
-        rdeps = find_deps(dll, search_path, analyzed_deps)
+        analyzed_deps, rdeps = find_deps(dll, search_path, analyzed_deps)
         deps.extend(rdeps)
 
-    return deps
+    return analyzed_deps, deps
 
 def main():
     parser = argparse.ArgumentParser(description="QEMU NSIS build helper.")
@@ -92,18 +92,18 @@ def main():
         dlldir = os.path.join(destdir + prefix, "dll")
         os.mkdir(dlldir)
 
+        analyzed_deps = set()
         for exe in glob.glob(os.path.join(destdir + prefix, "*.exe")):
             signcode(exe)
 
             # find all dll dependencies
-            deps = set(find_deps(exe, search_path, set()))
+            analyzed_deps, deps = find_deps(exe, search_path, analyzed_deps)
+            deps = set(deps)
             deps.remove(exe)
 
             # copy all dlls to the DLLDIR
             for dep in deps:
                 dllfile = os.path.join(dlldir, os.path.basename(dep))
-                if (os.path.exists(dllfile)):
-                    continue
                 print("Copying '%s' to '%s'" % (dep, dllfile))
                 shutil.copy(dep, dllfile)