Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(701)

Side by Side Diff: mojo/tools/rev_sdk.py

Issue 1157843002: Update mojo sdk to rev 1dc8a9a5db73d3718d99917fadf31f5fb2ebad4f (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/services/network/http_server_apptest.cc ('k') | net/proxy/proxy_resolver_mojo_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Tool to roll Mojo into Chromium. See: 6 """Tool to roll Mojo into Chromium. See:
7 https://github.com/domokit/mojo/wiki/Rolling-code-between-chromium-and-mojo#mojo ---chromium-updates-sdk--edk 7 https://github.com/domokit/mojo/wiki/Rolling-code-between-chromium-and-mojo#mojo ---chromium-updates-sdk--edk
8 """ 8 """
9 9
10 import os 10 import os
11 import sys 11 import sys
12 from utils import commit 12 from utils import commit
13 from utils import chromium_root_dir 13 from utils import chromium_root_dir
14 from utils import system 14 from utils import system
15 15
16 sdk_prefix_in_chromium = "third_party/mojo/src" 16 sdk_prefix_in_chromium = "third_party/mojo/src"
17 sdk_dirs_to_clone = [ 17 sdk_dirs_to_clone = [
18 "mojo/edk", 18 "mojo/edk",
19 "mojo/public", 19 "mojo/public",
20 "nacl_bindings", 20 "nacl_bindings",
21 ] 21 ]
22 22
23 sdk_dirs_to_not_clone = [ 23 sdk_dirs_to_not_clone = [
24 "mojo/public/cpp/application", 24 "mojo/public/cpp/application",
25 "mojo/public/interfaces/application", 25 "mojo/public/interfaces/application",
26 "third_party/mojo/src/mojo/public/java/application", 26 "mojo/public/java/application",
27 ] 27 ]
28 28
29 # Individual files to preserve within the target repository during roll. These 29 # Individual files to preserve within the target repository during roll. These
30 # are relative to |sdk_prefix_in_chromium| but are not maintained in the mojo 30 # are relative to |sdk_prefix_in_chromium| but are not maintained in the mojo
31 # repository. 31 # repository.
32 preserved_chromium_files = [ 32 preserved_chromium_files = [
33 "mojo/edk/DEPS", 33 "mojo/edk/DEPS",
34 "mojo/public/DEPS", 34 "mojo/public/DEPS",
35 "mojo/public/platform/nacl/DEPS", 35 "mojo/public/platform/nacl/DEPS",
36 "nacl_bindings/DEPS", 36 "nacl_bindings/DEPS",
37 ] 37 ]
38 38
39 # A dictionary mapping dirs to clone to their destination locations in Chromium. 39 # A dictionary mapping dirs to clone to their destination locations in Chromium.
40 dirs_to_clone = {} 40 dirs_to_clone = {}
41 41
42 for sdk_dir in sdk_dirs_to_clone: 42 for sdk_dir in sdk_dirs_to_clone:
43 sdk_dir_in_chromium = os.path.join(sdk_prefix_in_chromium, sdk_dir) 43 sdk_dir_in_chromium = os.path.join(sdk_prefix_in_chromium, sdk_dir)
44 dirs_to_clone[sdk_dir] = sdk_dir_in_chromium 44 dirs_to_clone[sdk_dir] = sdk_dir_in_chromium
45 45
46 def rev(source_dir, chromium_dir): 46 def rev(source_dir, chromium_dir, mojo_revision):
47 src_commit = system(["git", "show-ref", "HEAD", "-s"], cwd=source_dir).strip() 47 src_commit = system(["git", "rev-parse", mojo_revision],
48 cwd=source_dir).strip()
48 49
49 for input_dir, dest_dir in dirs_to_clone.iteritems(): 50 for input_dir, dest_dir in dirs_to_clone.iteritems():
50 if os.path.exists(os.path.join(chromium_dir, dest_dir)): 51 if os.path.exists(os.path.join(chromium_dir, dest_dir)):
51 print "removing directory %s" % dest_dir 52 print "removing directory %s" % dest_dir
52 system(["git", "rm", "-r", dest_dir], cwd=chromium_dir) 53 system(["git", "rm", "-r", dest_dir], cwd=chromium_dir)
53 print "cloning directory %s into %s" % (input_dir, dest_dir) 54 print "cloning directory %s into %s" % (input_dir, dest_dir)
54 files = system(["git", "ls-files", input_dir], cwd=source_dir) 55 files = system(["git", "ls-files", input_dir], cwd=source_dir)
55 for f in files.splitlines(): 56 for f in files.splitlines():
56 # Don't copy presubmit files over since the code is read-only on the 57 # Don't copy presubmit files over since the code is read-only on the
57 # chromium side. 58 # chromium side.
(...skipping 24 matching lines...) Expand all
82 system(["git", "add", version_filename], cwd=chromium_dir) 83 system(["git", "add", version_filename], cwd=chromium_dir)
83 84
84 # Reset preserved files that were blown away. 85 # Reset preserved files that were blown away.
85 for rel_path in preserved_chromium_files: 86 for rel_path in preserved_chromium_files:
86 preserved_path = os.path.join(sdk_prefix_in_chromium, rel_path) 87 preserved_path = os.path.join(sdk_prefix_in_chromium, rel_path)
87 system(["git", "reset", "--", preserved_path]) 88 system(["git", "reset", "--", preserved_path])
88 system(["git", "checkout", preserved_path]) 89 system(["git", "checkout", preserved_path])
89 90
90 commit("Update mojo sdk to rev " + src_commit, cwd=chromium_dir) 91 commit("Update mojo sdk to rev " + src_commit, cwd=chromium_dir)
91 92
92 if len(sys.argv) != 2: 93 if len(sys.argv) < 2:
93 print "usage: rev_sdk.py <mojo source dir>" 94 print "usage: rev_sdk.py <mojo source dir> [<mojo revision>]"
94 sys.exit(1) 95 sys.exit(1)
95 96
96 rev(sys.argv[1], chromium_root_dir) 97 # Allow override of the roll revision.
98 if len(sys.argv) == 3:
99 mojo_revision = sys.argv[2]
100 else:
101 mojo_revision = 'origin/HEAD'
102
103 rev(sys.argv[1], chromium_root_dir, mojo_revision)
104
OLDNEW
« no previous file with comments | « mojo/services/network/http_server_apptest.cc ('k') | net/proxy/proxy_resolver_mojo_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698