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

Side by Side Diff: tools/upload_sdk.py

Issue 8821001: set ACL of SDK public-read (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 9 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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/python 1 #!/usr/bin/python
2 2
3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 # This zips the SDK and uploads it to Google Storage when run on a buildbot. 7 # This zips the SDK and uploads it to Google Storage when run on a buildbot.
8 8
9 import os 9 import os
10 import subprocess 10 import subprocess
11 import sys 11 import sys
12 import utils 12 import utils
13 13
14 14
15 ACL = '~/slave_archive_acl'
16 GSUTIL = '/b/build/scripts/slave/gsutil' 15 GSUTIL = '/b/build/scripts/slave/gsutil'
17 GS_SITE = 'gs://' 16 GS_SITE = 'gs://'
18 GS_DIR = 'dartium-archive' 17 GS_DIR = 'dartium-archive'
19 LATEST = 'latest' 18 LATEST = 'latest'
20 SDK = 'sdk' 19 SDK = 'sdk'
21 20
22 def ExecuteCommand(cmd): 21 def ExecuteCommand(cmd):
23 """Execute a command in a subprocess. 22 """Execute a command in a subprocess.
24 """ 23 """
25 print 'Executing: ' + ' '.join(cmd) 24 print 'Executing: ' + ' '.join(cmd)
26 pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) 25 pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
27 output = pipe.communicate() 26 output = pipe.communicate()
28 if pipe.returncode != 0: 27 if pipe.returncode != 0:
29 print 'Execution failed: ' + str(output) 28 print 'Execution failed: ' + str(output)
30 return (pipe.returncode, output) 29 return (pipe.returncode, output)
31 30
32 31
33 def UploadArchive(source, target): 32 def UploadArchive(source, target):
34 """Upload an archive zip file to Google storage. 33 """Upload an archive zip file to Google storage.
35 """ 34 """
36 # Upload file. 35 # Upload file.
37 cmd = [GSUTIL, 'cp', source, target] 36 cmd = [GSUTIL, 'cp', source, target]
38 (status, output) = ExecuteCommand(cmd) 37 (status, output) = ExecuteCommand(cmd)
39 if status != 0: 38 if status != 0:
40 return status 39 return status
41 print 'Uploaded: ' + output[0] 40 print 'Uploaded: ' + output[0]
42 41
43 # Set ACL. 42 cmd = [GSUTIL, 'setacl', 'public-read', target]
44 if ACL is not None: 43 (status, output) = ExecuteCommand(cmd)
45 cmd = [GSUTIL, 'setacl', ACL, target]
46 (status, output) = ExecuteCommand(cmd)
47 return status 44 return status
48 45
49 def GetSVNRevision(): 46 def GetSVNRevision():
50 p = subprocess.Popen(['svn', 'info'], stdout = subprocess.PIPE, 47 p = subprocess.Popen(['svn', 'info'], stdout = subprocess.PIPE,
51 stderr = subprocess.STDOUT, close_fds=True) 48 stderr = subprocess.STDOUT, close_fds=True)
52 output, not_used = p.communicate() 49 output, not_used = p.communicate()
53 for line in output.split('\n'): 50 for line in output.split('\n'):
54 if 'Revision' in line: 51 if 'Revision' in line:
55 return (line.strip().split())[1] 52 return (line.strip().split())[1]
56 return None 53 return None
(...skipping 15 matching lines...) Expand all
72 ExecuteCommand(['zip', '-yr', sdk_file, '.']) 69 ExecuteCommand(['zip', '-yr', sdk_file, '.'])
73 UploadArchive(sdk_file, GS_SITE + os.path.join(GS_DIR, SDK, sdk_name)) 70 UploadArchive(sdk_file, GS_SITE + os.path.join(GS_DIR, SDK, sdk_name))
74 latest_name = 'dart-' + utils.GuessOS() + '-latest' + '.zip' 71 latest_name = 'dart-' + utils.GuessOS() + '-latest' + '.zip'
75 UploadArchive(sdk_file, GS_SITE + os.path.join(GS_DIR, SDK, latest_name)) 72 UploadArchive(sdk_file, GS_SITE + os.path.join(GS_DIR, SDK, latest_name))
76 73
77 74
78 if __name__ == '__main__': 75 if __name__ == '__main__':
79 sys.exit(main(sys.argv)) 76 sys.exit(main(sys.argv))
80 77
81 78
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698