releasetools: Handle two edge cases in FinalizeMetadata().
In FinalizeMetadata and PropertyFiles, we need to reserve space between the calls to Compute() and Finalize(). We used to put a 10-byte placeholder, in the hope of covering the 'offset:length' space for the metadata entry, as well as the possible value changes in other entries. However, this could fail in two possible cases: (a) metadata entry itself has a large offset (e.g. staying near the end of a 1-GiB package, where the offset itself has 10-digit); or (b) the offsets for other entries change substantially due to entry reordering. Note that for case (b), it's space inefficient to always reserve 15-byte for _each_ token in the property-files. This CL handles both of these two cases. For (a), we bump up the 10-byte to 15-byte, which is large enough to cover a package size up to 10-digit number (i.e. ~9GiB) with a metadata entry size of 4-digit. All these 15-byte will be used for the metadata token alone. For (b), we add a fallback flow that would retry one more time, but based on the already signed package that has entries in desired order. Bug: 74210298 Test: python -m unittest test_ota_from_target_files Test: Generate aosp-bullhead full OTA with '--no_signing' flag. Change-Id: If20487602d2ad09b3797465c01972f2fa792a1f1
Loading
Please register or sign in to comment