* [PATCH] scripts/nsis.py: Run dependency check for each DLL file only once
@ 2025-01-11 21:52 Stefan Weil
2025-01-12 17:32 ` Philippe Mathieu-Daudé
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Stefan Weil @ 2025-01-11 21:52 UTC (permalink / raw)
To: Bin Meng, John Snow, Cleber Rosa; +Cc: qemu-devel, qemu-trivial, Stefan Weil
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>
---
scripts/nsis.py | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/scripts/nsis.py b/scripts/nsis.py
index d0914c88a7..d0ac61f6ab 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)
--
2.45.2
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] scripts/nsis.py: Run dependency check for each DLL file only once
2025-01-11 21:52 [PATCH] scripts/nsis.py: Run dependency check for each DLL file only once Stefan Weil
@ 2025-01-12 17:32 ` Philippe Mathieu-Daudé
2025-01-12 17:52 ` Pierrick Bouvier
2025-01-14 11:18 ` Alex Bennée
2 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-12 17:32 UTC (permalink / raw)
To: Stefan Weil, Bin Meng, John Snow, Cleber Rosa
Cc: qemu-devel, qemu-trivial, Pierrick Bouvier
On 11/1/25 22:52, Stefan Weil via wrote:
> 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>
> ---
> scripts/nsis.py | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/scripts/nsis.py b/scripts/nsis.py
> index d0914c88a7..d0ac61f6ab 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)
>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] scripts/nsis.py: Run dependency check for each DLL file only once
2025-01-11 21:52 [PATCH] scripts/nsis.py: Run dependency check for each DLL file only once Stefan Weil
2025-01-12 17:32 ` Philippe Mathieu-Daudé
@ 2025-01-12 17:52 ` Pierrick Bouvier
2025-01-14 11:18 ` Alex Bennée
2 siblings, 0 replies; 4+ messages in thread
From: Pierrick Bouvier @ 2025-01-12 17:52 UTC (permalink / raw)
To: Stefan Weil, Bin Meng, John Snow, Cleber Rosa; +Cc: qemu-devel, qemu-trivial
On 1/11/25 13:52, Stefan Weil via wrote:
> 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>
> ---
> scripts/nsis.py | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/scripts/nsis.py b/scripts/nsis.py
> index d0914c88a7..d0ac61f6ab 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)
>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] scripts/nsis.py: Run dependency check for each DLL file only once
2025-01-11 21:52 [PATCH] scripts/nsis.py: Run dependency check for each DLL file only once Stefan Weil
2025-01-12 17:32 ` Philippe Mathieu-Daudé
2025-01-12 17:52 ` Pierrick Bouvier
@ 2025-01-14 11:18 ` Alex Bennée
2 siblings, 0 replies; 4+ messages in thread
From: Alex Bennée @ 2025-01-14 11:18 UTC (permalink / raw)
To: Stefan Weil via
Cc: Bin Meng, John Snow, Cleber Rosa, Stefan Weil, qemu-trivial
Stefan Weil via <qemu-devel@nongnu.org> writes:
> 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>
Queued to maintainer/jan-2025, thanks.
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-01-14 11:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-11 21:52 [PATCH] scripts/nsis.py: Run dependency check for each DLL file only once Stefan Weil
2025-01-12 17:32 ` Philippe Mathieu-Daudé
2025-01-12 17:52 ` Pierrick Bouvier
2025-01-14 11:18 ` Alex Bennée
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).