| OLD | NEW | 
|---|
| 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 | 
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 45 | 45 | 
| 46 def GetSVNRevision(): | 46 def GetSVNRevision(): | 
| 47   p = subprocess.Popen(['svn', 'info'], stdout = subprocess.PIPE, | 47   p = subprocess.Popen(['svn', 'info'], stdout = subprocess.PIPE, | 
| 48       stderr = subprocess.STDOUT, close_fds=True) | 48       stderr = subprocess.STDOUT, close_fds=True) | 
| 49   output, not_used = p.communicate() | 49   output, not_used = p.communicate() | 
| 50   for line in output.split('\n'): | 50   for line in output.split('\n'): | 
| 51     if 'Revision' in line: | 51     if 'Revision' in line: | 
| 52       return (line.strip().split())[1] | 52       return (line.strip().split())[1] | 
| 53   return None | 53   return None | 
| 54 | 54 | 
|  | 55 | 
|  | 56 def usage(progname): | 
|  | 57     sys.stderr.write('Usage: %s path_to_sdk\n' % progname) | 
|  | 58 | 
|  | 59 | 
| 55 def main(argv): | 60 def main(argv): | 
| 56   if (not os.path.exists(argv[1])): | 61   if not os.path.exists(argv[1]): | 
| 57     sys.stderr.write('Usage: upload_sdk.py path_to_sdk\n') | 62     sys.stderr.write('Path not found: %s\n' % argv[1]) | 
|  | 63     usage(argv[0]) | 
| 58     return 1 | 64     return 1 | 
| 59   if (not os.path.exists(GSUTIL)): | 65   if (not os.path.exists(GSUTIL)): | 
| 60     exit(0) | 66     exit(0) | 
| 61   revision = GetSVNRevision() | 67   revision = GetSVNRevision() | 
| 62   if revision == None: | 68   if revision is None: | 
| 63     sys.stderr.write('Unable to find SVN revision.\n') | 69     sys.stderr.write('Unable to find SVN revision.\n') | 
| 64     return 1 | 70     return 1 | 
| 65   os.chdir(argv[1]) | 71   os.chdir(argv[1]) | 
| 66   # TODO(dgrove) - deal with architectures that are not ia32. | 72   # TODO(dgrove) - deal with architectures that are not ia32. | 
| 67   sdk_name = 'dart-' + utils.GuessOS() + '-' + revision + '.zip' | 73   sdk_name = 'dart-' + utils.GuessOS() + '-' + revision + '.zip' | 
| 68   sdk_file = '../' + sdk_name | 74   sdk_file = '../' + sdk_name | 
| 69   ExecuteCommand(['zip', '-yr', sdk_file, '.']) | 75   ExecuteCommand(['zip', '-yr', sdk_file, '.']) | 
| 70   UploadArchive(sdk_file, GS_SITE + os.path.join(GS_DIR, SDK, sdk_name)) | 76   UploadArchive(sdk_file, GS_SITE + os.path.join(GS_DIR, SDK, sdk_name)) | 
| 71   latest_name = 'dart-' + utils.GuessOS() + '-latest' + '.zip' | 77   latest_name = 'dart-' + utils.GuessOS() + '-latest' + '.zip' | 
| 72   UploadArchive(sdk_file, GS_SITE + os.path.join(GS_DIR, SDK, latest_name)) | 78   UploadArchive(sdk_file, GS_SITE + os.path.join(GS_DIR, SDK, latest_name)) | 
| 73 | 79 | 
| 74 | 80 | 
| 75 if __name__ == '__main__': | 81 if __name__ == '__main__': | 
| 76   sys.exit(main(sys.argv)) | 82   sys.exit(main(sys.argv)) | 
| 77 | 83 | 
| 78 | 84 | 
| OLD | NEW | 
|---|