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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2019-10-09 15:41:34 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-10-09 16:09:53 +0300
commit7e7b2051371d8efae33b222ff667eed862eee3af (patch)
treee1d94656845b3530238ab8fe4ca66bbbe601a0d4 /build_files/utils
parent6c9178b183f5267e07a6c55497b6d496e468a709 (diff)
Build: prepare "make update" to work for new release cycle branching
Checking out release branches in submodules, and printing some more informative messages when that fails.
Diffstat (limited to 'build_files/utils')
-rwxr-xr-xbuild_files/utils/make_test.py3
-rwxr-xr-xbuild_files/utils/make_update.py78
-rwxr-xr-xbuild_files/utils/make_utils.py6
3 files changed, 65 insertions, 22 deletions
diff --git a/build_files/utils/make_test.py b/build_files/utils/make_test.py
index a8a6afc43cc..309ab36ecdd 100755
--- a/build_files/utils/make_test.py
+++ b/build_files/utils/make_test.py
@@ -39,7 +39,8 @@ if make_utils.command_missing(git_command):
sys.exit(1)
# Test if we are building a specific release version.
-release_version = make_utils.git_branch_release_version(git_command)
+branch = make_utils.git_branch(git_command)
+release_version = make_utils.git_branch_release_version(branch)
lib_tests_dirpath = os.path.join('..', 'lib', "tests")
if not os.path.exists(lib_tests_dirpath):
diff --git a/build_files/utils/make_update.py b/build_files/utils/make_update.py
index bf2e6e9fab8..af35846f6fc 100755
--- a/build_files/utils/make_update.py
+++ b/build_files/utils/make_update.py
@@ -104,9 +104,8 @@ def svn_update(args, release_version):
call(svn_non_interactive + ["switch", svn_url + dirname, dirpath])
call(svn_non_interactive + ["update", dirpath])
-
-# Update blender repository.
-def blender_update_skip(args):
+# Test if git repo can be updated.
+def git_update_skip(args):
if make_utils.command_missing(args.git_command):
sys.stderr.write("git not found, can't update code\n")
sys.exit(1)
@@ -131,44 +130,85 @@ def blender_update_skip(args):
if len(remote) == 0:
return "no remote branch to pull from"
- return None
+ return ""
+# Update blender repository.
def blender_update(args):
print_stage("Updating Blender Git Repository")
call([args.git_command, "pull", "--rebase"])
# Update submodules.
-def submodules_update(args, release_version):
+def submodules_update(args, release_version, branch):
print_stage("Updating Submodules")
if make_utils.command_missing(args.git_command):
sys.stderr.write("git not found, can't update code\n")
sys.exit(1)
- call([args.git_command, "submodule", "update", "--init", "--recursive"])
+ # Update submodules to latest master or appropriate release branch.
if not release_version:
- # Update submodules to latest master if not building a specific release.
- # In that case submodules are set to a specific revision, which is checked
- # out by running "git submodule update".
- call([args.git_command, "submodule", "foreach", "git", "checkout", "master"])
- call([args.git_command, "submodule", "foreach", "git", "pull", "--rebase", "origin", "master"])
+ branch = "master"
+
+ submodules = [
+ ("release/scripts/addons", branch),
+ ("release/scripts/addons_contrib", branch),
+ ("release/datafiles/locale", branch),
+ ("source/tools", "master"),
+ ]
+
+ # Initialize submodules only if needed.
+ for submodule_path, submodule_branch 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:
+ cwd = os.getcwd()
+ try:
+ os.chdir(submodule_path)
+ msg = git_update_skip(args)
+ if msg:
+ skip_msg += submodule_path + " skipped: " + msg + "\n"
+ else:
+ if make_utils.git_branch(args.git_command) != branch:
+ call([args.git_command, "checkout", branch])
+ call([args.git_command, "pull", "--rebase", "origin", branch])
+ finally:
+ os.chdir(cwd)
+
+ return skip_msg
if __name__ == "__main__":
args = parse_arguments()
- blender_skipped = None
+ blender_skip_msg = ""
+ submodules_skip_msg = ""
# Test if we are building a specific release version.
- release_version = make_utils.git_branch_release_version(args.git_command)
+ branch = make_utils.git_branch(args.git_command)
+ release_version = make_utils.git_branch_release_version(branch)
if not args.no_libraries:
svn_update(args, release_version)
if not args.no_blender:
- blender_skipped = blender_update_skip(args)
- if not blender_skipped:
+ blender_skip_msg = git_update_skip(args)
+ if blender_skip_msg:
+ blender_skip_msg = "Blender repository skipped: " + blender_skip_msg + "\n"
+ else:
blender_update(args)
if not args.no_submodules:
- submodules_update(args, release_version)
-
- if blender_skipped:
- print_stage("Blender repository skipped: " + blender_skipped)
+ submodules_skip_msg = submodules_update(args, release_version, branch)
+
+ # Report any skipped repositories at the end, so it's not as easy to miss.
+ skip_msg = blender_skip_msg + submodules_skip_msg
+ if skip_msg:
+ print_stage(skip_msg.strip())
+
+ # For failed submodule update we throw an error, since not having correct
+ # submodules can make Blender throw errors.
+ # For Blender itself we don't and consider "make update" to be a command
+ # you can use while working on uncommitted code.
+ if submodules_skip_msg:
+ sys.exit(1)
diff --git a/build_files/utils/make_utils.py b/build_files/utils/make_utils.py
index 5fedd792149..7b21bc607a4 100755
--- a/build_files/utils/make_utils.py
+++ b/build_files/utils/make_utils.py
@@ -35,7 +35,7 @@ def check_output(cmd, exit_on_error=True):
return output.strip()
-def git_branch_release_version(git_command):
+def git_branch(git_command):
# Test if we are building a specific release version.
try:
branch = subprocess.check_output([git_command, "rev-parse", "--abbrev-ref", "HEAD"])
@@ -43,7 +43,9 @@ def git_branch_release_version(git_command):
sys.stderr.write("Failed to get Blender git branch\n")
sys.exit(1)
- branch = branch.strip().decode('utf8')
+ return branch.strip().decode('utf8')
+
+def git_branch_release_version(branch):
release_version = re.search("^blender-v(.*)-release$", branch)
if release_version:
release_version = release_version.group(1)