Build vendor images first when rebuilding with vendor_otatools.

Only supports rebuilding vendor.img and odm.img currently.

This allows "other" images (e.g. vbmeta, super_empty, ...) to
be rebuilt using the latest tooling.

Bug: 188491126
Bug: 192422274
Test: Sign a GRF R+S merged target_files package using:
      sign_target_files_apks \
        --vendor_otatools=<otatools.zip from R> \
	--vendor_partitions=vendor,odm \
	merged-target_files.zip \
	signed-target_files.zip
Change-Id: Ib93aea9f083ee9b722c31a42dcc780b5222053b8
This commit is contained in:
Daniel Norman
2021-09-14 10:29:38 -07:00
parent d9c6d5fc91
commit 78554ea568
3 changed files with 100 additions and 47 deletions

View File

@@ -1925,14 +1925,14 @@ def UnzipToDir(filename, dirname, patterns=None):
RunAndCheckOutput(cmd)
def UnzipTemp(filename, pattern=None):
def UnzipTemp(filename, patterns=None):
"""Unzips the given archive into a temporary directory and returns the name.
Args:
filename: If filename is of the form "foo.zip+bar.zip", unzip foo.zip into
a temp dir, then unzip bar.zip into that_dir/BOOTABLE_IMAGES.
pattern: Files to unzip from the archive. If omitted, will unzip the entire
patterns: Files to unzip from the archive. If omitted, will unzip the entire
archvie.
Returns:
@@ -1942,11 +1942,11 @@ def UnzipTemp(filename, pattern=None):
tmp = MakeTempDir(prefix="targetfiles-")
m = re.match(r"^(.*[.]zip)\+(.*[.]zip)$", filename, re.IGNORECASE)
if m:
UnzipToDir(m.group(1), tmp, pattern)
UnzipToDir(m.group(2), os.path.join(tmp, "BOOTABLE_IMAGES"), pattern)
UnzipToDir(m.group(1), tmp, patterns)
UnzipToDir(m.group(2), os.path.join(tmp, "BOOTABLE_IMAGES"), patterns)
filename = m.group(1)
else:
UnzipToDir(filename, tmp, pattern)
UnzipToDir(filename, tmp, patterns)
return tmp