Merge "Use symlinks instead of hard links" into main am: 3d0567ca4c

Original change: https://android-review.googlesource.com/c/platform/build/+/2760171

Change-Id: I5c4a45a77cda0b96b10b64f0d53446e83f7d7eae
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot
2023-09-26 00:31:32 +00:00
committed by Automerger Merge Worker

View File

@@ -755,12 +755,10 @@ def ExtractTargetFiles(path: str):
def LocatePartitionPath(target_files_dir: str, partition: str, allow_empty):
path = os.path.join(target_files_dir, "RADIO", partition + ".img")
if os.path.exists(path):
return path
path = os.path.join(target_files_dir, "IMAGES", partition + ".img")
if os.path.exists(path):
return path
for subdir in TARGET_FILES_IMAGES_SUBDIR:
path = os.path.join(target_files_dir, subdir, partition + ".img")
if os.path.exists(path):
return path
if allow_empty:
return ""
raise common.ExternalError(
@@ -773,12 +771,10 @@ def GetPartitionImages(target_files_dir: str, ab_partitions, allow_empty=True):
def LocatePartitionMap(target_files_dir: str, partition: str):
path = os.path.join(target_files_dir, "RADIO", partition + ".map")
if os.path.exists(path):
return path
path = os.path.join(target_files_dir, "IMAGES", partition + ".map")
if os.path.exists(path):
return path
for subdir in TARGET_FILES_IMAGES_SUBDIR:
path = os.path.join(target_files_dir, subdir, partition + ".map")
if os.path.exists(path):
return path
return ""
@@ -1061,7 +1057,7 @@ def CopyTargetFilesDir(input_dir):
if common.IsSparseImage(src):
return common.UnsparseImage(src, dst)
else:
return os.link(src, dst)
return os.symlink(os.path.realpath(src), dst)
for subdir in TARGET_FILES_IMAGES_SUBDIR:
if not os.path.exists(os.path.join(input_dir, subdir)):