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

Side by Side Diff: tools/upload_sdk.py

Issue 8803027: Upload SDK builds to gs://dartium-archive . This step will only (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 | « dart.gyp ('k') | 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
(Empty)
1 #!/usr/bin/python
2
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
5 # found in the LICENSE file.
6
7
Siggi Cherem (dart-lang) 2011/12/06 00:26:39 (nit) add top-level comment saying what this file
dgrove 2011/12/06 00:40:24 Done.
8 import os
9 import subprocess
10 import sys
11 import utils
12
13
14 GSUTIL = '/b/build/scripts/slave/gsutil'
15 GS_SITE = 'gs://'
16 GS_DIR = 'dartium-archive'
17 LATEST = 'latest'
18 SDK = 'sdk'
19
20 def ExecuteCommand(cmd):
21 """Execute a command in a subprocess.
22 """
23 print 'Executing: ' + ' '.join(cmd)
24 pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
25 output = pipe.communicate()
26 if pipe.returncode != 0:
27 print 'Execution failed: ' + str(output)
28 return (pipe.returncode, output)
29
30
31 def UploadArchive(source, target):
32 """Upload an archive zip file to Google storage.
33 """
34 # Upload file.
35 cmd = [GSUTIL, 'cp', source, target]
36 (status, output) = ExecuteCommand(cmd)
37 if status != 0:
38 return status
39 print 'Uploaded: ' + output[0]
40
41 def GetSVNRevision():
42 p = subprocess.Popen(['svn', 'info'], stdout = subprocess.PIPE,
43 stderr = subprocess.STDOUT, close_fds=True)
44 output, not_used = p.communicate()
45 for line in output.split('\n'):
46 print line
47 if 'Revision' in line:
48 return (line.strip().split())[1]
49 return None
50
51 def main(argv):
52 # TODO(dgrove) - deal with architectures that are not ia32.
53 if (not os.path.exists(argv[1])) or (not os.path.exists(GSUTIL)):
54 print GSUTIL
55 exit(0)
Siggi Cherem (dart-lang) 2011/12/06 00:26:39 return 1? - some usage message?
dgrove 2011/12/06 00:40:24 Done.
56 revision = GetSVNRevision()
57 if revision == None:
58 print "Unable to find SVN revision"
59 exit(0)
Siggi Cherem (dart-lang) 2011/12/06 00:26:39 return 1
dgrove 2011/12/06 00:40:24 Done.
60 os.chdir(argv[1])
61 sdk_name = 'dart-' + utils.GuessOS() + '-' + revision + '.zip'
62 sdk_file = '../' + sdk_name
63 ExecuteCommand(['zip', '-yr', sdk_file, '.'])
64 UploadArchive(sdk_file, GS_SITE + os.path.join(GS_DIR, SDK, sdk_name))
65 latest_name = 'dart-' + utils.GuessOS() + '-latest' + '.zip'
66 UploadArchive(sdk_file, GS_SITE + os.path.join(GS_DIR, SDK, latest_name))
67
68
69 if __name__ == '__main__':
70 sys.exit(main(sys.argv))
71
72
OLDNEW
« no previous file with comments | « dart.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698