[Bf-blender-cvs] [fe5cbd5eea4] master: make_update: support updating "lib" as a single repository

Campbell Barton noreply at git.blender.org
Mon Oct 31 03:09:05 CET 2022


Commit: fe5cbd5eea4ad56e889be1f6b18eb2ca96225754
Author: Campbell Barton
Date:   Mon Oct 31 12:54:38 2022 +1100
Branches: master
https://developer.blender.org/rBfe5cbd5eea4ad56e889be1f6b18eb2ca96225754

make_update: support updating "lib" as a single repository

With a full SVN checkout of "../lib", updating all paths is slower
than running an update on the whole repository at once.

Also collect paths and run the update in separate passes, this avoids
some duplicate checks such as checking the svn command exists.

===================================================================

M	build_files/utils/make_update.py

===================================================================

diff --git a/build_files/utils/make_update.py b/build_files/utils/make_update.py
index e7d28aeb75b..a0b61b18e60 100755
--- a/build_files/utils/make_update.py
+++ b/build_files/utils/make_update.py
@@ -104,37 +104,37 @@ def svn_update(args: argparse.Namespace, release_version: Optional[str]) -> None
             call(svn_non_interactive + ["checkout", svn_url_tests, lib_tests_dirpath])
 
     # Update precompiled libraries and tests
-    print_stage("Updating Precompiled Libraries and Tests")
-
-    if os.path.isdir(lib_dirpath):
-        for dirname in os.listdir(lib_dirpath):
-            dirpath = os.path.join(lib_dirpath, dirname)
-
-            if dirname == ".svn":
-                # Cleanup must be run from svn root directory if it exists.
-                if not make_utils.command_missing(args.svn_command):
-                    call(svn_non_interactive + ["cleanup", lib_dirpath])
-                continue
-            elif dirname.startswith("."):
-                # Temporary paths such as ".mypy_cache" will report a warning, skip hidden directories.
-                continue
-
-            svn_dirpath = os.path.join(dirpath, ".svn")
-            svn_root_dirpath = os.path.join(lib_dirpath, ".svn")
-
-            if (
-                    os.path.isdir(dirpath) and
-                    (os.path.exists(svn_dirpath) or os.path.exists(svn_root_dirpath))
-            ):
-                if make_utils.command_missing(args.svn_command):
-                    sys.stderr.write("svn not found, can't update libraries\n")
-                    sys.exit(1)
-
-                # Cleanup to continue with interrupted downloads.
-                if os.path.exists(svn_dirpath):
-                    call(svn_non_interactive + ["cleanup", dirpath])
+
+    if not os.path.isdir(lib_dirpath):
+        print("Library path: %r, not found, skipping" % lib_dirpath)
+    else:
+        paths_local_and_remote = []
+        if os.path.exists(os.path.join(lib_dirpath, ".svn")):
+            print_stage("Updating Precompiled Libraries and Tests (one repository)")
+            paths_local_and_remote.append((lib_dirpath, svn_url))
+        else:
+            print_stage("Updating Precompiled Libraries and Tests (multiple repositories)")
+            # Separate paths checked out.
+            for dirname in os.listdir(lib_dirpath):
+                if dirname.startswith("."):
+                    # Temporary paths such as ".mypy_cache" will report a warning, skip hidden directories.
+                    continue
+
+                dirpath = os.path.join(lib_dirpath, dirname)
+                if not (os.path.isdir(dirpath) and os.path.exists(os.path.join(dirpath, ".svn"))):
+                    continue
+
+                paths_local_and_remote.append((dirpath, svn_url + dirname))
+
+        if paths_local_and_remote:
+            if make_utils.command_missing(args.svn_command):
+                sys.stderr.write("svn not found, can't update libraries\n")
+                sys.exit(1)
+
+            for dirpath, svn_url_full in paths_local_and_remote:
+                call(svn_non_interactive + ["cleanup", dirpath])
                 # Switch to appropriate branch and update.
-                call(svn_non_interactive + ["switch", svn_url + dirname, dirpath], exit_on_error=False)
+                call(svn_non_interactive + ["switch", svn_url_full, dirpath], exit_on_error=False)
                 call(svn_non_interactive + ["update", dirpath])



More information about the Bf-blender-cvs mailing list