Add BUILD_USERNAME and BUILD_HOSTNAME
These replace $USER and `hostname`, which will soon become stable values
due to sandboxing the build on Linux.
Bug: 122270019
Test: check build.prop
Change-Id: I7493e45a2a2defbdba5d82596cb91d68480f0187
diff --git a/core/Makefile b/core/Makefile
index 179cf29..56b45df 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -317,7 +317,7 @@
# The string used to uniquely identify the combined build and product; used by the OTA server.
ifeq (,$(strip $(BUILD_FINGERPRINT)))
ifeq ($(strip $(HAS_BUILD_NUMBER)),false)
- BF_BUILD_NUMBER := $(USER)$$($(DATE_FROM_FILE) +%m%d%H%M)
+ BF_BUILD_NUMBER := $(BUILD_USERNAME)$$($(DATE_FROM_FILE) +%m%d%H%M)
else
BF_BUILD_NUMBER := $(file <$(BUILD_NUMBER_FILE))
endif
@@ -420,6 +420,8 @@
BUILD_ID="$(BUILD_ID)" \
BUILD_DISPLAY_ID="$(BUILD_DISPLAY_ID)" \
DATE="$(DATE_FROM_FILE)" \
+ BUILD_USERNAME="$(BUILD_USERNAME)" \
+ BUILD_HOSTNAME="$(BUILD_HOSTNAME)" \
BUILD_NUMBER="$(BUILD_NUMBER_FROM_FILE)" \
BOARD_BUILD_SYSTEM_ROOT_IMAGE="$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)" \
AB_OTA_UPDATER="$(AB_OTA_UPDATER)" \
diff --git a/core/main.mk b/core/main.mk
index 9fd1c35..4f81c21 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -80,7 +80,7 @@
ifeq ($(strip $(HAS_BUILD_NUMBER)),false)
# BUILD_NUMBER has a timestamp in it, which means that
# it will change every time. Pick a stable value.
- FILE_NAME_TAG := eng.$(USER)
+ FILE_NAME_TAG := eng.$(BUILD_USERNAME)
else
FILE_NAME_TAG := $(file <$(BUILD_NUMBER_FILE))
endif
diff --git a/core/version_defaults.mk b/core/version_defaults.mk
index 0fd40db..c4f9a52 100644
--- a/core/version_defaults.mk
+++ b/core/version_defaults.mk
@@ -314,7 +314,7 @@
# If no BUILD_NUMBER is set, create a useful "I am an engineering build
# from this date/time" value. Make it start with a non-digit so that
# anyone trying to parse it as an integer will probably get "0".
- BUILD_NUMBER := eng.$(shell echo $${USER:0:6}).$(shell $(DATE) +%Y%m%d.%H%M%S)
+ BUILD_NUMBER := eng.$(shell echo $${BUILD_USERNAME:0:6}).$(shell $(DATE) +%Y%m%d.%H%M%S)
HAS_BUILD_NUMBER := false
endif
.KATI_READONLY := BUILD_NUMBER HAS_BUILD_NUMBER
diff --git a/tools/buildinfo.sh b/tools/buildinfo.sh
index b76c089..7286f95 100755
--- a/tools/buildinfo.sh
+++ b/tools/buildinfo.sh
@@ -18,8 +18,8 @@
echo "ro.build.date=`$DATE`"
echo "ro.build.date.utc=`$DATE +%s`"
echo "ro.build.type=$TARGET_BUILD_TYPE"
-echo "ro.build.user=$USER"
-echo "ro.build.host=`hostname`"
+echo "ro.build.user=$BUILD_USERNAME"
+echo "ro.build.host=$BUILD_HOSTNAME"
echo "ro.build.tags=$BUILD_VERSION_TAGS"
echo "ro.build.flavor=$TARGET_BUILD_FLAVOR"
if [ -n "$BOARD_BUILD_SYSTEM_ROOT_IMAGE" ] ; then