summaryrefslogtreecommitdiffstats
path: root/tools/scripts/git_submodule.py
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@digia.com>2014-07-28 17:28:51 +0200
committerJocelyn Turcotte <jocelyn.turcotte@digia.com>2014-08-14 16:43:27 +0200
commitf987b713b9f4e363056bf5174a762acb5b77ed79 (patch)
tree2ab78e0cf37e6a1fac04d62add6452643a0303ee /tools/scripts/git_submodule.py
parenta6b81d7e7756c3aecd413277de0b95a3f391f95e (diff)
Update the scripts for the snapshot of 37
- The svn repo string would be something like: ...branches/2062/path_suffix and I want only the branch number in this case. Updated git_submodule.py to support that case and use regexp instead to keep thing a bit simpler. - .isolate are gyp files, moved the exception at the top - Changed some inclusions/exclusions - tools/ is now all excluded by default with exception instead of all included. We don't need most of it. Change-Id: I6d0666d9af7fc6a0f3c4fe866adf2744f13f7c35 Reviewed-by: Andras Becsi <andras.becsi@digia.com>
Diffstat (limited to 'tools/scripts/git_submodule.py')
-rw-r--r--tools/scripts/git_submodule.py45
1 files changed, 14 insertions, 31 deletions
diff --git a/tools/scripts/git_submodule.py b/tools/scripts/git_submodule.py
index 5376e877..a9002ffe 100644
--- a/tools/scripts/git_submodule.py
+++ b/tools/scripts/git_submodule.py
@@ -41,6 +41,7 @@
import glob
import os
+import re
import subprocess
import sys
import version_resolver as resolver
@@ -79,42 +80,24 @@ class DEPSParser:
if subdir.startswith('src'):
# Ignore the information about chromium since we get that from git.
continue
- shasum = ''
- if len(rev) == 40: # Length of a git shasum
- shasum = rev
+
submodule = Submodule(subdir, repo)
submodule.os = os
- submodule.shasum = shasum
+
if not submodule.matchesOS():
print '-- skipping ' + submodule.path + ' for this operating system. --'
continue
- if not submodule.shasum:
- # We need to parse the svn branch and revision number.
- ref = repo
- # Try to find out the branch.
- ref_path = repo.split('branches/')
- if len(ref_path) > 1:
- ref = ref_path[1]
- if 'trunk' in ref or 'svn' in ref:
- # Trunk is used, so we can use the remote master.
- ref = 'master'
- name_path = subdir.split('/')
- if len(name_path) > 1:
- # At this point some svn repository paths still include the repo name
- # after the actual branch so we have to strip it together with the leading /
- name = name_path[-1]
- if ref.endswith(name):
- branch = ref[:-(len(name) + 1)]
- ref = 'refs/branch-heads/' + branch
- if name in ref:
- # At this point the last partition in the path
- # is the branch name, so compose the git ref.
- branch = ref.split('/')[-1]
- ref = 'refs/branch-heads/' + branch
- if 'master' not in ref and 'refs/branch-heads' not in ref:
- # Finally compose the refs that did not mach previous rules.
- ref = 'refs/branch-heads/' + ref
- submodule.ref = ref
+
+ if len(rev) == 40: # Length of a git shasum
+ submodule.shasum = rev
+ else:
+ # Try to find out the git branch using the svn path.
+ branchMatch = re.search('/branches/((chromium/)?[^/]+)', repo)
+ trunkMatch = re.search('/(trunk|svn)/', repo)
+ if branchMatch:
+ submodule.ref = 'refs/branch-heads/' + branchMatch.group(1)
+ elif trunkMatch:
+ submodule.ref = 'refs/heads/master'
submodule.revision = int(rev)
submodules.append(submodule)
return submodules