From b4adc067325ec7d94097dae55e49d5c7cbe2d605 Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Wed, 22 Aug 2018 18:27:14 -0700 Subject: [PATCH] releasetools: Look for recovery.fstab at both locations. The change in [1] moved the recovery etc files from /etc to /system/etc. However, we may use the latest OTA tools to build incremental OTAs for old target_files zips. This CL adds a workaround to look at both of the old and new locations. [1] commit 696bb33676f0cabcfa64ccec2536d1ff45e1d218 Bug: 113073663 Test: Build a previously failing incremental OTA for taimen. Change-Id: Ie07aa1713e616d523838b1260a992b20f5a11612 --- tools/releasetools/common.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py index e5438572b..38c73fd6e 100644 --- a/tools/releasetools/common.py +++ b/tools/releasetools/common.py @@ -240,12 +240,28 @@ def LoadInfoDict(input_file, input_dir=None): system_root_image = d.get("system_root_image") == "true" if d.get("no_recovery") != "true": recovery_fstab_path = "RECOVERY/RAMDISK/system/etc/recovery.fstab" + if isinstance(input_file, zipfile.ZipFile): + if recovery_fstab_path not in input_file.namelist(): + recovery_fstab_path = "RECOVERY/RAMDISK/etc/recovery.fstab" + else: + path = os.path.join(input_file, *recovery_fstab_path.split("/")) + if not os.path.exists(path): + recovery_fstab_path = "RECOVERY/RAMDISK/etc/recovery.fstab" d["fstab"] = LoadRecoveryFSTab( read_helper, d["fstab_version"], recovery_fstab_path, system_root_image) + elif d.get("recovery_as_boot") == "true": recovery_fstab_path = "BOOT/RAMDISK/system/etc/recovery.fstab" + if isinstance(input_file, zipfile.ZipFile): + if recovery_fstab_path not in input_file.namelist(): + recovery_fstab_path = "BOOT/RAMDISK/etc/recovery.fstab" + else: + path = os.path.join(input_file, *recovery_fstab_path.split("/")) + if not os.path.exists(path): + recovery_fstab_path = "BOOT/RAMDISK/etc/recovery.fstab" d["fstab"] = LoadRecoveryFSTab( read_helper, d["fstab_version"], recovery_fstab_path, system_root_image) + else: d["fstab"] = None