Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <bastien@blender.org>2021-09-02 13:11:32 +0300
committerBastien Montagne <bastien@blender.org>2021-09-02 15:56:46 +0300
commit546314fc9669f88dd501b50be159fa0219813596 (patch)
tree1ca7e654b8dce2dd66793b16d79d08b9243a9345
parent799a2b07ad13b879d1148b8ffe8ccd8e7e421212 (diff)
Build utils: `make_update`: Add option to choose SVN branch.
Needed for studio sprite-fright frozen branch. Also do not overwrite branch for git sub-modules when it is defined, and fallback to `master` branch in case specified branch is not found in a specific sub-repository.
-rwxr-xr-xbuild_files/utils/make_update.py28
-rwxr-xr-xbuild_files/utils/make_utils.py4
2 files changed, 21 insertions, 11 deletions
diff --git a/build_files/utils/make_update.py b/build_files/utils/make_update.py
index 2b8c7af98fb..b901fa56f52 100755
--- a/build_files/utils/make_update.py
+++ b/build_files/utils/make_update.py
@@ -31,6 +31,7 @@ def parse_arguments():
parser.add_argument("--no-submodules", action="store_true")
parser.add_argument("--use-tests", action="store_true")
parser.add_argument("--svn-command", default="svn")
+ parser.add_argument("--svn-branch", default=None)
parser.add_argument("--git-command", default="git")
parser.add_argument("--use-centos-libraries", action="store_true")
return parser.parse_args()
@@ -46,7 +47,7 @@ def svn_update(args, release_version):
svn_non_interactive = [args.svn_command, '--non-interactive']
lib_dirpath = os.path.join(get_blender_git_root(), '..', 'lib')
- svn_url = make_utils.svn_libraries_base_url(release_version)
+ svn_url = make_utils.svn_libraries_base_url(release_version, args.svn_branch)
# Checkout precompiled libraries
if sys.platform == 'darwin':
@@ -170,26 +171,28 @@ def submodules_update(args, release_version, branch):
sys.stderr.write("git not found, can't update code\n")
sys.exit(1)
- # Update submodules to latest master or appropriate release branch.
- if not release_version:
- branch = "master"
+ # Update submodules to appropriate given branch,
+ # falling back to master if none is given and/or found in a sub-repository.
+ branch_fallback = "master"
+ if not branch:
+ branch = branch_fallback
submodules = [
- ("release/scripts/addons", branch),
- ("release/scripts/addons_contrib", branch),
- ("release/datafiles/locale", branch),
- ("source/tools", branch),
+ ("release/scripts/addons", branch, branch_fallback),
+ ("release/scripts/addons_contrib", branch, branch_fallback),
+ ("release/datafiles/locale", branch, branch_fallback),
+ ("source/tools", branch, branch_fallback),
]
# Initialize submodules only if needed.
- for submodule_path, submodule_branch in submodules:
+ for submodule_path, submodule_branch, submodule_branch_fallback in submodules:
if not os.path.exists(os.path.join(submodule_path, ".git")):
call([args.git_command, "submodule", "update", "--init", "--recursive"])
break
# Checkout appropriate branch and pull changes.
skip_msg = ""
- for submodule_path, submodule_branch in submodules:
+ for submodule_path, submodule_branch, submodule_branch_fallback in submodules:
cwd = os.getcwd()
try:
os.chdir(submodule_path)
@@ -201,6 +204,11 @@ def submodules_update(args, release_version, branch):
call([args.git_command, "fetch", "origin"])
call([args.git_command, "checkout", submodule_branch])
call([args.git_command, "pull", "--rebase", "origin", submodule_branch])
+ # If we cannot find the specified branch for this submodule, fallback to default one (aka master).
+ if make_utils.git_branch(args.git_command) != submodule_branch:
+ call([args.git_command, "fetch", "origin"])
+ call([args.git_command, "checkout", submodule_branch_fallback])
+ call([args.git_command, "pull", "--rebase", "origin", submodule_branch_fallback])
finally:
os.chdir(cwd)
diff --git a/build_files/utils/make_utils.py b/build_files/utils/make_utils.py
index 9f928bb524d..7cd23baad68 100755
--- a/build_files/utils/make_utils.py
+++ b/build_files/utils/make_utils.py
@@ -70,9 +70,11 @@ def git_branch_release_version(branch, tag):
return release_version
-def svn_libraries_base_url(release_version):
+def svn_libraries_base_url(release_version, branch):
if release_version:
svn_branch = "tags/blender-" + release_version + "-release"
+ elif branch:
+ svn_branch = "branches/" + branch
else:
svn_branch = "trunk"
return "https://svn.blender.org/svnroot/bf-blender/" + svn_branch + "/lib/"