From c97a874e821e6b9d17f77fb1b349b5da0610449c Mon Sep 17 00:00:00 2001 From: tobtoht Date: Fri, 13 Oct 2023 18:19:33 +0200 Subject: [PATCH] depends: base build_id on guix environment --- contrib/depends/Makefile | 4 ++-- contrib/depends/gen_id | 37 +++++++---------------------------- contrib/guix/libexec/build.sh | 1 + 3 files changed, 10 insertions(+), 32 deletions(-) diff --git a/contrib/depends/Makefile b/contrib/depends/Makefile index 8a2e88b..51605ea 100644 --- a/contrib/depends/Makefile +++ b/contrib/depends/Makefile @@ -150,8 +150,8 @@ include packages/packages.mk # 2. Before including packages/*.mk (excluding packages/packages.mk), since # they rely on the build_id variables # -build_id:=$(shell env CC='$(build_CC)' C_STANDARD='$(C_STANDARD)' CXX='$(build_CXX)' CXX_STANDARD='$(CXX_STANDARD)' AR='$(build_AR)' RANLIB='$(build_RANLIB)' STRIP='$(build_STRIP)' SHA256SUM='$(build_SHA256SUM)' DEBUG='$(DEBUG)' ./gen_id '$(BUILD_ID_SALT)' 'GUIX_ENVIRONMENT=$(realpath $(GUIX_ENVIRONMENT))') -$(host_arch)_$(host_os)_id:=$(shell env CC='$(host_CC)' C_STANDARD='$(C_STANDARD)' CXX='$(host_CXX)' CXX_STANDARD='$(CXX_STANDARD)' AR='$(host_AR)' RANLIB='$(host_RANLIB)' STRIP='$(host_STRIP)' SHA256SUM='$(build_SHA256SUM)' DEBUG='$(DEBUG)' ./gen_id '$(HOST_ID_SALT)' 'GUIX_ENVIRONMENT=$(realpath $(GUIX_ENVIRONMENT))') +build_id:=$(shell env SHA256SUM='$(build_SHA256SUM)' DEBUG='$(DEBUG)' ./gen_id '$(BUILD_ID_SALT)' 'GUIX_ENVIRONMENT=$(realpath $(GUIX_ENVIRONMENT))') +$(host_arch)_$(host_os)_id:=$(shell env SHA256SUM='$(build_SHA256SUM)' DEBUG='$(DEBUG)' ./gen_id '$(HOST_ID_SALT)' 'GUIX_ENVIRONMENT=$(realpath $(GUIX_ENVIRONMENT))') ifneq ($(OUTDIR),) $(file >> $(OUTDIR)/build-hashes.txt,$(host_arch)_$(host_os)_id=$($(host_arch)_$(host_os)_id)) endif diff --git a/contrib/depends/gen_id b/contrib/depends/gen_id index 95743eb..6c13b3b 100755 --- a/contrib/depends/gen_id +++ b/contrib/depends/gen_id @@ -34,37 +34,14 @@ echo "$@" echo "END ID SALT" - # GCC only prints COLLECT_LTO_WRAPPER when invoked with just "-v", but we want - # the information from "-v -E -" as well, so just include both. - echo "BEGIN CC" - bash -c "${CC} -v" - bash -c "${CC} -v -E -xc -o /dev/null - < /dev/null" - bash -c "${CC} -v -E -xobjective-c -o /dev/null - < /dev/null" - echo "C_STANDARD=${C_STANDARD}" - echo "END CC" + echo "BEGIN /gnu/store" + bash -c "ls -1 /gnu/store | sort" + echo "END /gnu/store" - echo "BEGIN CXX" - bash -c "${CXX} -v" - bash -c "${CXX} -v -E -xc++ -o /dev/null - < /dev/null" - bash -c "${CXX} -v -E -xobjective-c++ -o /dev/null - < /dev/null" - echo "CXX_STANDARD=${CXX_STANDARD}" - echo "END CXX" - - echo "BEGIN AR" - bash -c "${AR} --version" - env | grep '^AR_' - echo "ZERO_AR_DATE=${ZERO_AR_DATE}" - echo "END AR" - - echo "BEGIN RANLIB" - bash -c "${RANLIB} --version" - env | grep '^RANLIB_' - echo "END RANLIB" - - echo "BEGIN STRIP" - bash -c "${STRIP} --version" - env | grep '^STRIP_' - echo "END STRIP" + # LINES=\|COLUMNS=\|\|HOSTTYPE=\|OSTYPE=\|MACHTYPE=\|HOSTNAME= + echo "BEGIN environment" + bash -c "printenv | sort | grep -v '^\(BASE_CACHE=\|DISTNAME=\|DISTSRC=\|OUTDIR=\|SOURCES_PATH=\|JOBS=\)'" + echo "END environment" echo "END ALL" ) | if [ -n "$DEBUG_GENID" ] && command -v tee > /dev/null 2>&1; then diff --git a/contrib/guix/libexec/build.sh b/contrib/guix/libexec/build.sh index fa53f31..b9e87e1 100755 --- a/contrib/guix/libexec/build.sh +++ b/contrib/guix/libexec/build.sh @@ -7,6 +7,7 @@ export LC_ALL=C set -e -o pipefail export TZ=UTC export DEBUG_GENID=1 +export HOSTNAME=host # shellcheck source=contrib/shell/git-utils.bash source contrib/shell/git-utils.bash