Chromium Code Reviews| 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 import argparse | 6 import argparse |
| 7 import json | 7 import json |
| 8 import os | 8 import os |
| 9 import subprocess | 9 import subprocess |
| 10 import sys | 10 import sys |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 # These directories are temporarily cloned in order to support the network | 81 # These directories are temporarily cloned in order to support the network |
| 82 # bootstrap library until we get that sorted out. | 82 # bootstrap library until we get that sorted out. |
| 83 net_dirs = [ | 83 net_dirs = [ |
| 84 "crypto", | 84 "crypto", |
| 85 "net", | 85 "net", |
| 86 "mojo/services/network"] | 86 "mojo/services/network"] |
| 87 | 87 |
| 88 files_to_copy = ["sandbox/sandbox_export.h", | 88 files_to_copy = ["sandbox/sandbox_export.h", |
| 89 ".clang-format"] | 89 ".clang-format"] |
| 90 | 90 |
| 91 # The contents of these files before the roll will be preserved after the roll, | |
| 92 # even though they live in directories rolled in from Chromium. | |
| 93 files_not_to_roll = [ "build/config/mojo.gni" ] | |
| 94 | |
| 91 dirs = dirs_to_snapshot + net_dirs | 95 dirs = dirs_to_snapshot + net_dirs |
| 92 | 96 |
| 93 def chromium_rev_number(src_commit): | 97 def chromium_rev_number(src_commit): |
| 94 base_url = "https://cr-rev.appspot.com/_ah/api/crrev/v1/commit/" | 98 base_url = "https://cr-rev.appspot.com/_ah/api/crrev/v1/commit/" |
| 95 commit_info = json.load(urllib2.urlopen(base_url + src_commit)) | 99 commit_info = json.load(urllib2.urlopen(base_url + src_commit)) |
| 96 return commit_info["numberings"][0]["number"] | 100 return commit_info["numberings"][0]["number"] |
| 97 | 101 |
| 98 def rev(source_dir): | 102 def rev(source_dir): |
| 99 for d in dirs: | 103 for d in dirs: |
| 100 print "removing directory %s" % d | 104 print "removing directory %s" % d |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 116 system(["git", "add", "."], cwd=mojo_root_dir) | 120 system(["git", "add", "."], cwd=mojo_root_dir) |
| 117 src_commit = system(["git", "rev-parse", "HEAD"], cwd=source_dir).strip() | 121 src_commit = system(["git", "rev-parse", "HEAD"], cwd=source_dir).strip() |
| 118 src_rev = chromium_rev_number(src_commit) | 122 src_rev = chromium_rev_number(src_commit) |
| 119 commit("Update from https://crrev.com/" + src_rev, cwd=mojo_root_dir) | 123 commit("Update from https://crrev.com/" + src_rev, cwd=mojo_root_dir) |
| 120 | 124 |
| 121 def main(): | 125 def main(): |
| 122 parser = argparse.ArgumentParser(description="Update the mojo repo's " + | 126 parser = argparse.ArgumentParser(description="Update the mojo repo's " + |
| 123 "snapshot of things imported from chromium.") | 127 "snapshot of things imported from chromium.") |
| 124 parser.add_argument("chromium_dir", help="chromium source dir") | 128 parser.add_argument("chromium_dir", help="chromium source dir") |
| 125 args = parser.parse_args() | 129 args = parser.parse_args() |
| 130 pre_roll_commit = system( | |
| 131 ["git", "rev-parse", "HEAD"], cwd=mojo_root_dir).strip() | |
| 132 | |
| 126 rev(args.chromium_dir) | 133 rev(args.chromium_dir) |
| 127 patch.patch() | 134 patch.patch() |
| 135 | |
| 136 print "Restoring files whose contents don't track Chromium" | |
| 137 for f in files_not_to_roll: | |
| 138 system(["git", "checkout", pre_roll_commit, "--", f], cwd=mojo_root_dir) | |
| 139 commit("Restored pre-roll versions of files that don't get rolled") | |
|
jamesr
2015/02/02 21:26:56
commit after the loop (you don't want to commit fo
blundell
2015/02/03 08:29:48
Done.
| |
| 128 return 0 | 140 return 0 |
| 129 | 141 |
| 130 if __name__ == "__main__": | 142 if __name__ == "__main__": |
| 131 sys.exit(main()) | 143 sys.exit(main()) |
| OLD | NEW |