Normalize filepath comment for gen files in build.prop
build.prop contains a `# from $filepath` comment to log the origin of a
sysprop. This is useful to have, but causes the metadata of
vendor/build.prop to be different between make and soong built
partitions. This CL replaces the absolute filepath of generated files
with their filenames in the build.prop comment.
Bug: 382295862
Test: commented out notice files in build/make/core/Makefile
Test: lunch aosp_cf_x86_64_phone-trunk_staging-userdebug
Test: export BUILD_DATETIME=10
Test: verified that vendor.img built by make and soong have the same
sha
Change-Id: Ib0caad5fa0171c39317646e49372a69534a42af0
diff --git a/fsgen/filesystem_creator.go b/fsgen/filesystem_creator.go
index 765b28f..4f1a34f 100644
--- a/fsgen/filesystem_creator.go
+++ b/fsgen/filesystem_creator.go
@@ -573,9 +573,11 @@
Name *string
Board_info_files []string
Bootloader_board_name *string
+ Stem *string
}{
- Name: proptools.StringPtr(generatedModuleName(ctx.Config(), "android-info.prop")),
+ Name: proptools.StringPtr(generatedModuleName(ctx.Config(), "android_info.prop")),
Board_info_files: partitionVars.BoardInfoFiles,
+ Stem: proptools.StringPtr("android_info.txt"),
}
if len(androidInfoProps.Board_info_files) == 0 {
androidInfoProps.Bootloader_board_name = proptools.StringPtr(partitionVars.BootLoaderBoardName)
diff --git a/scripts/gen_build_prop.py b/scripts/gen_build_prop.py
index 47bbf59..430e613 100644
--- a/scripts/gen_build_prop.py
+++ b/scripts/gen_build_prop.py
@@ -108,7 +108,7 @@
def generate_common_build_props(args):
print("####################################")
- print("# from generate_common_build_props")
+ print("# from generate-common-build-props")
print("# These properties identify this partition image.")
print("####################################")
@@ -243,9 +243,15 @@
print(f"# end build properties")
def write_properties_from_file(file):
+ # Make and Soong use different intermediate files to build vendor/build.prop.
+ # Although the sysprop contents are same, the absolute paths of these
+ # intermediate files are different.
+ # Print the filename for the intermediate files (files in OUT_DIR).
+ # This helps with validating mk->soong migration of android partitions.
+ filename = os.path.basename(file.name) if file.name.startswith(os.environ.get("OUT_DIR")) else file.name
print()
print("####################################")
- print(f"# from {file.name}")
+ print(f"# from {filename}")
print("####################################")
print(file.read(), end="")