aboutsummaryrefslogtreecommitdiff
path: root/update.py
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2016-10-19 08:18:32 -0700
committerJohn Reck <jreck@google.com>2016-10-20 11:17:18 -0700
commitee838d1c4002134ff5af32da272140586c4d31de (patch)
treeb6ffda675a47b15a69daf9da1ebf7108f48a5836 /update.py
parent7f53de28ece9f6b936535ec4671bfcb516a3a1e4 (diff)
downloadchromium-trace-ee838d1c4002134ff5af32da272140586c4d31de.tar.gz
Update catapult and how we update catapult
Test: manual, ran systrace.py Change-Id: Id86c732e5de832890429e0bfa5255d09db9841a8
Diffstat (limited to 'update.py')
-rwxr-xr-xupdate.py22
1 files changed, 15 insertions, 7 deletions
diff --git a/update.py b/update.py
index 7d0df075..9e53f9e6 100755
--- a/update.py
+++ b/update.py
@@ -3,9 +3,11 @@
import codecs, httplib, json, optparse, os, urllib, shutil, subprocess, sys
upstream_git = 'https://github.com/catapult-project/catapult.git'
+PACKAGE_DIRS = ['common', 'dependency_manager', 'devil', 'systrace']
script_dir = os.path.dirname(os.path.abspath(sys.argv[0]))
-catapult_dir = os.path.join(script_dir, 'catapult')
+catapult_src_dir = os.path.join(script_dir, 'catapult-upstream')
+catapult_dst_dir = os.path.join(script_dir, 'catapult')
parser = optparse.OptionParser()
parser.add_option('--local', dest='local_dir', metavar='DIR',
@@ -17,22 +19,22 @@ options, args = parser.parse_args()
# Update the source if needed.
if options.local_dir is None:
# Remove the old source tree.
- shutil.rmtree(catapult_dir, True)
+ shutil.rmtree(catapult_src_dir, True)
# Pull the latest source from the upstream git.
- git_args = ['git', 'clone', upstream_git, catapult_dir]
+ git_args = ['git', 'clone', upstream_git, catapult_src_dir]
p = subprocess.Popen(git_args, stdout=subprocess.PIPE, cwd=script_dir)
p.communicate()
if p.wait() != 0:
print 'Failed to checkout source from upstream git.'
sys.exit(1)
- catapult_git_dir = os.path.join(catapult_dir, '.git')
+ catapult_git_dir = os.path.join(catapult_src_dir, '.git')
# Update the UPSTREAM_REVISION file
git_args = ['git', 'rev-parse', 'HEAD']
p = subprocess.Popen(git_args,
stdout=subprocess.PIPE,
- cwd=catapult_dir,
+ cwd=catapult_src_dir,
env={"GIT_DIR":catapult_git_dir})
out, err = p.communicate()
if p.wait() != 0:
@@ -45,11 +47,17 @@ if options.local_dir is None:
with open('UPSTREAM_REVISION', 'wt') as f:
f.write(rev + '\n')
else:
- catapult_dir = options.local_dir
+ catapult_src_dir = options.local_dir
# Update systrace_trace_viewer.html
-systrace_dir = os.path.join(catapult_dir, 'systrace', 'systrace')
+systrace_dir = os.path.join(catapult_src_dir, 'systrace', 'systrace')
sys.path.append(systrace_dir)
import update_systrace_trace_viewer
update_systrace_trace_viewer.update(no_auto_update=True, no_min=options.no_min)
+
+# Package the result
+shutil.rmtree(catapult_dst_dir)
+for d in PACKAGE_DIRS:
+ shutil.copytree(os.path.join(catapult_src_dir, d),
+ os.path.join(catapult_dst_dir, d))