OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2014, 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 | 7 |
8 # Script to build a tarball of the Dart source. | 8 # Script to build a tarball of the Dart source. |
9 # | 9 # |
10 # The tarball includes all the source needed to build Dart. This | 10 # The tarball includes all the source needed to build Dart. This |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 95 |
96 def GenerateChangeLog(filename, version): | 96 def GenerateChangeLog(filename, version): |
97 with open(filename, 'w') as f: | 97 with open(filename, 'w') as f: |
98 f.write('dart (%s-1) UNRELEASED; urgency=low\n' % version) | 98 f.write('dart (%s-1) UNRELEASED; urgency=low\n' % version) |
99 f.write('\n') | 99 f.write('\n') |
100 f.write(' * Generated file.\n') | 100 f.write(' * Generated file.\n') |
101 f.write('\n') | 101 f.write('\n') |
102 f.write(' -- Dart Team <misc@dartlang.org> %s\n' % | 102 f.write(' -- Dart Team <misc@dartlang.org> %s\n' % |
103 datetime.datetime.utcnow().strftime('%a, %d %b %Y %X +0000')) | 103 datetime.datetime.utcnow().strftime('%a, %d %b %Y %X +0000')) |
104 | 104 |
105 def GenerateSvnRevision(filename, svn_revision): | 105 def GenerateGitRevision(filename, git_revision): |
106 with open(filename, 'w') as f: | 106 with open(filename, 'w') as f: |
107 f.write(str(svn_revision)) | 107 f.write(str(git_revision)) |
108 | 108 |
109 | 109 |
110 def CreateTarball(tarfilename): | 110 def CreateTarball(tarfilename): |
111 global ignoredPaths # Used for adding the output directory. | 111 global ignoredPaths # Used for adding the output directory. |
112 # Generate the name of the tarfile | 112 # Generate the name of the tarfile |
113 version = utils.GetVersion() | 113 version = utils.GetVersion() |
114 global versiondir | 114 global versiondir |
115 versiondir = 'dart-%s' % version | 115 versiondir = 'dart-%s' % version |
116 debian_dir = 'tools/linux_dist_support/debian' | 116 debian_dir = 'tools/linux_dist_support/debian' |
117 # Don't include the build directory in the tarball (ignored paths | 117 # Don't include the build directory in the tarball (ignored paths |
(...skipping 13 matching lines...) Expand all Loading... |
131 # Generate and add debian/copyright | 131 # Generate and add debian/copyright |
132 copyright_file = join(temp_dir, 'copyright') | 132 copyright_file = join(temp_dir, 'copyright') |
133 GenerateCopyright(copyright_file) | 133 GenerateCopyright(copyright_file) |
134 tar.add(copyright_file, arcname='%s/debian/copyright' % versiondir) | 134 tar.add(copyright_file, arcname='%s/debian/copyright' % versiondir) |
135 | 135 |
136 # Generate and add debian/changelog | 136 # Generate and add debian/changelog |
137 change_log = join(temp_dir, 'changelog') | 137 change_log = join(temp_dir, 'changelog') |
138 GenerateChangeLog(change_log, version) | 138 GenerateChangeLog(change_log, version) |
139 tar.add(change_log, arcname='%s/debian/changelog' % versiondir) | 139 tar.add(change_log, arcname='%s/debian/changelog' % versiondir) |
140 | 140 |
141 # For bleeding_edge add the SVN_REVISION file. | 141 # For bleeding_edge add the GIT_REVISION file. |
142 if utils.GetChannel() == 'be': | 142 if utils.GetChannel() == 'be': |
143 svn_revision = join(temp_dir, 'SVN_REVISION') | 143 git_revision = join(temp_dir, 'GIT_REVISION') |
144 GenerateSvnRevision(svn_revision, utils.GetSVNRevision()) | 144 GenerateGitRevision(git_revision, utils.GetGitRevision()) |
145 tar.add(svn_revision, arcname='%s/dart/tools/SVN_REVISION' % versiondir) | 145 tar.add(git_revision, arcname='%s/dart/tools/GIT_REVISION' % versiondir) |
146 | 146 |
147 def Main(): | 147 def Main(): |
148 if HOST_OS != 'linux': | 148 if HOST_OS != 'linux': |
149 print 'Tarball can only be created on linux' | 149 print 'Tarball can only be created on linux' |
150 return -1 | 150 return -1 |
151 | 151 |
152 # Parse the options. | 152 # Parse the options. |
153 parser = BuildOptions() | 153 parser = BuildOptions() |
154 (options, args) = parser.parse_args() | 154 (options, args) = parser.parse_args() |
155 if options.verbose: | 155 if options.verbose: |
156 global verbose | 156 global verbose |
157 verbose = True | 157 verbose = True |
158 | 158 |
159 tar_filename = options.tar_filename | 159 tar_filename = options.tar_filename |
160 if not tar_filename: | 160 if not tar_filename: |
161 tar_filename = join(DART_DIR, | 161 tar_filename = join(DART_DIR, |
162 utils.GetBuildDir(HOST_OS), | 162 utils.GetBuildDir(HOST_OS), |
163 'dart-%s.tar.gz' % utils.GetVersion()) | 163 'dart-%s.tar.gz' % utils.GetVersion()) |
164 | 164 |
165 CreateTarball(tar_filename) | 165 CreateTarball(tar_filename) |
166 | 166 |
167 if __name__ == '__main__': | 167 if __name__ == '__main__': |
168 sys.exit(Main()) | 168 sys.exit(Main()) |
OLD | NEW |