diff options
author | Dan Albert <danalbert@google.com> | 2017-12-11 11:41:18 -0800 |
---|---|---|
committer | Dan Albert <danalbert@google.com> | 2017-12-12 14:46:59 -0800 |
commit | 260ec6d747ab4739df4b59fcb209dbbd4b18ed37 (patch) | |
tree | ccea457182b64ee3830d4763b317b56f02d26385 | |
parent | 8b47b1bcd1a2d39f4c7f95130a786cb7586ec018 (diff) | |
download | ndk-260ec6d747ab4739df4b59fcb209dbbd4b18ed37.tar.gz |
Remove unnecessary files when installing.
We don't need the stub shared libraries since the platform build
already generates those, and we don't want the Android.bp files (we
should start purging these as part of the NDK build, but we don't
right now).
Test: Re-ran previous update command, verified no changes.
Bug: None
Change-Id: I544cf272d262e4b8fa638165d8202b3538fb0772
-rwxr-xr-x | update.py | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -35,6 +35,11 @@ def check_call(cmd): subprocess.check_call(cmd) +def remove(path): + logger().debug('remove `%s`', path) + os.remove(path) + + def fetch_artifact(branch, build, pattern): fetch_artifact_path = '/google/data/ro/projects/android/fetch_artifact' cmd = [fetch_artifact_path, '--branch', branch, '--target=linux', @@ -85,6 +90,20 @@ def install_new_release(branch, build, install_dir): os.unlink(artifact) +def remove_unneeded_files(install_dir): + for path, _dirs, files in os.walk(os.path.join(install_dir, 'platforms')): + for file_name in files: + if file_name.endswith('.so'): + file_path = os.path.join(path, file_name) + remove(file_path) + + for path, _dirs, files in os.walk(os.path.join(install_dir, 'sources')): + for file_name in files: + if file_name == 'Android.bp': + file_path = os.path.join(path, file_name) + remove(file_path) + + def make_symlinks(install_dir): old_dir = os.getcwd() os.chdir(os.path.join(THIS_DIR, install_dir, 'platforms')) @@ -149,6 +168,7 @@ def main(): start_branch(args.build) remove_old_release(install_dir) install_new_release(args.branch, args.build, install_dir) + remove_unneeded_files(install_dir) make_symlinks(install_dir) commit(args.branch, args.build, install_dir) |