From: Bruce Ashfield <[email protected]>
perf has been failing our reproducible testing due to multiple symbols
containg build paths.
With this commit, we fix the issues:
1) The following line in the Makefle:
override PYTHON := $(call get-executable-or-default,PYTHON,$(PYTHON_AUTO))
"PYTHON" / "PYTHON_AUTO" have the full path as part of the variable. We've
ensure that the environment is setup and we do not need the full path to be
captured, since the symbol gets built into the executable, making it not
reproducible.
2) The following line:
srcdir_SQ = $(patsubst %tools/perf,tools/perf,$(subst ','\'',$(srcdir))),
Captures the full src path of perf, which of course makes it not
reproducible. We really only need the relative location 'tools/perf', so we
change the Makefile line to remove everything before 'tools/perf'
3) OUTPUT is the full path, we have python on the path so we remove it from the
definition. This is captured in the perf binary, so breaks reproducibility
PYTHONPATH="BUILD_STR(python)
4) To avoid bison generating #ifdefs that have captured paths, we make sure
all the calls have YFLAGS, which contains prefix mapping information.
Upstream-status: OE specific to our cross/build environments. Variants
will be developed for upstream
Signed-off-by: Bruce Ashfield <[email protected]>
---
meta/recipes-kernel/perf/perf.bb | 38 ++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/meta/recipes-kernel/perf/perf.bb b/meta/recipes-kernel/perf/perf.bb
index 868cde7353..2beb404c03 100644
--- a/meta/recipes-kernel/perf/perf.bb
+++ b/meta/recipes-kernel/perf/perf.bb
@@ -81,6 +81,7 @@ EXTRA_OEMAKE = '\
AR="${AR}" \
LD="${LD}" \
EXTRA_CFLAGS="-ldw" \
+ YFLAGS='-y
--file-prefix-map=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}' \
EXTRA_LDFLAGS="${PERF_EXTRA_LDFLAGS}" \
perfexecdir=${libexecdir} \
NO_GTK2=1 \
@@ -214,6 +215,43 @@ do_configure_prepend () {
${S}/tools/build/Makefile.build
fi
+ # start reproducibility substitutions
+ if [ -e "${S}/tools/perf/Makefile.config" ]; then
+ # The following line in the Makefle:
+ # override PYTHON := $(call
get-executable-or-default,PYTHON,$(PYTHON_AUTO))
+ # "PYTHON" / "PYTHON_AUTO" have the full path as part of the variable.
We've
+ # ensure that the environment is setup and we do not need the full
path to be
+ # captured, since the symbol gets built into the executable, making it
not
+ # reproducible.
+ sed -i -e 's,$(call
get-executable-or-default\,PYTHON\,$(PYTHON_AUTO)),$(notdir $(call
get-executable-or-default\,PYTHON\,$(PYTHON_AUTO))),g' \
+ ${S}/tools/perf/Makefile.config
+
+ # The following line:
+ # srcdir_SQ = $(patsubst %tools/perf,tools/perf,$(subst
','\'',$(srcdir))),
+ # Captures the full src path of perf, which of course makes it not
+ # reproducible. We really only need the relative location
'tools/perf', so we
+ # change the Makefile line to remove everything before 'tools/perf'
+ sed -i -e "s%srcdir_SQ = \$(subst ','\\\'',\$(srcdir))%srcdir_SQ =
\$(patsubst \%tools/perf,tools/perf,\$(subst ','\\\'',\$(srcdir)))%g" \
+ ${S}/tools/perf/Makefile.config
+ fi
+ if [ -e "${S}/tools/perf/tests/Build" ]; then
+ # OUTPUT is the full path, we have python on the path so we remove it
from the
+ # definition. This is captured in the perf binary, so breaks
reproducibility
+ sed -i -e
's,PYTHONPATH="BUILD_STR($(OUTPUT)python)",PYTHONPATH="BUILD_STR(python)",g' \
+ ${S}/tools/perf/tests/Build
+ fi
+ if [ -e "${S}/tools/perf/util/Build" ]; then
+ # To avoid bison generating #ifdefs that have captured paths, we make
sure
+ # all the calls have YFLAGS, which contains prefix mapping information.
+ sed -i -e 's,$(BISON),$(BISON) $(YFLAGS),g' ${S}/tools/perf/util/Build
+ fi
+ if [ -e "${S}/scripts/Makefile.host" ]; then
+ # To avoid yacc (bison) generating #ifdefs that have captured paths,
we make sure
+ # all the calls have YFLAGS, which contains prefix mapping information.
+ sed -i -e 's,$(YACC),$(YACC) $(YFLAGS),g' ${S}/scripts/Makefile.host
+ fi
+ # end reproducibility substitutions
+
# We need to ensure the --sysroot option in CC is preserved
if [ -e "${S}/tools/perf/Makefile.perf" ]; then
sed -i 's,CC = $(CROSS_COMPILE)gcc,#CC,' ${S}/tools/perf/Makefile.perf
--
2.19.1
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#149183):
https://lists.openembedded.org/g/openembedded-core/message/149183
Mute This Topic: https://lists.openembedded.org/mt/81209663/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-