summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xtools/export_tarball/export_tarball.py26
1 files changed, 18 insertions, 8 deletions
diff --git a/tools/export_tarball/export_tarball.py b/tools/export_tarball/export_tarball.py
index 518d097..de8edb5 100755
--- a/tools/export_tarball/export_tarball.py
+++ b/tools/export_tarball/export_tarball.py
@@ -27,14 +27,10 @@ NONESSENTIAL_DIRS = (
'breakpad/src/processor/testdata',
'chrome/browser/resources/tracing/tests',
'chrome/common/extensions/docs',
- 'chrome/test/data',
'chrome/tools/test/reference_build',
- 'content/test/data',
'courgette/testdata',
'data',
- 'media/test/data',
'native_client/src/trusted/service_runtime/testdata',
- 'net/data',
'src/chrome/test/data',
'o3d/documentation',
'o3d/samples',
@@ -71,6 +67,13 @@ NONESSENTIAL_DIRS = (
'webkit/tools/test/reference_build',
)
+TESTDIRS = (
+ 'chrome/test/data',
+ 'content/test/data',
+ 'media/test/data',
+ 'net/data',
+)
+
def GetSourceDirectory():
return os.path.realpath(
@@ -96,7 +99,7 @@ class MyTarFile(tarfile.TarFile):
# Remove contents of non-essential directories, but preserve gyp files,
# so that build/gyp_chromium can work.
- for nonessential_dir in NONESSENTIAL_DIRS:
+ for nonessential_dir in (NONESSENTIAL_DIRS + TESTDIRS):
dir_path = os.path.join(GetSourceDirectory(), nonessential_dir)
if (name.startswith(dir_path) and
os.path.isfile(name) and
@@ -108,9 +111,11 @@ class MyTarFile(tarfile.TarFile):
def main(argv):
parser = optparse.OptionParser()
+ parser.add_option("--basename")
parser.add_option("--remove-nonessential-files",
dest="remove_nonessential_files",
action="store_true", default=False)
+ parser.add_option("--test-data", action="store_true")
parser.add_option("--xz", action="store_true")
options, args = parser.parse_args(argv)
@@ -121,7 +126,7 @@ def main(argv):
return 1
if not os.path.exists(GetSourceDirectory()):
- print 'Cannot find the src directory.'
+ print 'Cannot find the src directory ' + GetSourceDirectory()
return 1
# This command is from src/DEPS; please keep them in sync.
@@ -135,7 +140,7 @@ def main(argv):
else:
output_fullname = args[0] + '.tar.bz2'
- output_basename = os.path.basename(args[0])
+ output_basename = options.basename or os.path.basename(args[0])
if options.xz:
archive = MyTarFile.open(output_fullname, 'w')
@@ -143,7 +148,12 @@ def main(argv):
archive = MyTarFile.open(output_fullname, 'w:bz2')
archive.set_remove_nonessential_files(options.remove_nonessential_files)
try:
- archive.add(GetSourceDirectory(), arcname=output_basename)
+ if options.test_data:
+ for directory in TESTDIRS:
+ archive.add(os.path.join(GetSourceDirectory(), directory),
+ arcname=os.path.join(output_basename, directory))
+ else:
+ archive.add(GetSourceDirectory(), arcname=output_basename)
finally:
archive.close()