diff options
author | Christopher Ferris <cferris@google.com> | 2017-02-24 12:26:48 -0800 |
---|---|---|
committer | Christopher Ferris <cferris@google.com> | 2017-03-02 15:21:42 -0800 |
commit | 15d3fef0da03a8548fd25ec75381e86eea5c6882 (patch) | |
tree | 49c2f1e85deed4d19f4d4b42c62cb616d0fff18a /libc/kernel/tools/utils.py | |
parent | 3f76dadf15aa8ca4f2eaf471a9a1f1c661b353c2 (diff) |
Refactor the kernel update scripts.
The previous versions of the scripts did a lot of redundant changes
and were hard to follow.
I rewrote most of update_all.py so that it's clear about what's going on.
I updated clean_header.py to change the cleanupFile function so that
there is no magic about where the destination file is going to wind up.
Now the caller specifies the final location.
I updated utils.py so that if you are trying to do an update in one
location, but your lunch target is from another location, it causes
an error.
Bug: 35726570
Change-Id: Ic5a44d90c2774a627eecde34c0c403bc925a497c
Test: Ran the updater and verified it works properly.
Test: Verified that doing an update in one tree to another tree
Test: fails.
Diffstat (limited to 'libc/kernel/tools/utils.py')
-rw-r--r-- | libc/kernel/tools/utils.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libc/kernel/tools/utils.py b/libc/kernel/tools/utils.py index e2cc9ce10..1b06b1b48 100644 --- a/libc/kernel/tools/utils.py +++ b/libc/kernel/tools/utils.py @@ -31,8 +31,14 @@ def get_kernel_dir(): def get_android_root(): if "ANDROID_BUILD_TOP" in os.environ: + # Verify that the current directory is in the root. + # If not, then print an error. + cwd = os.getcwd() + root = os.environ["ANDROID_BUILD_TOP"] + if len(cwd) < len(root) or not root == cwd[:len(root)]: + panic("Not in android tree pointed at by ANDROID_BUILD_TOP (%s)\n" % root) return os.environ["ANDROID_BUILD_TOP"] - panic("Unable to find root of tree, did you forget to lunch a target?") + panic("Unable to find root of tree, did you forget to lunch a target?\n") class StringOutput: |