Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/usr/bin/env python | |
| 2 # | |
| 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 | |
| 5 # BSD-style license that can be found in the LICENSE file. | |
| 6 # | |
| 7 | |
| 8 # Script to build a tarball of the Dart source. | |
| 9 | |
| 10 import sys | |
| 11 import tarfile | |
| 12 import utils | |
| 13 | |
| 14 from os.path import basename, dirname, join, realpath, exists, isdir | |
| 15 | |
| 16 # Name of the dart directory when unpacking the tarball. | |
| 17 versiondir = '' | |
| 18 | |
| 19 def Filter(tar_info): | |
| 20 # Ignore Git/SVN files, checked-in binaries, backup files, etc.. | |
| 21 if (tar_info.name.endswith('.git') or | |
|
ricow1
2014/02/04 18:16:01
How about we split this up in 3 lists that we have
Søren Gjesse
2014/02/06 08:19:08
Good point, done.
| |
| 22 tar_info.name.endswith('.svn') or | |
| 23 tar_info.name.endswith('.mk') or | |
| 24 tar_info.name.endswith('Makefile') or | |
| 25 tar_info.name.startswith('tools/testing/bin/') or | |
| 26 tar_info.name.endswith('.pyc') or | |
| 27 tar_info.name.endswith('~')): | |
| 28 return None | |
| 29 # Add the dart directory name with version. | |
| 30 original_name = tar_info.name | |
| 31 # Place the debian directory one level over the rest which are | |
| 32 # placed in the directory 'dart'. This enables building the Debian | |
| 33 # packages out-of-the-box. | |
| 34 if tar_info.name.startswith('debian/'): | |
|
ricow1
2014/02/04 18:16:01
Since we are already special casing this maybe we
Søren Gjesse
2014/02/06 08:19:08
Used the directory tools/linux_dist_support/debian
| |
| 35 tar_info.name = join(versiondir, tar_info.name) | |
| 36 else: | |
| 37 tar_info.name = join(versiondir, 'dart', tar_info.name) | |
| 38 print 'Adding %s as %s' % (original_name, tar_info.name) | |
| 39 return tar_info | |
| 40 | |
| 41 def Main(): | |
| 42 if utils.GuessOS() != 'linux': | |
| 43 print 'Tarball can only be created on linux' | |
| 44 return 0 | |
| 45 | |
| 46 # Generate the name of the tarfile | |
| 47 version = utils.GetVersion() | |
|
ricow1
2014/02/04 18:16:01
you may want to add a comment here stating that th
Søren Gjesse
2014/02/06 08:19:08
It does contain the SVN revision, so not really st
| |
| 48 global versiondir | |
| 49 versiondir = 'dart-%s' % version | |
| 50 tarname = '%s.tar.gz' % versiondir | |
| 51 # Create the tar file outside the repository root | |
| 52 tardir = dirname(dirname(dirname(realpath(__file__)))) | |
|
ricow1
2014/02/04 18:16:01
why not create this in a temp dir, and copy it to
ricow1
2014/02/05 06:42:35
That was a pretty stupid suggestion, why not just
Søren Gjesse
2014/02/06 08:19:08
Done.
| |
| 53 tarfilename = join(tardir, tarname) | |
| 54 print 'Creating tar file: %s' % (tarname) | |
| 55 tar = tarfile.open(tarfilename, mode='w:gz') | |
| 56 for file in ['README', 'README.dart-sdk', 'dart.gyp']: | |
| 57 tar.add(file, filter=Filter) | |
| 58 for directory in ['debian', 'editor', 'pkg', 'runtime', 'samples', 'sdk', | |
|
ricow1
2014/02/04 18:16:01
I would really prefer if we did it the other way a
Søren Gjesse
2014/02/06 08:19:08
Done.
| |
| 59 'tests', 'tools', 'utils']: | |
| 60 tar.add(directory, filter=Filter) | |
| 61 for directory in ['apache_ant', 'apache_compress', 'args4j', 'bzip2', | |
|
ricow1
2014/02/04 18:16:01
Same comment as above
Søren Gjesse
2014/02/06 08:19:08
Done.
| |
| 62 'chrome', 'commons-io', 'commons-lang', 'eclipse', | |
| 63 'fest', 'guava', 'gyp', 'hamcrest', 'json', 'junit', | |
| 64 'mockito', 'net_nss', 'nss', 'pkg', 'snakeyaml', | |
| 65 'sqlite', 'stripjar', 'weberknecht', 'zlib']: | |
| 66 tar.add(join('third_party', directory), filter=Filter) | |
| 67 tar.close() | |
| 68 | |
| 69 if __name__ == '__main__': | |
| 70 sys.exit(Main()) | |
| OLD | NEW |