diff options
author | Vinh Tran <vinhdaitran@google.com> | 2023-03-08 10:14:55 -0500 |
---|---|---|
committer | Vinh Tran <vinhdaitran@google.com> | 2023-03-08 19:12:18 -0500 |
commit | 07fbb6f8d4f2e672b7fd10cb795c1e7be01813d6 (patch) | |
tree | 63bcc0e03f1bb11f1e93ab49bba81c42a4d83b96 /rules/staging_dir_builder.py | |
parent | ac62362c8180259b48fc6611bc5ad894828e268e (diff) | |
download | bazel-07fbb6f8d4f2e672b7fd10cb795c1e7be01813d6.tar.gz |
Fix staging_dir_builder to also copy files' permission mode
When building staging_dir, the script used shutil.copyfile which only copy the file data. This makes Soong script like build/soong/scripts/gen_ndk_usedby_apex.sh not being able to find the executable artifacts.
Using shutil.copy ensures the permission mode is copied over to the destination.
Test: With this fix, diff in using.txt is reduced to just 1 line (ceilf@LIBC)
Bug: 272004164
Change-Id: I2ed93a24245f363d1ebf05335528d68a35e21106
Diffstat (limited to 'rules/staging_dir_builder.py')
-rw-r--r-- | rules/staging_dir_builder.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/rules/staging_dir_builder.py b/rules/staging_dir_builder.py index a5bcee9e..dea82bf2 100644 --- a/rules/staging_dir_builder.py +++ b/rules/staging_dir_builder.py @@ -98,7 +98,10 @@ def build_staging_dir(file_mapping_path, staging_dir_path, command_argv): path_in_bazel = os.readlink(path_in_bazel) os.makedirs(os.path.dirname(path_in_staging_dir), exist_ok=True) - shutil.copyfile(path_in_bazel, path_in_staging_dir, follow_symlinks=False) + # shutil.copy copies the file data and the file's permission mode + # file's permission mode is helpful for tools, such as build/soong/scripts/gen_ndk_usedby_apex.sh, + # that rely on the permission mode of the artifacts + shutil.copy(path_in_bazel, path_in_staging_dir, follow_symlinks=False) result = subprocess.run(command_argv) |