Export BOARD_AVB_<image>_ADD_HASHTREE_FOOTER_ARGS to soong
For use in the soong-generated partition images.
Also only update the build fingerprint file if its contents have
actually changed, as we're adding a dependency on it in soong code
and it causes files to be rebuilt every build without this change.
In make, there is no dependency added, because the file that uses it
is in a folder that's expected to be cleared every build with
`m installclean`. But in soong, the file that uses it is in
out/soong/.intermediates, so it actually needs that dependency to be
rebuilt.
Bug: 381120092
Test: m out/soong/.intermediates/build/soong/fsgen/aosp_cf_x86_64_phone_generated_system_image/android_common/prop, diff with make's prop file
Change-Id: I06917c895414bacc71ff06e92afff6d722dc9055
diff --git a/core/sysprop.mk b/core/sysprop.mk
index 255b699..e5f1267 100644
--- a/core/sysprop.mk
+++ b/core/sysprop.mk
@@ -183,7 +183,7 @@
endif
BUILD_FINGERPRINT_FILE := $(PRODUCT_OUT)/build_fingerprint.txt
-ifneq (,$(shell mkdir -p $(PRODUCT_OUT) && echo $(BUILD_FINGERPRINT) >$(BUILD_FINGERPRINT_FILE) && grep " " $(BUILD_FINGERPRINT_FILE)))
+ifneq (,$(shell mkdir -p $(PRODUCT_OUT) && echo $(BUILD_FINGERPRINT) >$(BUILD_FINGERPRINT_FILE).tmp && (if ! cmp -s $(BUILD_FINGERPRINT_FILE).tmp $(BUILD_FINGERPRINT_FILE); then mv $(BUILD_FINGERPRINT_FILE).tmp $(BUILD_FINGERPRINT_FILE); else rm $(BUILD_FINGERPRINT_FILE).tmp; fi) && grep " " $(BUILD_FINGERPRINT_FILE)))
$(error BUILD_FINGERPRINT cannot contain spaces: "$(file <$(BUILD_FINGERPRINT_FILE))")
endif
BUILD_FINGERPRINT_FROM_FILE := $$(cat $(BUILD_FINGERPRINT_FILE))