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

Side by Side Diff: scripts/slave/recipe_modules/goma/resources/ensure_goma.py

Issue 1814713002: ensure_goma for goma canary (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Created 4 years, 9 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
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2016 The Chromium Authors. All rights reserved. 2 # Copyright 2016 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 os 7 import os
8 import shutil 8 import shutil
9 import subprocess 9 import subprocess
10 import sys 10 import sys
(...skipping 12 matching lines...) Expand all
23 if sys.platform.startswith('linux'): 23 if sys.platform.startswith('linux'):
24 return 'linux' 24 return 'linux'
25 25
26 return None 26 return None
27 27
28 28
29 def main(argv): 29 def main(argv):
30 parser = argparse.ArgumentParser() 30 parser = argparse.ArgumentParser()
31 parser.add_argument('--target-dir', required=True) 31 parser.add_argument('--target-dir', required=True)
32 parser.add_argument('--download-from-google-storage-path', required=True) 32 parser.add_argument('--download-from-google-storage-path', required=True)
33 parser.add_argument('--canary', action='store_true')
33 34
34 args = parser.parse_args() 35 args = parser.parse_args()
35 36
36 config = CONFIG[get_platform()] 37 config = CONFIG[get_platform()]
37 38
38 client_dir = args.target_dir 39 client_dir = args.target_dir
39 if not os.path.exists(client_dir): 40 if not os.path.exists(client_dir):
40 os.makedirs(client_dir) 41 os.makedirs(client_dir)
41 42
42 current_repo = subprocess.check_output( 43 current_repo = subprocess.check_output(
43 ['git', 'ls-remote', '--get-url'], cwd=client_dir).strip() 44 ['git', 'ls-remote', '--get-url'], cwd=client_dir).strip()
44 if current_repo != config['repo']: 45 if current_repo != config['repo']:
45 shutil.rmtree(client_dir) 46 shutil.rmtree(client_dir)
46 subprocess.check_call(['git', 'clone', config['repo'], client_dir]) 47 subprocess.check_call(['git', 'clone', config['repo'], client_dir])
47 48
48 subprocess.check_call(['git', 'fetch'], cwd=client_dir) 49 subprocess.check_call(['git', 'fetch'], cwd=client_dir)
50 rev = config['revision']
51 if arg.canary:
scottmg 2016/03/18 01:09:09 Here.
52 rev = 'refs/heads/master'
49 subprocess.check_call( 53 subprocess.check_call(
50 ['git', 'reset', '--hard', config['revision']], cwd=client_dir) 54 ['git', 'reset', '--hard', rev], cwd=client_dir)
51 55
52 subprocess.check_call([sys.executable, 56 subprocess.check_call([sys.executable,
53 args.download_from_google_storage_path, 57 args.download_from_google_storage_path,
54 '--directory', 58 '--directory',
55 '--recursive', 59 '--recursive',
56 '--bucket', 'chrome-goma', 60 '--bucket', 'chrome-goma',
57 client_dir]) 61 client_dir])
58 62
59 subprocess.check_call( 63 subprocess.check_call(
60 [sys.executable, os.path.join(client_dir, 'fix_file_modes.py')]) 64 [sys.executable, os.path.join(client_dir, 'fix_file_modes.py')])
61 65
62 return 0 66 return 0
63 67
64 68
65 if __name__ == '__main__': 69 if __name__ == '__main__':
66 sys.exit(main(sys.argv[1:])) 70 sys.exit(main(sys.argv[1:]))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698