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

Side by Side Diff: editor/build/build.py

Issue 440233005: Added sha256 sums for build outputs (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Take ricow's suggestions Created 6 years, 4 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 | « no previous file | tools/bots/bot_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/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 3 # Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
4 # for details. All rights reserved. Use of this source code is governed by a 4 # for details. All rights reserved. Use of this source code is governed by a
5 # BSD-style license that can be found in the LICENSE file. 5 # BSD-style license that can be found in the LICENSE file.
6 6
7 import glob 7 import glob
8 import gsutil 8 import gsutil
9 import imp 9 import imp
10 import optparse 10 import optparse
(...skipping 18 matching lines...) Expand all
29 REVISION = None 29 REVISION = None
30 SYSTEM = None 30 SYSTEM = None
31 31
32 NO_UPLOAD = None 32 NO_UPLOAD = None
33 33
34 DART_DIR = os.path.abspath(os.path.join(__file__, '..', '..', '..')) 34 DART_DIR = os.path.abspath(os.path.join(__file__, '..', '..', '..'))
35 utils = imp.load_source('utils', os.path.join(DART_DIR, 'tools', 'utils.py')) 35 utils = imp.load_source('utils', os.path.join(DART_DIR, 'tools', 'utils.py'))
36 bot_utils = imp.load_source('bot_utils', 36 bot_utils = imp.load_source('bot_utils',
37 os.path.join(DART_DIR, 'tools', 'bots', 'bot_utils.py')) 37 os.path.join(DART_DIR, 'tools', 'bots', 'bot_utils.py'))
38 38
39 def DartArchiveFile(local_path, remote_path, create_md5sum=False): 39 def DartArchiveFile(local_path, remote_path, checksum_files=False):
40 # Copy it to the new unified gs://dart-archive bucket 40 # Copy it to the new unified gs://dart-archive bucket
41 gsutil = bot_utils.GSUtil() 41 gsutil = bot_utils.GSUtil()
42 gsutil.upload(local_path, remote_path, public=True) 42 gsutil.upload(local_path, remote_path, public=True)
43 if create_md5sum: 43 if checksum_files:
44 # 'local_path' may have a different filename than 'remote_path'. So we need 44 # 'local_path' may have a different filename than 'remote_path'. So we need
45 # to make sure the *.md5sum file contains the correct name. 45 # to make sure the *.md5sum file contains the correct name.
46 assert '/' in remote_path and not remote_path.endswith('/') 46 assert '/' in remote_path and not remote_path.endswith('/')
47
47 mangled_filename = remote_path[remote_path.rfind('/') + 1:] 48 mangled_filename = remote_path[remote_path.rfind('/') + 1:]
48 local_md5sum = bot_utils.CreateChecksumFile(local_path, mangled_filename) 49 local_md5sum = bot_utils.CreateMD5ChecksumFile(local_path,
50 mangled_filename)
49 gsutil.upload(local_md5sum, remote_path + '.md5sum', public=True) 51 gsutil.upload(local_md5sum, remote_path + '.md5sum', public=True)
52 local_sha256 = bot_utils.CreateSha256ChecksumFile(local_path,
53 mangled_filename)
54 gsutil.upload(local_sha256, remote_path + '.sha256sum', public=True)
50 55
51 def DartArchiveUploadEditorZipFile(zipfile): 56 def DartArchiveUploadEditorZipFile(zipfile):
52 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW) 57 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW)
53 gsutil = bot_utils.GSUtil() 58 gsutil = bot_utils.GSUtil()
54 59
55 basename = os.path.basename(zipfile) 60 basename = os.path.basename(zipfile)
56 system = None 61 system = None
57 arch = None 62 arch = None
58 if basename.startswith('darteditor-linux'): 63 if basename.startswith('darteditor-linux'):
59 system = 'linux' 64 system = 'linux'
60 elif basename.startswith('darteditor-mac'): 65 elif basename.startswith('darteditor-mac'):
61 system = 'macos' 66 system = 'macos'
62 elif basename.startswith('darteditor-win'): 67 elif basename.startswith('darteditor-win'):
63 system = 'windows' 68 system = 'windows'
64 69
65 if basename.endswith('-32.zip'): 70 if basename.endswith('-32.zip'):
66 arch = 'ia32' 71 arch = 'ia32'
67 elif basename.endswith('-64.zip'): 72 elif basename.endswith('-64.zip'):
68 arch = 'x64' 73 arch = 'x64'
69 74
70 assert system and arch 75 assert system and arch
71 76
72 for revision in [REVISION, 'latest']: 77 for revision in [REVISION, 'latest']:
73 DartArchiveFile(zipfile, namer.editor_zipfilepath(revision, system, arch), 78 DartArchiveFile(zipfile, namer.editor_zipfilepath(revision, system, arch),
74 create_md5sum=True) 79 checksum_files=True)
75 80
76 def DartArchiveUploadUpdateSite(local_path): 81 def DartArchiveUploadUpdateSite(local_path):
77 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW) 82 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW)
78 gsutil = bot_utils.GSUtil() 83 gsutil = bot_utils.GSUtil()
79 for revision in [REVISION, 'latest']: 84 for revision in [REVISION, 'latest']:
80 update_site_dir = namer.editor_eclipse_update_directory(revision) 85 update_site_dir = namer.editor_eclipse_update_directory(revision)
81 try: 86 try:
82 gsutil.remove(update_site_dir, recursive=True) 87 gsutil.remove(update_site_dir, recursive=True)
83 except: 88 except:
84 # Ignore this, in the general case there is nothing. 89 # Ignore this, in the general case there is nothing.
85 pass 90 pass
86 gsutil.upload(local_path, update_site_dir, recursive=True, public=True) 91 gsutil.upload(local_path, update_site_dir, recursive=True, public=True)
87 92
88 def DartArchiveUploadSDKs(system, sdk32_zip, sdk64_zip): 93 def DartArchiveUploadSDKs(system, sdk32_zip, sdk64_zip):
89 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW) 94 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW)
90 for revision in [REVISION, 'latest']: 95 for revision in [REVISION, 'latest']:
91 path32 = namer.sdk_zipfilepath(revision, system, 'ia32', 'release') 96 path32 = namer.sdk_zipfilepath(revision, system, 'ia32', 'release')
92 path64 = namer.sdk_zipfilepath(revision, system, 'x64', 'release') 97 path64 = namer.sdk_zipfilepath(revision, system, 'x64', 'release')
93 DartArchiveFile(sdk32_zip, path32, create_md5sum=True) 98 DartArchiveFile(sdk32_zip, path32, checksum_files=True)
94 DartArchiveFile(sdk64_zip, path64, create_md5sum=True) 99 DartArchiveFile(sdk64_zip, path64, checksum_files=True)
95 100
96 def DartArchiveUploadAPIDocs(api_zip): 101 def DartArchiveUploadAPIDocs(api_zip):
97 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW) 102 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW)
98 for revision in [REVISION, 'latest']: 103 for revision in [REVISION, 'latest']:
99 destination = (namer.apidocs_directory(revision) + '/' + 104 destination = (namer.apidocs_directory(revision) + '/' +
100 namer.apidocs_zipfilename()) 105 namer.apidocs_zipfilename())
101 DartArchiveFile(api_zip, destination, create_md5sum=False) 106 DartArchiveFile(api_zip, destination, checksum_files=False)
102 107
103 def DartArchiveUploadAndroidZip(android_zip): 108 def DartArchiveUploadAndroidZip(android_zip):
104 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW) 109 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW)
105 for revision in [REVISION, 'latest']: 110 for revision in [REVISION, 'latest']:
106 destination = namer.editor_android_zipfilepath(revision) 111 destination = namer.editor_android_zipfilepath(revision)
107 DartArchiveFile(android_zip, destination, create_md5sum=False) 112 DartArchiveFile(android_zip, destination, checksum_files=False)
108 113
109 def DartArchiveUploadVersionFile(version_file): 114 def DartArchiveUploadVersionFile(version_file):
110 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW) 115 namer = bot_utils.GCSNamer(CHANNEL, bot_utils.ReleaseType.RAW)
111 for revision in [REVISION, 'latest']: 116 for revision in [REVISION, 'latest']:
112 DartArchiveFile(version_file, namer.version_filepath(revision), 117 DartArchiveFile(version_file, namer.version_filepath(revision),
113 create_md5sum=False) 118 checksum_files=False)
114 119
115 def DartArchiveUploadInstaller( 120 def DartArchiveUploadInstaller(
116 arch, installer_file, extension, release_type=bot_utils.ReleaseType.RAW): 121 arch, installer_file, extension, release_type=bot_utils.ReleaseType.RAW):
117 namer = bot_utils.GCSNamer(CHANNEL, release_type) 122 namer = bot_utils.GCSNamer(CHANNEL, release_type)
118 gsu_path = namer.editor_installer_filepath( 123 gsu_path = namer.editor_installer_filepath(
119 REVISION, SYSTEM, arch, extension) 124 REVISION, SYSTEM, arch, extension)
120 DartArchiveFile(installer_file, gsu_path, create_md5sum=False) 125 DartArchiveFile(installer_file, gsu_path, checksum_files=False)
121 126
122 class AntWrapper(object): 127 class AntWrapper(object):
123 """A wrapper for ant build invocations""" 128 """A wrapper for ant build invocations"""
124 129
125 _antpath = None 130 _antpath = None
126 _bzippath = None 131 _bzippath = None
127 _propertyfile = None 132 _propertyfile = None
128 133
129 def __init__(self, propertyfile, antpath='/usr/bin', bzippath=None): 134 def __init__(self, propertyfile, antpath='/usr/bin', bzippath=None):
130 """Initialize the ant path. 135 """Initialize the ant path.
(...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after
1286 def FileDelete(f): 1291 def FileDelete(f):
1287 """delete the given file - do not re-throw any exceptions that occur""" 1292 """delete the given file - do not re-throw any exceptions that occur"""
1288 if os.path.exists(f): 1293 if os.path.exists(f):
1289 try: 1294 try:
1290 os.remove(f) 1295 os.remove(f)
1291 except OSError: 1296 except OSError:
1292 print 'error deleting %s' % f 1297 print 'error deleting %s' % f
1293 1298
1294 if __name__ == '__main__': 1299 if __name__ == '__main__':
1295 sys.exit(main()) 1300 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | tools/bots/bot_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698