Skip to content

Commit 51397c0

Browse files
committed
Merge #20629: depends: Improve id string robustness
5200929 depends: Include GUIX_ENVIRONMENT in id string (Carl Dong) 4c7d418 depends: Improve id string robustness (Carl Dong) b3bdff4 build: Proper quoting for var printing targets (Carl Dong) Pull request description: ``` Environment variables and search paths can drastically effect the operation of build tools. Include these in our id string to mitigate against false cache hits. ``` Note to builders: This will invalidate all depends output caches in `BASE_CACHE` ACKs for top commit: laanwj: re-ACK 5200929 Tree-SHA512: e70c98da89cde90dc54bc3be89b925787cf94bbf246e27cc9345816b312073d78a02215448f731f21d8cf033c455234a2377ff1d66c00e1f3db69c9c9687d027
2 parents df8892d + 5200929 commit 51397c0

File tree

3 files changed

+24
-13
lines changed

3 files changed

+24
-13
lines changed

Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
# Pattern rule to print variables, e.g. make print-top_srcdir
66
print-%:
7-
@echo $* = $($*)
7+
@echo '$*' = '$($*)'
88

99
ACLOCAL_AMFLAGS = -I build-aux/m4
1010
SUBDIRS = src

depends/Makefile

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Pattern rule to print variables, e.g. make print-top_srcdir
44
print-%:
5-
@echo $* = $($*)
5+
@echo '$*' = '$($*)'
66

77
# When invoking a sub-make, keep only the command line variable definitions
88
# matching the pattern in the filter function.
@@ -112,19 +112,27 @@ include builders/$(build_os).mk
112112
include builders/default.mk
113113
include packages/packages.mk
114114

115+
full_env=$(shell printenv)
116+
115117
build_id_string:=$(BUILD_ID_SALT)
116-
build_id_string+=$(shell $(build_CC) --version 2>/dev/null)
117-
build_id_string+=$(shell $(build_AR) --version 2>/dev/null)
118-
build_id_string+=$(shell $(build_CXX) --version 2>/dev/null)
119-
build_id_string+=$(shell $(build_RANLIB) --version 2>/dev/null)
120-
build_id_string+=$(shell $(build_STRIP) --version 2>/dev/null)
118+
119+
# GCC only prints COLLECT_LTO_WRAPPER when invoked with just "-v", but we want
120+
# the information from "-v -E -" as well, so just include both.
121+
#
122+
# '3>&1 1>&2 2>&3 > /dev/null' is supposed to swap stdin and stdout and silence
123+
# stdin, since we only want the stderr output
124+
build_id_string+=$(shell $(build_CC) -v < /dev/null 3>&1 1>&2 2>&3 > /dev/null) $(shell $(build_CC) -v -E - < /dev/null 3>&1 1>&2 2>&3 > /dev/null)
125+
build_id_string+=$(shell $(build_AR) --version 2>/dev/null) $(filter AR_%,$(full_env)) ZERO_AR_DATE=$(ZERO_AR_DATE)
126+
build_id_string+=$(shell $(build_CXX) -v < /dev/null 3>&1 1>&2 2>&3 > /dev/null) $(shell $(build_CXX) -v -E - < /dev/null 3>&1 1>&2 2>&3 > /dev/null)
127+
build_id_string+=$(shell $(build_RANLIB) --version 2>/dev/null) $(filter RANLIB_%,$(full_env))
128+
build_id_string+=$(shell $(build_STRIP) --version 2>/dev/null) $(filter STRIP_%,$(full_env))
121129

122130
$(host_arch)_$(host_os)_id_string:=$(HOST_ID_SALT)
123-
$(host_arch)_$(host_os)_id_string+=$(shell $(host_CC) --version 2>/dev/null)
124-
$(host_arch)_$(host_os)_id_string+=$(shell $(host_AR) --version 2>/dev/null)
125-
$(host_arch)_$(host_os)_id_string+=$(shell $(host_CXX) --version 2>/dev/null)
126-
$(host_arch)_$(host_os)_id_string+=$(shell $(host_RANLIB) --version 2>/dev/null)
127-
$(host_arch)_$(host_os)_id_string+=$(shell $(host_STRIP) --version 2>/dev/null)
131+
$(host_arch)_$(host_os)_id_string+=$(shell $(host_CC) -v < /dev/null 3>&1 1>&2 2>&3 > /dev/null) $(shell $(host_CC) -v -E - < /dev/null 3>&1 1>&2 2>&3 > /dev/null)
132+
$(host_arch)_$(host_os)_id_string+=$(shell $(host_AR) --version 2>/dev/null) $(filter AR_%,$(full_env)) ZERO_AR_DATE=$(ZERO_AR_DATE)
133+
$(host_arch)_$(host_os)_id_string+=$(shell $(host_CXX) -v < /dev/null 3>&1 1>&2 2>&3 > /dev/null) $(shell $(host_CXX) -v -E - < /dev/null 3>&1 1>&2 2>&3 > /dev/null)
134+
$(host_arch)_$(host_os)_id_string+=$(shell $(host_RANLIB) --version 2>/dev/null) $(filter RANLIB_%,$(full_env))
135+
$(host_arch)_$(host_os)_id_string+=$(shell $(host_STRIP) --version 2>/dev/null) $(filter STRIP_%,$(full_env))
128136

129137
ifneq ($(strip $(FORCE_USE_SYSTEM_CLANG)),)
130138
# Make sure that cache is invalidated when switching between system and
@@ -133,6 +141,9 @@ build_id_string+=system_clang
133141
$(host_arch)_$(host_os)_id_string+=system_clang
134142
endif
135143

144+
build_id_string+=GUIX_ENVIRONMENT=$(GUIX_ENVIRONMENT)
145+
$(host_arch)_$(host_os)_id_string+=GUIX_ENVIRONMENT=$(GUIX_ENVIRONMENT)
146+
136147
qrencode_packages_$(NO_QR) = $(qrencode_packages)
137148

138149
qt_packages_$(NO_QT) = $(qt_packages) $(qt_$(host_os)_packages) $(qt_$(host_arch)_$(host_os)_packages) $(qrencode_packages_)

src/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
# Pattern rule to print variables, e.g. make print-top_srcdir
66
print-%:
7-
@echo $* = $($*)
7+
@echo '$*' = '$($*)'
88

99
DIST_SUBDIRS = secp256k1 univalue
1010

0 commit comments

Comments
 (0)