summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
author Atneya Nair <atneya@google.com> 2024-07-16 17:25:13 -0700
committer Atneya Nair <atneya@google.com> 2024-07-18 12:28:11 -0700
commit30f3662693132d39f94b66b46bcd7aaef4aaef65 (patch)
tree1fac5821a02ddea170b0c78eee2296b10fb2adb2 /bin
parent45d61d8b115940fbdbc16293b3a9793550947f78 (diff)
dirmods: Update to take absolute paths
Dirmods currently expects a path relative to the top of the build. If an abs path is passed, it will never match anything. Modify so that if path is absolute, we fix-up the path relative to ANDROID_BUILD_TOP. Test: manual Bug: trivial Change-Id: Iad99228078dc693ab5f7957e007fe1bd5cea07d2
Diffstat (limited to 'bin')
-rwxr-xr-xbin/dirmods8
1 files changed, 8 insertions, 0 deletions
diff --git a/bin/dirmods b/bin/dirmods
index 52d935a5a..a6d4de3be 100755
--- a/bin/dirmods
+++ b/bin/dirmods
@@ -35,6 +35,14 @@ def main():
args = parser.parse_args()
d = os.path.normpath(args.path)
+ # Fix absolute path to be relative to build top
+ if os.path.isabs(d):
+ base = os.environ.get('ANDROID_BUILD_TOP')
+ if base:
+ base = os.path.normpath(base) + os.path.sep
+ if d.startswith(base):
+ d = d[len(base):]
+
prefix = d + '/'
module_info = modinfo.ReadModuleInfo()