Reland "Fix retrofit OTA generation failures"

This reverts commit 681597df18.

retrofit OTA generation relies on files in OTA/* , include these
files when copying target_files dir to tmp location.

Test: th
Bug: 337043530
Fixes: 337043530

Change-Id: Id9bb1cddcf992556923a17fd3f9b5e41eac7ca96
This commit is contained in:
Kelvin Zhang
2024-05-08 22:39:19 +00:00
parent a2357e90d7
commit 13f0b68a8f

View File

@@ -1111,9 +1111,10 @@ def CopyTargetFilesDir(input_dir):
relative_path = path.removeprefix(input_dir).removeprefix("/")
if not Fnmatch(relative_path, UNZIP_PATTERN):
continue
if filename.endswith(".prop") or filename == "prop.default" or "/etc/vintf/" in relative_path:
target_path = os.path.join(
output_dir, relative_path)
os.makedirs(os.path.dirname(target_path), exist_ok=True)
shutil.copy(path, target_path)
target_path = os.path.join(
output_dir, relative_path)
if os.path.exists(target_path):
continue
os.makedirs(os.path.dirname(target_path), exist_ok=True)
shutil.copy(path, target_path)
return output_dir