29from os.path
import join, split, abspath, dirname
30sys.path.append(
join(dirname(__file__),
'..'))
34DART_DIR = abspath(
join(dirname(__file__),
'..',
'..'))
43 'buildtools/linux-x64/go',
44 'buildtools/linux-x64/rust',
46 'third_party/android_tools',
49 'third_party/firefox_jsshell',
51 'third_party/llvm-build',
64ignoredEndings = [
'.mk',
'.pyc',
'Makefile',
'~']
68 result = optparse.OptionParser()
69 result.add_option(
"-v",
71 help=
'Verbose output.',
74 result.add_option(
"--tar_filename", default=
None, help=
"The output file.")
82 assert tar_info.name.startswith(DART_DIR[1:])
83 original_name = tar_info.name[
len(DART_DIR):]
84 _, tail = split(original_name)
85 if tail
in ignoredDirs:
87 for path
in ignoredPaths:
88 if original_name.startswith(path):
90 for ending
in ignoredEndings:
91 if original_name.endswith(ending):
97 tar_info.name =
join(versiondir,
'dart', original_name)
99 print(
'Adding %s as %s' % (original_name, tar_info.name))
104 with open(
join(DART_DIR,
'LICENSE'))
as lf:
105 license_lines = lf.readlines()
107 with open(filename,
'w')
as f:
108 f.write(
'Name: dart\n')
109 f.write(
'Maintainer: Dart Team <misc@dartlang.org>\n')
110 f.write(
'Source: https://dart.googlesource.com/sdk\n')
111 f.write(
'License:\n')
112 for line
in license_lines:
113 f.write(
' %s' % line)
117 with open(filename,
'w')
as f:
118 f.write(
'dart (%s-1) UNRELEASED; urgency=low\n' % version)
120 f.write(
' * Generated file.\n')
122 f.write(
' -- Dart Team <misc@dartlang.org> %s\n' %
123 datetime.datetime.utcnow().strftime(
'%a, %d %b %Y %X +0000'))
127 f = open(filename,
'w')
132 with open(filename,
'w')
as f:
133 f.write(str(git_revision))
136 with open(filename,
'w')
as f:
137 f.write(str(git_timestamp))
144 versiondir =
'dart-%s' % version
145 debian_dir =
'tools/linux_dist_support/debian'
149 ignoredPaths.append(builddir)
151 print(
'Creating tarball: %s' % tarfilename)
152 with tarfile.open(tarfilename, mode=
'w:gz')
as tar:
153 for f
in listdir(DART_DIR):
154 tar.add(
join(DART_DIR, f), filter=Filter)
155 for f
in listdir(
join(DART_DIR, debian_dir)):
156 tar.add(
join(DART_DIR, debian_dir, f),
157 arcname=
'%s/debian/%s' % (versiondir, f))
161 copyright_file =
join(temp_dir,
'copyright')
163 tar.add(copyright_file, arcname=
'%s/debian/copyright' % versiondir)
166 change_log =
join(temp_dir,
'changelog')
168 tar.add(change_log, arcname=
'%s/debian/changelog' % versiondir)
171 empty =
join(temp_dir,
'empty')
173 tar.add(empty, arcname=
'%s/dart/.git/logs/HEAD' % versiondir)
177 git_revision =
join(temp_dir,
'GIT_REVISION')
179 tar.add(git_revision,
180 arcname=
'%s/dart/tools/GIT_REVISION' % versiondir)
183 git_timestamp =
join(temp_dir,
'GIT_TIMESTAMP')
185 tar.add(git_timestamp,
186 arcname=
'%s/dart/tools/GIT_TIMESTAMP' % versiondir)
189 if HOST_OS !=
'linux':
190 print(
'Tarball can only be created on linux')
195 (options, args) = parser.parse_args()
200 tar_filename = options.tar_filename
208if __name__ ==
'__main__':
def GenerateCopyright(filename)
def GenerateGitRevision(filename, git_revision)
def CreateTarball(tarfilename)
def GenerateEmpty(filename)
def GenerateGitTimestamp(filename, git_timestamp)
def GenerateChangeLog(filename, version)
def print(*args, **kwargs)
def GetGitTimestamp(git_timestamp_file=None, repo_path=DART_DIR)
def GetChannel(version_file=None)
def GetVersion(no_git_hash=False, version_file=None, git_revision_file=None)
def GetGitRevision(git_revision_file=None, repo_path=DART_DIR)
static SkString join(const CommandLineFlags::StringArray &)