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

Unified Diff: tools/create_tarball.py

Issue 154073002: Add script for generating a source tarball and rules for bilding a Debian package (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« debian/rules ('K') | « debian/source/format ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/create_tarball.py
diff --git a/tools/create_tarball.py b/tools/create_tarball.py
new file mode 100755
index 0000000000000000000000000000000000000000..539edbda0195486449b7810f4b9c3e1dcd13e6d8
--- /dev/null
+++ b/tools/create_tarball.py
@@ -0,0 +1,70 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+#
+
+# Script to build a tarball of the Dart source.
+
+import sys
+import tarfile
+import utils
+
+from os.path import basename, dirname, join, realpath, exists, isdir
+
+# Name of the dart directory when unpacking the tarball.
+versiondir = ''
+
+def Filter(tar_info):
+ # Ignore Git/SVN files, checked-in binaries, backup files, etc..
+ 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.
+ tar_info.name.endswith('.svn') or
+ tar_info.name.endswith('.mk') or
+ tar_info.name.endswith('Makefile') or
+ tar_info.name.startswith('tools/testing/bin/') or
+ tar_info.name.endswith('.pyc') or
+ tar_info.name.endswith('~')):
+ return None
+ # Add the dart directory name with version.
+ original_name = tar_info.name
+ # Place the debian directory one level over the rest which are
+ # placed in the directory 'dart'. This enables building the Debian
+ # packages out-of-the-box.
+ 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
+ tar_info.name = join(versiondir, tar_info.name)
+ else:
+ tar_info.name = join(versiondir, 'dart', tar_info.name)
+ print 'Adding %s as %s' % (original_name, tar_info.name)
+ return tar_info
+
+def Main():
+ if utils.GuessOS() != 'linux':
+ print 'Tarball can only be created on linux'
+ return 0
+
+ # Generate the name of the tarfile
+ 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
+ global versiondir
+ versiondir = 'dart-%s' % version
+ tarname = '%s.tar.gz' % versiondir
+ # Create the tar file outside the repository root
+ 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.
+ tarfilename = join(tardir, tarname)
+ print 'Creating tar file: %s' % (tarname)
+ tar = tarfile.open(tarfilename, mode='w:gz')
+ for file in ['README', 'README.dart-sdk', 'dart.gyp']:
+ tar.add(file, filter=Filter)
+ 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.
+ 'tests', 'tools', 'utils']:
+ tar.add(directory, filter=Filter)
+ 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.
+ 'chrome', 'commons-io', 'commons-lang', 'eclipse',
+ 'fest', 'guava', 'gyp', 'hamcrest', 'json', 'junit',
+ 'mockito', 'net_nss', 'nss', 'pkg', 'snakeyaml',
+ 'sqlite', 'stripjar', 'weberknecht', 'zlib']:
+ tar.add(join('third_party', directory), filter=Filter)
+ tar.close()
+
+if __name__ == '__main__':
+ sys.exit(Main())
« debian/rules ('K') | « debian/source/format ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698