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

Side by Side Diff: tools/upload_sdk.py

Issue 10117031: Move 'revision' file creation from upload_sdk into create_sdk (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « tools/create_sdk.py ('k') | tools/utils.py » ('j') | 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 # Usage: upload_sdk.py path_to_sdk 9 # Usage: upload_sdk.py path_to_sdk
10 10
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 cmd = [GSUTIL, 'cp', source, target] 45 cmd = [GSUTIL, 'cp', source, target]
46 (status, output) = ExecuteCommand(cmd) 46 (status, output) = ExecuteCommand(cmd)
47 if status != 0: 47 if status != 0:
48 return status 48 return status
49 print 'Uploaded: ' + output[0] 49 print 'Uploaded: ' + output[0]
50 50
51 cmd = [GSUTIL, 'setacl', 'public-read', target] 51 cmd = [GSUTIL, 'setacl', 'public-read', target]
52 (status, output) = ExecuteCommand(cmd) 52 (status, output) = ExecuteCommand(cmd)
53 return status 53 return status
54 54
55 def GetSVNRevision():
56 p = subprocess.Popen(['svn', 'info'], stdout = subprocess.PIPE,
57 stderr = subprocess.STDOUT, shell=HAS_SHELL)
58 output, not_used = p.communicate()
59 for line in output.split('\n'):
60 if 'Revision' in line:
61 return (line.strip().split())[1]
62 return None
63
64 55
65 def Usage(progname): 56 def Usage(progname):
66 sys.stderr.write('Usage: %s path_to_sdk\n' % progname) 57 sys.stderr.write('Usage: %s path_to_sdk\n' % progname)
67 58
68 59
69 def main(argv): 60 def main(argv):
70 #allow local editor builds to deploy to a different bucket 61 #allow local editor builds to deploy to a different bucket
71 if os.environ.has_key('DART_LOCAL_BUILD'): 62 if os.environ.has_key('DART_LOCAL_BUILD'):
72 gsdir = os.environ['DART_LOCAL_BUILD'] 63 gsdir = os.environ['DART_LOCAL_BUILD']
73 else: 64 else:
74 gsdir = GS_DIR 65 gsdir = GS_DIR
75 66
76 if not os.path.exists(argv[1]): 67 if not os.path.exists(argv[1]):
77 sys.stderr.write('Path not found: %s\n' % argv[1]) 68 sys.stderr.write('Path not found: %s\n' % argv[1])
78 Usage(argv[0]) 69 Usage(argv[0])
79 return 1 70 return 1
80 if not os.path.exists(GSUTIL): 71 if not os.path.exists(GSUTIL):
81 #TODO: Determine where we are running, if we're running on a buildbot we 72 #TODO: Determine where we are running, if we're running on a buildbot we
82 #should fail with a message. 73 #should fail with a message.
83 #If we are not on a buildbot then fail silently. 74 #If we are not on a buildbot then fail silently.
84 exit(0) 75 exit(0)
85 revision = GetSVNRevision() 76 revision = utils.GetSVNRevision()
86 if revision is None: 77 if revision is None:
87 sys.stderr.write('Unable to find SVN revision.\n') 78 sys.stderr.write('Unable to find SVN revision.\n')
88 return 1 79 return 1
89 os.chdir(os.path.dirname(argv[1])) 80 os.chdir(os.path.dirname(argv[1]))
90 with open(os.path.join(os.path.basename(argv[1]), 'revision'), 'w') as f:
91 f.write(revision + '\n')
92 81
93 if (os.path.basename(os.path.dirname(argv[1])) == 82 if (os.path.basename(os.path.dirname(argv[1])) ==
94 utils.GetBuildConf('release', 'ia32')): 83 utils.GetBuildConf('release', 'ia32')):
95 sdk_suffix = '' 84 sdk_suffix = ''
96 else: 85 else:
97 sdk_suffix = '-debug' 86 sdk_suffix = '-debug'
98 # TODO(dgrove) - deal with architectures that are not ia32. 87 # TODO(dgrove) - deal with architectures that are not ia32.
99 sdk_file = 'dart-%s-%s%s.zip' % (utils.GuessOS(), revision, sdk_suffix) 88 sdk_file = 'dart-%s-%s%s.zip' % (utils.GuessOS(), revision, sdk_suffix)
100 if (os.path.exists(SDK_LOCAL_ZIP)): 89 if (os.path.exists(SDK_LOCAL_ZIP)):
101 os.remove(SDK_LOCAL_ZIP) 90 os.remove(SDK_LOCAL_ZIP)
102 if platform.system() == 'Windows': 91 if platform.system() == 'Windows':
103 # Windows does not have zip. We use the 7 zip utility in third party. 92 # Windows does not have zip. We use the 7 zip utility in third party.
104 ExecuteCommand([os.path.join('..', 'third_party', '7zip', '7za'), 'a', 93 ExecuteCommand([os.path.join('..', 'third_party', '7zip', '7za'), 'a',
105 '-tzip', SDK_LOCAL_ZIP, os.path.basename(argv[1])]) 94 '-tzip', SDK_LOCAL_ZIP, os.path.basename(argv[1])])
106 else: 95 else:
107 ExecuteCommand(['zip', '-yr', SDK_LOCAL_ZIP, os.path.basename(argv[1])]) 96 ExecuteCommand(['zip', '-yr', SDK_LOCAL_ZIP, os.path.basename(argv[1])])
108 UploadArchive(SDK_LOCAL_ZIP, 97 UploadArchive(SDK_LOCAL_ZIP,
109 GS_SITE + '/'.join([gsdir, GS_SDK_DIR, sdk_file])) 98 GS_SITE + '/'.join([gsdir, GS_SDK_DIR, sdk_file]))
110 latest_name = 'dart-%s-latest%s.zip' % (utils.GuessOS(), sdk_suffix) 99 latest_name = 'dart-%s-latest%s.zip' % (utils.GuessOS(), sdk_suffix)
111 UploadArchive(SDK_LOCAL_ZIP, 100 UploadArchive(SDK_LOCAL_ZIP,
112 GS_SITE + '/'.join([gsdir, GS_SDK_DIR, latest_name])) 101 GS_SITE + '/'.join([gsdir, GS_SDK_DIR, latest_name]))
113 102
114 103
115 if __name__ == '__main__': 104 if __name__ == '__main__':
116 sys.exit(main(sys.argv)) 105 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « tools/create_sdk.py ('k') | tools/utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698