diff options
author | Daniel Mentz <danielmentz@google.com> | 2019-04-15 15:19:31 -0700 |
---|---|---|
committer | Daniel Mentz <danielmentz@google.com> | 2019-04-16 14:26:20 -0700 |
commit | bc3e37ca2357dafaf31680f317f6090611e50313 (patch) | |
tree | 1340b761262becc658e85395777323eda623b6da | |
parent | 5ca5d4aa1d66b16110c1476f3311abafa7afd26e (diff) | |
download | android_bionic-bc3e37ca2357dafaf31680f317f6090611e50313.tar.gz android_bionic-bc3e37ca2357dafaf31680f317f6090611e50313.tar.bz2 android_bionic-bc3e37ca2357dafaf31680f317f6090611e50313.zip |
clean_header: Run outside of $ANDROID_BUILD_TOP
Enable the use case where we run clean_header.py from outside of
$ANDROID_BUILD_TOP. Previously, this script required the current working
directory to be under $ANDROID_BUILD_TOP. Running it from a different
directory resulted in the following error message:
clean_header.py: error: Not in android tree pointed at by ANDROID_BUILD_TOP (....)
(cherry picked from commit d12d6f67bca790696679db46cdc306eba3122e7c)
Bug: 128420573
Change-Id: If07b0345401f5dd35b41876a3838209595bf8ab1
Merged-In: I48210ea1a0033228a9aaa4124d28247b07cee6d4
-rwxr-xr-x | libc/kernel/tools/clean_header.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/libc/kernel/tools/clean_header.py b/libc/kernel/tools/clean_header.py index 88b2ae008..92a213920 100755 --- a/libc/kernel/tools/clean_header.py +++ b/libc/kernel/tools/clean_header.py @@ -152,8 +152,8 @@ if __name__ == "__main__": usage() no_update = True - dst_dir = get_kernel_dir() - src_dir = get_kernel_headers_original_dir() + dst_dir = None + src_dir = None for opt, arg in optlist: if opt == '-u': no_update = False @@ -163,6 +163,15 @@ if __name__ == "__main__": src_dir = arg elif opt == '-d': dst_dir = arg + # get_kernel_dir() and get_kernel_headers_original_dir() require the current + # working directory to be a direct or indirect subdirectory of + # ANDROID_BUILD_TOP. Otherwise, these functions print an error message and + # exit. Let's allow the user to run this program from an unrelated + # directory, if they specify src_dir and dst_dir on the command line. + if dst_dir is None: + dst_dir = get_kernel_dir() + if src_dir is None: + src_dir = get_kernel_headers_original_dir() if len(args) == 0: usage() |