Skip to content

releasetools: Support ZipFile/zip-path input in PartitionMapFromTargetFiles - #4

Open
pcgooroo wants to merge 1083 commits into
Evolution-X:cnbfrom
pcgooroo:partitionmap-targetfiles-zip
Open

pcgooroo wants to merge 1083 commits into
Evolution-X:cnbfrom
pcgooroo:partitionmap-targetfiles-zip

Conversation

@pcgooroo

Copy link
Copy Markdown

PartitionBuildProps._ReadPartitionPropFile passes the polymorphic input_file, which may be an open ZipFile, a path to a target-files zip, or an extracted directory. PartitionMapFromTargetFiles only handled the directory case, calling os.path.join()/os.path.exists() directly on it, which raises:

TypeError: expected str, bytes or os.PathLike object, not ZipFile

when called against a zip (or an open ZipFile).

This handles all three input kinds the same way this file's sibling functions (ExtractFromInputFile, WriteBytesToInputFile, etc.) already do, by checking whether target_files_dir is a ZipFile, a path to a zip, or a plain directory before deciding how to test for a partition subdir's existence.

Tested against a real target-files zip on a OnePlus 13 (dodge) build where this call previously threw the TypeError above.

Gérard Parat and others added 30 commits August 11, 2025 14:23
It seems like switching from minigzip to toybox gzip (bug: 288169261)
makes imgdiff fail in in this way:
* W imgdiff : imgdiff.cpp:1435 Failed to reconstruct target deflate chunk 3 []; treating as normal
* E imgdiff : imgdiff.cpp:1390 Failed to set bonus data

Test: Sign non-AB target files package
Change-Id: I29f1d8f1168347141d80860e8ed02e19b0031447
Change-Id: Ib5c9f2f0fa90fd921d8f61b74364a20aaecb842e
This reverts commit 31f6e08.

Reason: Sphynx still uses this.
Change-Id: I01021415466cc1434994901205880c59fa9aa395
Snap for 13914092 from ab292f7 to 25Q4-release

Change-Id: Iaa26a89387c28d7785af444cd9c0e942ffa33121
Snap for 13921250 from 5059459 to 25Q4-release

Change-Id: Ic93f92fac988c802a0a8ba110a757d2682f8072d
Change-Id: I75b6d82dd61aab7eff8a0e12a15578e75c381fd2
Change-Id: Iaa23e91c3edfec36e0c14ebc75e66fd45f8c0f8f
…7900030016405495 into 25Q4-release.

COASTGUARD_SKIP: Iaa23e91c3edfec36e0c14ebc75e66fd45f8c0f8f

Change-Id: Ic23a4f179dcd3492127d271f821673ac3a0f0adf
identifies that the apexd has a fix included for go/mainline-play-installs-incident

Bug: 433787201
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:a89e1ec183c96413380b5e2db37581b7031d04ea)
Merging the fixes for apexd outage to security branches.
Bug: 433787201
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:de6947a70e8aaa521f9bcb4718eb53f7161d7bfc)
Merged-In: I7bbd5c9db0144b2ceba0902819e19ce7e56e2985
Change-Id: I7bbd5c9db0144b2ceba0902819e19ce7e56e2985
Change-Id: Ibe37093be4335bbf523d6f7f6ac3f6c3eb4438de
Snap for 13928948 from 20c6acd to 25Q4-release

Change-Id: Ic0aff237d5fa5f2c1ebf44018961b800b30ce1ff
Snap for 13937020 from ae1f38f to 25Q4-release

Change-Id: Ibddae56391ee0f025557b39902c23684bdacbb28
Change-Id: I264150134df3d8bc2382252ec189a148041e7714
Change-Id: Ia969cc535afa916049e844d76050174e192e9081
…3900030016618368 into 25Q4-release.

COASTGUARD_SKIP: Ia969cc535afa916049e844d76050174e192e9081

Change-Id: I0fb3fdebe0ad76a8f10ed320d6b8759891192588
Change-Id: I85562e0ceeba2a4fe344b671de8f39249d7f2604
…0300030016625070 into 25Q4-release.

COASTGUARD_SKIP: I85562e0ceeba2a4fe344b671de8f39249d7f2604

Change-Id: Ic3cd084d73a2ad6b56c7d4fcfb7ec7ca21cd5688
Change-Id: I0dc82a3aa2a7587c4ea21bdba0b07c6529fdbf70
…1500030016643925 into 25Q4-release.

COASTGUARD_SKIP: I0dc82a3aa2a7587c4ea21bdba0b07c6529fdbf70

Change-Id: I48306140e1e6aaf612100de685c8222ec692ccee
Snap for 13943966 from 62ad5db to 25Q4-release

Change-Id: I680e08e47ee50fc19aa1c06e944c6766a3ecd4e9
Snap for 13945711 from 381606e to 25Q4-release

Change-Id: Ie946c9e970dacd3d67eeb2b441adcab359bf2ecc
Snap for 13946792 from 381606e to 25Q4-release

