aboutsummaryrefslogtreecommitdiff
path: root/build/lib
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2015-12-17 02:03:10 -0800
committerDan Albert <danalbert@google.com>2015-12-17 14:35:04 -0800
commit2928df9030bce4f3ad2ad1f49740db49903c067c (patch)
tree9446a287354169416a701bcdd6c3e1b86e86864d /build/lib
parentc9ee555446a28c681f9bdc626ad1571ea1f18acc (diff)
downloadndk-2928df9030bce4f3ad2ad1f49740db49903c067c.tar.gz
Fix make_package to build a new style package.
Bug: http://b/26235995 Change-Id: Ie00877190023f0e6ef686f80573ba105325a01f1
Diffstat (limited to 'build/lib')
-rw-r--r--build/lib/build_support.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/build/lib/build_support.py b/build/lib/build_support.py
index c40b21652..df67c686c 100644
--- a/build/lib/build_support.py
+++ b/build/lib/build_support.py
@@ -180,7 +180,7 @@ def make_repo_prop(out_dir):
subprocess.check_call(cmd, stdout=prop_file)
-def make_package(name, files, out_dir, root_dir, repo_prop_dir=''):
+def make_package(name, directory, out_dir):
"""Pacakges an NDK module for release.
Makes a tarball of the single NDK module that can be released in the SDK
@@ -189,10 +189,12 @@ def make_package(name, files, out_dir, root_dir, repo_prop_dir=''):
Args:
name: Name of the final package, excluding extension.
- files: List of files (relative to root_dir) to be packaged.
+ directory: Directory to be packaged.
out_dir: Directory to place package.
- root_dir: Directory to make package from. Equivalent to tar(1)'s -C.
"""
+ if not os.path.isdir(directory):
+ raise ValueError('directory must be a directory: ' + directory)
+
path = os.path.join(out_dir, name + '.tar.bz2')
def package_filter(tarinfo):
@@ -218,14 +220,13 @@ def make_package(name, files, out_dir, root_dir, repo_prop_dir=''):
return tarinfo
with tarfile.open(path, 'w:bz2') as tarball:
- for f in files:
- real_file = os.path.join(root_dir, f)
- tarball.add(real_file, f, filter=package_filter)
+ basename = os.path.basename(directory)
+ tarball.add(directory, basename, filter=package_filter)
tmpdir = tempfile.mkdtemp()
try:
make_repo_prop(tmpdir)
- arcname = os.path.join(repo_prop_dir, 'repo.prop')
+ arcname = os.path.join(basename, 'repo.prop')
tarball.add(os.path.join(tmpdir, 'repo.prop'), arcname)
finally:
shutil.rmtree(tmpdir)