Gentoo Archives: gentoo-dev

From: Matthew Smith <matthew@g.o>
To: gentoo-dev@l.g.o
Cc: Matthew Smith <matthew@g.o>
Subject: [gentoo-dev] [PATCH 4/4] waf-utils.eclass: set PYTHONHASHSEED environment variable
Date: Sat, 19 Nov 2022 09:26:08
Message-Id: 20221119092358.280588-5-matthew@gentoo.org
In Reply to: [gentoo-dev] [PATCH 0/4] waf-utils.eclass: various improvements by Matthew Smith
1 waf relies on Python set order, so let's make it consistent to avoid
2 brittle builds.
3
4 Added into existing phase functions instead of pkg_setup to retain
5 compatibility with existing ebuilds.
6
7 Signed-off-by: Matthew Smith <matthew@g.o>
8 ---
9 eclass/waf-utils.eclass | 5 +++++
10 1 file changed, 5 insertions(+)
11
12 diff --git a/eclass/waf-utils.eclass b/eclass/waf-utils.eclass
13 index 66041fc3f60..3ff74db0d79 100644
14 --- a/eclass/waf-utils.eclass
15 +++ b/eclass/waf-utils.eclass
16 @@ -95,6 +95,7 @@ waf-utils_src_configure() {
17 tc-export AR CC CPP CXX RANLIB
18
19 local CMD=(
20 + PYTHONHASHSEED=1
21 CCFLAGS="${CFLAGS}"
22 LINKFLAGS="${CFLAGS} ${LDFLAGS}"
23 PKGCONFIG="$(tc-getPKG_CONFIG)"
24 @@ -119,6 +120,8 @@ waf-utils_src_compile() {
25 local _mywafconfig
26 [[ ${WAF_VERBOSE} == ON ]] && _mywafconfig="--verbose"
27
28 + export PYTHONHASHSEED=1
29 +
30 local jobs="--jobs=$(makeopts_jobs)"
31 echo "\"${WAF_BINARY}\" build ${_mywafconfig} ${jobs} ${*}"
32 "${WAF_BINARY}" ${_mywafconfig} ${jobs} "${@}" || die "build failed"
33 @@ -130,6 +133,8 @@ waf-utils_src_compile() {
34 waf-utils_src_install() {
35 debug-print-function ${FUNCNAME} "$@"
36
37 + export PYTHONHASHSEED=1
38 +
39 echo "\"${WAF_BINARY}\" --jobs=1 --destdir=\"${D}\" ${*} install"
40 "${WAF_BINARY}" --jobs=1 --destdir="${D}" "${@}" install || die "Make install failed"
41
42 --
43 2.38.1

Replies