Change-Id: I6fadd816d42b35203f434fa43c21bd8e7344ed14
Change-Id: If6aae81baebe35fb7c96545410bd59e56186de69
…3600030016595138 into 25Q4-release.

COASTGUARD_SKIP: If6aae81baebe35fb7c96545410bd59e56186de69

Change-Id: I8f1b327d91e28d8b5a245f262b4d3b93ba7997f0
Snap for 13952233 from 39bea1a to 25Q4-release

Change-Id: I4e129d6fe1f7ecc6898924353b5073dcc2829de3
Change-Id: Ifcbf724a26b6f968c5325771ee8a74d4ce3daba0
Snap for 13959326 from de015dd to 25Q4-release

Change-Id: I97269edf3ce1b25f5c6089d1dea17663d2c442cb
Change-Id: I3717820be4f40e74c2361dffff3f4c0103c72d70
Snap for 13967044 from 1b3794a to 25Q4-release

Change-Id: I5c3de20f2e85e1624e18decddb62c22794c1218d
Change-Id: Ieceddf7d63d693a5f3dc97efd4755f9e5c1fa740
johnmart19 and others added 30 commits August 8, 2026 12:10
Signed-off-by: minaripenguin <minaripenguin@users.noreply.github.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Change-Id: I36fe03fb9e26622a4b47ca011a25c02c6ab56c56
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Full OTA non-A/B zip size comparison:
deflate+brotli 1147136486 bytes
deflate only   1205705974 bytes

The difference is just 5% (56 MB), which is an acceptable
tradeoff for faster flashing.

This change doesn't affect A/B OTA generation.

Change-Id: I332765ea0a2fbedb1a075192460b2bf8cb8955ae
To avoid the resources bug when dirty flashing

Signed-off-by: saikiran2001 <bjsaikiran@gmail.com>
Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
Signed-off-by: Dmitrii <bankersenator@gmail.com>
Change-Id: Iebfb63569fd627f0da32d68f21863ab852af3081
Signed-off-by: rmp22 <195054967+rmp22@users.noreply.github.com>
Fixes roomservice for automated tree fetching

Signed-off-by: Aidan Warner <aidan@awarner.co.uk>
Change-Id: I89a64cd561d9915a8ef99d2aff6d8a2b22aedc46
Some vendors override build id in odm or vendor, such as oplus.

Change-Id: I1c2de43ba7c3544710897ad9127d320dd02293fe
We don't want this ancient search box from Android 2.x.

Change-Id: Iaaf4623971d58e6eab6125a07a05f4c36c60fe79
Change-Id: I577a7b13320b2e26e4c624c3d739456070f9fecc
Change-Id: I64daac3c0ba5511dea6fb9abcb204d679fe01bef
Just like erofs, we should used the compressed image's size to calculate
partition size, not the input directory's size.

Change-Id: I46d6dfa59cd7e8a02c349f026b1fd10be3fec587
The file was missed when moving recovery resources, but the assertion
path was changed, as a result non-Treble devices failed to build.

Fixes: Ia4045bd67ffb3d899efa8d20dab4c4299b87ee5f
Change-Id: Ib7822a9bd5b1a2ab7e762e9fb35dbb22291a3a76
Change-Id: I05c0155e6331bfeccd4ad545e003fa3fa3498044
Currently, an extra '/vendor' is appended in target_files_dir of
make_recovery_patch.py, which will yield an erroneous path when
attempting to build full recovery image on vendorimage-leas devices:

SYSTEM/vendor/vendor/etc/recovery.img

This patch adds checks for whether the target builds vendor image
in MakeRecoveryPatch(). This ensures no recovery image will be
generated with prebuilt vendor.

Signed-off-by: Ricky Cheung <rcheung844@gmail.com>
Change-Id: I2dc6e43537deb606dd01fb090add2595502055c1
* Before this commit, the generated `dynamic_partitions_op_list` in
  FullOTA packages always tries to remove all partitions and recreate
  them upon flashing. This makes it impossible to have a system-only
  "FullOTA" because vendor partition(s) are always removed.

* This commit detects if a build is vendor-less and disables every
  dynamic partition operation except `resize`, in order to keep the
  original content around after the flash. The change should not affect
  non-dynamic-partition or builds with vendor image included.

Change-Id: I0cded7f3b2958f35103d73d19b7fb5f292f6c17f
Signed-off-by: Jesse Chan <jc@lineageos.org>
…w header lib

This is a combination of 3 commits.
This is the 1st commit message:

build: add kernel header dependency if module uses kernel headers

Many of the QCOM components use kernel headers, but don't declare
the dependency on them.  This is fine in CAF because of the way they
build the boot.img before anything else.  In CM, we don't build the
boot.img the same, so we run into a race between the kernel build &
these modules... and the modules lose.

Warn about modules that have this missing dependency, and add it for
them so we don't have to modify each Android.mk.

Change-Id: I95f1e47b5ef440f6f5d8f64a0c3f38d9572e839e

