OLD | NEW |
---|---|
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 = [ | |
24 "mojo/public/cpp/application", | |
jamesr
2015/05/22 21:25:02
Removing these files from the copy of the SDK in c
| |
25 "mojo/public/interfaces/application", | |
26 ] | |
27 | |
23 # Individual files to preserve within the target repository during roll. These | 28 # Individual files to preserve within the target repository during roll. These |
24 # are relative to |sdk_prefix_in_chromium| but are not maintained in the mojo | 29 # are relative to |sdk_prefix_in_chromium| but are not maintained in the mojo |
25 # repository. | 30 # repository. |
26 preserved_chromium_files = [ | 31 preserved_chromium_files = [ |
27 "mojo/edk/DEPS", | 32 "mojo/edk/DEPS", |
28 "mojo/public/DEPS", | 33 "mojo/public/DEPS", |
29 "mojo/public/platform/nacl/DEPS", | 34 "mojo/public/platform/nacl/DEPS", |
30 "nacl_bindings/DEPS", | 35 "nacl_bindings/DEPS", |
31 ] | 36 ] |
32 | 37 |
(...skipping 12 matching lines...) Expand all Loading... | |
45 print "removing directory %s" % dest_dir | 50 print "removing directory %s" % dest_dir |
46 system(["git", "rm", "-r", dest_dir], cwd=chromium_dir) | 51 system(["git", "rm", "-r", dest_dir], cwd=chromium_dir) |
47 print "cloning directory %s into %s" % (input_dir, dest_dir) | 52 print "cloning directory %s into %s" % (input_dir, dest_dir) |
48 files = system(["git", "ls-files", input_dir], cwd=source_dir) | 53 files = system(["git", "ls-files", input_dir], cwd=source_dir) |
49 for f in files.splitlines(): | 54 for f in files.splitlines(): |
50 # Don't copy presubmit files over since the code is read-only on the | 55 # Don't copy presubmit files over since the code is read-only on the |
51 # chromium side. | 56 # chromium side. |
52 if os.path.basename(f) == "PRESUBMIT.py": | 57 if os.path.basename(f) == "PRESUBMIT.py": |
53 continue | 58 continue |
54 | 59 |
60 exclude = False | |
61 for excluded in sdk_dirs_to_not_clone: | |
62 if f.startswith(excluded): | |
63 exclude = True | |
64 break | |
65 if exclude: | |
66 continue | |
67 | |
55 # Clone |f| into Chromium under |dest_dir| at its location relative to | 68 # Clone |f| into Chromium under |dest_dir| at its location relative to |
56 # |input_dir|. | 69 # |input_dir|. |
57 f_relpath = os.path.relpath(f, input_dir) | 70 f_relpath = os.path.relpath(f, input_dir) |
58 dest_path = os.path.join(chromium_dir, dest_dir, f_relpath) | 71 dest_path = os.path.join(chromium_dir, dest_dir, f_relpath) |
59 system(["mkdir", "-p", os.path.dirname(dest_path)]) | 72 system(["mkdir", "-p", os.path.dirname(dest_path)]) |
60 system(["cp", os.path.join(source_dir, f), dest_path]) | 73 system(["cp", os.path.join(source_dir, f), dest_path]) |
61 os.chdir(chromium_dir) | 74 os.chdir(chromium_dir) |
62 system(["git", "add", dest_dir], cwd=chromium_dir) | 75 system(["git", "add", dest_dir], cwd=chromium_dir) |
63 | 76 |
64 mojo_public_dest_dir = os.path.join(sdk_prefix_in_chromium, "mojo/public") | 77 mojo_public_dest_dir = os.path.join(sdk_prefix_in_chromium, "mojo/public") |
65 version_filename = os.path.join(mojo_public_dest_dir, "VERSION") | 78 version_filename = os.path.join(mojo_public_dest_dir, "VERSION") |
66 with open(version_filename, "w") as version_file: | 79 with open(version_filename, "w") as version_file: |
67 version_file.write(src_commit) | 80 version_file.write(src_commit) |
68 system(["git", "add", version_filename], cwd=chromium_dir) | 81 system(["git", "add", version_filename], cwd=chromium_dir) |
69 | 82 |
70 # Reset preserved files that were blown away. | 83 # Reset preserved files that were blown away. |
71 for rel_path in preserved_chromium_files: | 84 for rel_path in preserved_chromium_files: |
72 preserved_path = os.path.join(sdk_prefix_in_chromium, rel_path) | 85 preserved_path = os.path.join(sdk_prefix_in_chromium, rel_path) |
73 system(["git", "reset", "--", preserved_path]) | 86 system(["git", "reset", "--", preserved_path]) |
74 system(["git", "checkout", preserved_path]) | 87 system(["git", "checkout", preserved_path]) |
75 | 88 |
76 commit("Update mojo sdk to rev " + src_commit, cwd=chromium_dir) | 89 commit("Update mojo sdk to rev " + src_commit, cwd=chromium_dir) |
77 | 90 |
78 if len(sys.argv) != 2: | 91 if len(sys.argv) != 2: |
79 print "usage: rev_sdk.py <mojo source dir>" | 92 print "usage: rev_sdk.py <mojo source dir>" |
80 sys.exit(1) | 93 sys.exit(1) |
81 | 94 |
82 rev(sys.argv[1], chromium_root_dir) | 95 rev(sys.argv[1], chromium_root_dir) |
OLD | NEW |