[gimp] build: do not copy a binary dependency when it already exists.



commit 179334b618028d87b278de6bb0f7a23d3361fd7b
Author: Jehan <jehan girinstud io>
Date:   Mon Jun 28 15:07:47 2021 +0200

    build: do not copy a binary dependency when it already exists.
    
    The dll_link script would overwrite the same dependencies over and over,
    for instance when needed for several binaries, but worse when available
    in several source directories. In our case, we look up 2 source
    directories: our install prefix first, then the prefix for MSYS2
    pre-built packages. So it turns out we would be overriding any
    custom-built package also installed through MSYS2 (such as our patched
    GLib, see my previous commits).
    
    As a side effect, it should also make the packaging step faster as we
    don't re-copy unecessarily the same DLLs over and over again. The first
    one to go in stays in.

 build/windows/gitlab-ci/dll_link.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/build/windows/gitlab-ci/dll_link.py b/build/windows/gitlab-ci/dll_link.py
index 61528e7ed9..4c1330ccdc 100755
--- a/build/windows/gitlab-ci/dll_link.py
+++ b/build/windows/gitlab-ci/dll_link.py
@@ -35,6 +35,7 @@ bindir = 'bin'
 
 # Main function
 def main(binary, srcdir, destdir, debug):
+  sys.stdout.write("{} (INFO): searching for dependencies of {} in {}\n".format(os.path.basename(__file__), 
binary, srcdir))
   find_dependencies(binary, srcdir)
   if args.debug:
     print("Running in debug mode (no DLL moved)")
@@ -105,7 +106,9 @@ def copy_dlls(dll_list, srcdir, destdir):
   for dll in dll_list:
     full_file_name = os.path.join(srcdir, bindir, dll)
     if os.path.isfile(full_file_name):
-      shutil.copy(full_file_name, destbin)
+      if not os.path.exists(os.path.join(destbin, dll)):
+        sys.stdout.write("{} (INFO): copying {} to {}\n".format(os.path.basename(__file__), full_file_name, 
destbin))
+        shutil.copy(full_file_name, destbin)
     else:
       sys.stderr.write("Missing DLL: {}\n".format(full_file_name))
       sys.exit(os.EX_DATAERR)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]