Extract common.UnzipToDir, invoke that from merge_target_files.py

This change adds another utility function to common.py: UnzipToDir, which is
generally useful. Refactor merge_target_files.py to use it, and also refactor
other uses in common.py to use it.

Test: ota_from_target_files.py, validate_target_files.py, test_common.py
Bug: 124464492
Change-Id: Ia571070bceb7d3c8002304836bdf688485bf0dd9
This commit is contained in:
Bill Peckham
2019-02-22 10:57:43 -08:00
parent dd4e2e59aa
commit 8ff3fbdd08
2 changed files with 33 additions and 23 deletions

View File

@@ -163,19 +163,13 @@ def extract_items(target_files, target_files_temp_dir, extract_item_list):
else:
filtered_extract_item_list.append(pattern)
# Extract the filtered_extract_item_list from target_files into
# target_files_temp_dir.
# Extract from target_files into target_files_temp_dir the
# filtered_extract_item_list.
# TODO(b/124464492): Extend common.UnzipTemp() to handle this use case.
command = [
'unzip',
'-n',
'-q',
'-d', target_files_temp_dir,
target_files
] + filtered_extract_item_list
common.RunAndWait(command, verbose=True)
common.UnzipToDir(
target_files,
target_files_temp_dir,
filtered_extract_item_list)
def process_ab_partitions_txt(