From 3cfeedb4ae21399128cbc6f96ce3162611fafe1f Mon Sep 17 00:00:00 2001 From: Zhao Wei Liew Date: Wed, 25 Jan 2017 22:39:55 +0800 Subject: ota_from_target_files: Fix cherry-pick error In commit 24d91d8dd36b1b2a681461bea56a44605521861e, info_dict is yet to be initialized when it is checked for "ota_override_device" and "ota_override_prop". Move the checks down to after info_dict is initialized. Change-Id: Ibcbc4f993dcd2dd281ec19624107dddd994fd497 --- tools/releasetools/ota_from_target_files.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/releasetools/ota_from_target_files.py b/tools/releasetools/ota_from_target_files.py index c2fbb1d..66db227 100755 --- a/tools/releasetools/ota_from_target_files.py +++ b/tools/releasetools/ota_from_target_files.py @@ -1653,11 +1653,6 @@ def main(argv): common.Usage(__doc__) sys.exit(1) - if "ota_override_device" in OPTIONS.info_dict: - OPTIONS.override_device = OPTIONS.info_dict.get("ota_override_device") - if "ota_override_prop" in OPTIONS.info_dict: - OPTIONS.override_prop = OPTIONS.info_dict.get("ota_override_prop") == "true" - if OPTIONS.extra_script is not None: OPTIONS.extra_script = open(OPTIONS.extra_script).read() @@ -1667,6 +1662,11 @@ def main(argv): OPTIONS.target_tmp = OPTIONS.input_tmp OPTIONS.info_dict = common.LoadInfoDict(input_zip) + if "ota_override_device" in OPTIONS.info_dict: + OPTIONS.override_device = OPTIONS.info_dict.get("ota_override_device") + if "ota_override_prop" in OPTIONS.info_dict: + OPTIONS.override_prop = OPTIONS.info_dict.get("ota_override_prop") == "true" + # If this image was originally labelled with SELinux contexts, make sure we # also apply the labels in our new image. During building, the "file_contexts" # is in the out/ directory tree, but for repacking from target-files.zip it's -- cgit v1.1