From ef21d1458b1e1d46876fb20fdec998fb1d987f98 Mon Sep 17 00:00:00 2001 From: Chih-Hung Hsieh Date: Thu, 27 Apr 2017 10:25:37 -0700 Subject: [PATCH] Get Android TOP from build.log file. find_android_root works only when warn.py is found so it works for build bot, but not when warn.py is run against a stand alone build.log file. Now get the TOP directory path from build.log if it is found. Bug: 37725427 Test: warn.py --gencsv build.log Change-Id: I7b776c2e71a8d8d769f0600b08abe37acbd6ce7c --- tools/warn.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/warn.py b/tools/warn.py index 9cb115e1ec..8aed830433 100755 --- a/tools/warn.py +++ b/tools/warn.py @@ -2385,7 +2385,8 @@ def normalize_warning_line(line): def parse_input_file(infile): - """Parse input file, match warning lines.""" + """Parse input file, collect parameters and warning lines.""" + global android_root global platform_version global target_product global target_variant @@ -2412,6 +2413,9 @@ def parse_input_file(infile): m = re.search('(?<=^TARGET_BUILD_VARIANT=).*', line) if m is not None: target_variant = m.group(0) + m = re.search('.* TOP=([^ ]*) .*', line) + if m is not None: + android_root = m.group(1) return warning_lines