============================================================================
This is the commit message Evolution-X#2:

build: Switch kernel header inclusion

The build is switching to the target INSTALLED_KERNEL_HEADERS to
declare dependencies on kernel headers.

Change-Id: I913e74681b02dfcf1eaed3d1e47ff4ab2300b12d

============================================================================
This is the commit message Evolution-X#3:

build: Automatically replace old-style kernel header includes with new header lib

Since we do this via soong and the result is a header library, just replace all
legacy include paths that point to the old header location with calls to the new
header library. Since we no longer have the legacy include, we can also remove
the additional dependency.

This reverts commit fa798218e5b7f96e12ab3acc9d47a3f26a140777.

Change-Id: I716955534e50831e6568ca01e480aa8b90075d92
Change-Id: I71b891928a13771c176adc0eaa79b46503cb176f
Change-Id: I54a969d63f9644f89a231d52f2ef0919edd5b784
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
This fixes an occasional issue where the navbar is in a broken state
(gesture nav works, but the bar is rendered as if it's 2/3-button nav)
after wiping data or provisioning new users.

From Danny Lin <danny@kdrag0n.dev> in ProtonAOSP.
* Inspired by f24e159b08f879038021de26e2c87d4b3e59420c
* This should fix users that faced weird UI glitches after dirty flash

Signed-off-by: clarencelol <clarencekuiek@proton.me>
Signed-off-by: HDzungx <hdzungx@gmail.com>
Signed-off-by: Mrick343 <mrinmoy8429de@gmail.com>
For backwards compatibility

Change-Id: I6f90f1be5d57c94bb9ea3ebe4c192d728e88c024
Signed-off-by: Saikrishna1504 <saikrishna26918@gmail.com>
[`Issue`]
With If4e77019427793b5c1f3dec9fc938ac3e3270c26 some system properties
were moved to product partition. As a result building OTA package fails
due to unresolvable build props.

```
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/mnt/out/host/linux-x86/bin/ota_from_target_files/__main__.py", line 52, in <module>
  File "/mnt/out/host/linux-x86/bin/ota_from_target_files/__main__.py", line 46, in _soong_main
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "ota_from_target_files.py", line 1541, in <module>
  File "ota_from_target_files.py", line 1518, in main
  File "non_ab_ota.py", line 660, in GenerateNonAbOtaPackage
  File "non_ab_ota.py", line 232, in WriteFullOTAPackage
  File "common.py", line 565, in GetBuildProp
  File "common.py", line 602, in _ResolveRoProductBuildProp
common.ExternalError: couldn't resolve ro.crdroid.build.version
```

[`Explanation`]
The existing implementation of `ota_from_target_files` scans for
partition build props strictly in paths:
- `$(PRODUCT_OUT)/{partname}/build.prop`
  (`PRODUCT_OUT = out/target/product/{product_name}`)
- `$(PRODUCT_OUT)/{partname}/etc/build.prop`

But the legacy devices launched before Android 11 have separate
partitions only for system (`$(PRODUCT_OUT)/system`) and vendor
(`$(PRODUCT_OUT)/vendor`), but not for product (`$(PRODUCT_OUT)/product`)
or system_ext (`$(PRODUCT_OUT)/system_ext`) unless dynamic partitioning
is implemented. So, their `TARGET_COPY_OUT_*` aren't relative to the
staging directory, i.e., `$(PRODUCT_OUT)`, instead, they are all coupled
with the system partition, and the partition target files will be
located under `$(PRODUCT_OUT)/system/{partname}` rather then
`$(PRODUCT_OUT)/{partname}`.

[`Fix`]
To cover all possible partition name variations and locations, use the
already existing `PartitionMapFromTargetFiles()` helper function to
dynamically determine the correct path for each partition, so that
`ota_from_target_files` resolves build.prop files using
`$(PRODUCT_OUT)/system/product` as a base path instead of
`$(PRODUCT_OUT)/product` when appropriate.

Signed-off-by: iusmac <iusico.maxim@libero.it>
Signed-off-by: Ghosuto <clash.raja10@gmail.com>
Change-Id: Ic1cd50db6a194193b844773d8972955010cd4894
Signed-off-by: rmp22 <195054967+rmp22@users.noreply.github.com>
Signed-off-by: Dmitrii <bankersenator@gmail.com>
… exists

Signed-off-by: MT6897A <tomilindanya@mail.ru>
…tFiles

PartitionBuildProps._ReadPartitionPropFile passes the polymorphic
input_file, which may be an open ZipFile, a path to a target-files
zip, or an extracted directory. PartitionMapFromTargetFiles only
handled the directory case, calling os.path.join()/os.path.exists()
directly on it and raising:

  TypeError: expected str, bytes or os.PathLike object, not ZipFile

when called against a zip. Handle all three input kinds the same
way the rest of this file's sibling functions (ExtractFromInputFile,
WriteBytesToInputFile, etc.) already do.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.