From b4702b700631b5c974042cd0a579acd8a102f4af Mon Sep 17 00:00:00 2001 From: Hongguang Chen Date: Wed, 13 May 2020 18:05:20 -0700 Subject: [PATCH] Fix _ImportParser() error if property is imported from oem partition. The oem partition allows system build.prop to import properties from it by "import /oem/oem.prop xxxx". An _ImportParser() error was raised on this case. BUG: 154171021 Test: 1) "atest --host releasetools_test releasetools_py3_test -c" 2) On a device who has oem partition, "make dist" and sign its target zip file. Change-Id: I47875bf7a698390e11690150e6516a3064550ca0 --- tools/releasetools/common.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py index 7805e30ce8..42c29c01c9 100644 --- a/tools/releasetools/common.py +++ b/tools/releasetools/common.py @@ -803,8 +803,13 @@ class PartitionBuildProps(object): """Parses the build prop in a given import statement.""" tokens = line.split() - if len(tokens) != 2 or tokens[0] != 'import': + if tokens[0] != 'import' or (len(tokens) != 2 and len(tokens) != 3) : raise ValueError('Unrecognized import statement {}'.format(line)) + + if len(tokens) == 3: + logger.info("Import %s from %s, skip", tokens[2], tokens[1]) + return {} + import_path = tokens[1] if not re.match(r'^/{}/.*\.prop$'.format(self.partition), import_path): raise ValueError('Unrecognized import path {}'.format(line))