From nobody Sun Apr 6 03:35:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1736632437; cv=none; d=zohomail.com; s=zohoarc; b=ZV6spSWDQQkDQyHYn35fBJF+LiyOddoWOSvCfQTkzyWBUKEt5J5MDgJ+SYF+IZ/NGkXhWBdmORZJ6PXK+6NHpx06tnNBnEc2GfJiIjT4CtyBYCedUEC2IWsAr2IZITUzQINjnaVq5ebEy0LNEDSWhY3aK/Rm+3RsThBfFXPL2GU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1736632437; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Sender:Subject:Subject:To:To:Message-Id; bh=3EMjyLpW+bJotNajsv8HeTd5fsBqAGxCZOGAxTRuO8M=; b=S0nAecP4u+PTNV1yKoVzbQMDKqf6D0o31QEVQynF4a329im2JlGDLt57HGBZeOCPtCdktmbc7orpEid82f0HhuCE7obOxqNHh+Ml8rn0MRR+WnspOzydHVRJO1oxXF9KCd3cobG5/c2VwN1KY9pvVyuvH2ktQK4wZ6nrdq9Vv0c= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1736632437036648.4398817014109; Sat, 11 Jan 2025 13:53:57 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tWjPh-0007PF-L6; Sat, 11 Jan 2025 16:53:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tWjPf-0007OY-F1; Sat, 11 Jan 2025 16:52:59 -0500 Received: from mail.weilnetz.de ([37.120.169.71] helo=mail.v2201612906741603.powersrv.de) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tWjPd-00032n-Nk; Sat, 11 Jan 2025 16:52:59 -0500 Received: from qemu.weilnetz.de (qemu.weilnetz.de [188.68.58.204]) by mail.v2201612906741603.powersrv.de (Postfix) with ESMTP id 6C79DDA07BC; Sat, 11 Jan 2025 22:52:53 +0100 (CET) Received: by qemu.weilnetz.de (Postfix, from userid 1000) id 31906460023; Sat, 11 Jan 2025 22:52:53 +0100 (CET) Authentication-Results: mail.v2201612906741603.powersrv.de; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=weilnetz.de (policy=none); spf=softfail (mail.v2201612906741603.powersrv.de: 188.68.58.204 is neither permitted nor denied by domain of stefan@weilnetz.de) smtp.mailfrom=stefan@weilnetz.de To: Bin Meng , John Snow , Cleber Rosa Cc: qemu-devel@nongnu.org, qemu-trivial@nongnu.org, Stefan Weil Subject: [PATCH] scripts/nsis.py: Run dependency check for each DLL file only once Date: Sat, 11 Jan 2025 22:52:44 +0100 Message-Id: <20250111215244.1680931-1-sw@weilnetz.de> X-Mailer: git-send-email 2.39.5 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Action: no action X-Rspamd-Queue-Id: 6C79DDA07BC X-Spamd-Bar: ++ X-Spamd-Result: default: False [2.60 / 12.00]; VIOLATED_DIRECT_SPF(3.50)[]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; FORGED_SENDER(0.30)[sw@weilnetz.de,stefan@weilnetz.de]; ONCE_RECEIVED(0.20)[]; DMARC_POLICY_SOFTFAIL(0.10)[weilnetz.de : No valid SPF, No valid DKIM,quarantine,sampled_out]; MIME_GOOD(-0.10)[text/plain]; RCVD_NO_TLS_LAST(0.10)[]; RCVD_COUNT_ONE(0.00)[1]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:197540, ipnet:188.68.56.0/22, country:DE]; R_DKIM_NA(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_FIVE(0.00)[6]; FROM_NEQ_ENVFROM(0.00)[sw@weilnetz.de,stefan@weilnetz.de]; R_SPF_SOFTFAIL(0.00)[~all]; ARC_NA(0.00)[] X-Rspamd-Server: v2201612906741603 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=37.120.169.71; envelope-from=stefan@weilnetz.de; helo=mail.v2201612906741603.powersrv.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Stefan Weil From: Stefan Weil via Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1736632440846019000 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Pierrick Bouvier --- 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): =20 analyzed_deps.add(dep) # locate the dll dependencies recursively - rdeps =3D find_deps(dll, search_path, analyzed_deps) + analyzed_deps, rdeps =3D find_deps(dll, search_path, analyzed_deps) deps.extend(rdeps) =20 - return deps + return analyzed_deps, deps =20 def main(): parser =3D argparse.ArgumentParser(description=3D"QEMU NSIS build help= er.") @@ -92,18 +92,18 @@ def main(): dlldir =3D os.path.join(destdir + prefix, "dll") os.mkdir(dlldir) =20 + analyzed_deps =3D set() for exe in glob.glob(os.path.join(destdir + prefix, "*.exe")): signcode(exe) =20 # find all dll dependencies - deps =3D set(find_deps(exe, search_path, set())) + analyzed_deps, deps =3D find_deps(exe, search_path, analyzed_d= eps) + deps =3D set(deps) deps.remove(exe) =20 # copy all dlls to the DLLDIR for dep in deps: dllfile =3D 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) =20 --=20 2.45.2