diff mbox series

[2/4] ptest.bbclass: strip build machine triplet from installed ptest Makefiles

Message ID 20260804220456.2342710-2-alhe@linux.microsoft.com
State Under Review
Headers show
Series [1/4] libtool: strip build system triplet from installed libtool script | expand

Commit Message

Alejandro Hernandez Aug. 4, 2026, 10:04 p.m. UTC
do_install_ptest_base already rewrites HOSTTOOLS_DIR and WORKDIR
references out of installed ptest Makefiles, but automake-generated
Makefiles (as shipped by strace-ptest, gnutls-ptest and others) also
carry six autoconf-generated variables that encode the *build
machine*, not the target:

  build_triplet, build_alias, build, build_cpu, build_vendor, build_os

Those values differ across autobuilder workers (typical values are
build=x86_64-pc-linux-gnu, build_alias=x86_64-linux, build_vendor=pc),
causing corresponding -ptest packages to fail the reproducibility
selftest.

Add sed rules to blank the RHS of each of those assignments, plus the
matching automake helper lines `set build_triplet` and
`set build_alias`, and extend PTEST_BUILD_HOST_FILES to include
site.exp (also autoconf-generated with the same variables).

Verified locally: before this change strace-ptest carried
`build_triplet = x86_64-pc-linux-gnu`, `build = x86_64-pc-linux-gnu`,
`build_alias = x86_64-linux`, `build_cpu = x86_64`,
`build_vendor = pc`, `build_os = linux-gnu`; after this change all six
lines have an empty RHS.

Assisted-by: AI - OpenAI
Signed-off-by: Alejandro Hernandez <alhe@linux.microsoft.com>
---
 meta/classes-recipe/ptest.bbclass | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/meta/classes-recipe/ptest.bbclass b/meta/classes-recipe/ptest.bbclass
index 64c4bb9788..0f80fbc1d8 100644
--- a/meta/classes-recipe/ptest.bbclass
+++ b/meta/classes-recipe/ptest.bbclass
@@ -9,7 +9,7 @@  DESCRIPTION:${PN}-ptest ?= "${DESCRIPTION}  \
 This package contains a test directory ${PTEST_PATH} for package test purposes."
 
 PTEST_PATH ?= "${libdir}/${BPN}/ptest"
-PTEST_BUILD_HOST_FILES ?= "Makefile"
+PTEST_BUILD_HOST_FILES ?= "Makefile site.exp"
 PTEST_BUILD_HOST_PATTERN ?= ""
 PTEST_PARALLEL_MAKE ?= "${PARALLEL_MAKE}"
 PTEST_PARALLEL_MAKEINST ?= "${PARALLEL_MAKEINST}"
@@ -69,6 +69,14 @@  do_install_ptest_base() {
             sed -e 's#${HOSTTOOLS_DIR}/*##g' \
                 -e 's#${WORKDIR}/*=#.=#g' \
                 -e 's#${WORKDIR}/*##g' \
+                -e 's#^\(build_triplet[[:space:]]*=\).*#\1#' \
+                -e 's#^\(build_alias[[:space:]]*=\).*#\1#' \
+                -e 's#^\(build[[:space:]]*=\).*#\1#' \
+                -e 's#^\(build_cpu[[:space:]]*=\).*#\1#' \
+                -e 's#^\(build_vendor[[:space:]]*=\).*#\1#' \
+                -e 's#^\(build_os[[:space:]]*=\).*#\1#' \
+                -e 's#^\(set build_triplet\).*#\1#' \
+                -e 's#^\(set build_alias\).*#\1#' \
                 -i $installed_ptest_file
             if [ -n "${PTEST_BUILD_HOST_PATTERN}" ]; then
                sed -E '/${PTEST_BUILD_HOST_PATTERN}/d' \