diff options
author | Steve Kondik <shade@chemlab.org> | 2010-04-21 11:39:48 -0400 |
---|---|---|
committer | alk3pInjection <webmaster@raspii.tech> | 2022-01-12 09:10:05 +0800 |
commit | f877f8f3e9213c54bd5e59239bddeb7a1f024da1 (patch) | |
tree | 6c3012d98df18c33987bb1f5a4ea8d3b2117ac45 | |
parent | b9e8872ebd46fb6887005ce439c4b8cfca7de1d4 (diff) |
Allow override of device asserts, including multi-device support
Set in board file with TARGET_OTA_ASSERT_DEVICE.
ota_from_target_files: Remove device dependent arguments.
These device-specific arguments are defined at build time and are
necessary to generate the zip correctly. Don't use command line
arguments to specify them, but write all the needed information
in misc_info.txt when the target-files zip is generated.
ota_from_target_files will then read misc_info.txt and set
everything automatically.
Change-Id: Ibdbca575b76eb07b53fccfcea52a351c7e333f91
-rw-r--r-- | core/Makefile | 3 | ||||
-rw-r--r-- | tools/releasetools/common.py | 2 | ||||
-rw-r--r-- | tools/releasetools/edify_generator.py | 12 |
3 files changed, 11 insertions, 6 deletions
diff --git a/core/Makefile b/core/Makefile index 14b2e3c745..e367eafb79 100644 --- a/core/Makefile +++ b/core/Makefile @@ -4690,6 +4690,9 @@ endif ifeq ($(TARGET_FLATTEN_APEX),false) $(hide) echo "target_flatten_apex=false" >> $@ endif +ifneq ($(TARGET_OTA_ASSERT_DEVICE),) + $(hide) echo "ota_override_device=$(TARGET_OTA_ASSERT_DEVICE)" >> $@ +endif .PHONY: misc_info misc_info: $(INSTALLED_MISC_INFO_TARGET) diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py index 745942b9ce..e0538fe74d 100644 --- a/tools/releasetools/common.py +++ b/tools/releasetools/common.py @@ -427,7 +427,7 @@ class BuildInfo(object): "system_other"] = self._partition_fingerprints["system"] # These two should be computed only after setting self._oem_props. - self._device = self.GetOemProperty("ro.product.device") + self._device = info_dict.get("ota_override_device", self.GetOemProperty("ro.product.device")) self._fingerprint = self.CalculateFingerprint() check_fingerprint(self._fingerprint) diff --git a/tools/releasetools/edify_generator.py b/tools/releasetools/edify_generator.py index 033c02e60c..f8247ee196 100644 --- a/tools/releasetools/edify_generator.py +++ b/tools/releasetools/edify_generator.py @@ -137,11 +137,13 @@ class EdifyGenerator(object): def AssertDevice(self, device): """Assert that the device identifier is the given string.""" - cmd = ('getprop("ro.product.device") == "%s" || ' - 'abort("E%d: This package is for \\"%s\\" devices; ' - 'this is a \\"" + getprop("ro.product.device") + "\\".");') % ( - device, common.ErrorCode.DEVICE_MISMATCH, device) - self.script.append(cmd) + cmd = ('assert(' + + ' || \0'.join(['getprop("ro.product.device") == "%s" || getprop("ro.build.product") == "%s"' + % (i, i) for i in device.split(",")]) + + ' || abort("E%d: This package is for device: %s; ' + + 'this device is " + getprop("ro.product.device") + ".");' + + ');') % (common.ErrorCode.DEVICE_MISMATCH, device) + self.script.append(self.WordWrap(cmd)) def AssertSomeBootloader(self, *bootloaders): """Asert that the bootloader version is one of *bootloaders.""" |