summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@gmail.com>2021-03-09 14:23:36 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-03-10 10:30:39 +0000
commita42b2bf96e2e78f8e79a25cf445b0a7bb3d89e5e (patch)
tree782bd09683d75b2f73bf59fac9b0e5294b0ee9ed /meta
parent1d7e44d44383bb05285b754e51f649e6de6472c9 (diff)
downloadpoky-a42b2bf96e2e78f8e79a25cf445b0a7bb3d89e5e.tar.gz
perf: fix reproducibility issues
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 (From OE-Core rev: dea57aa1cd879df4feae1b9595b38c5b6ff74574) Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-kernel/perf/perf.bb38
1 files changed, 38 insertions, 0 deletions
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 = '\
81 AR="${AR}" \ 81 AR="${AR}" \
82 LD="${LD}" \ 82 LD="${LD}" \
83 EXTRA_CFLAGS="-ldw" \ 83 EXTRA_CFLAGS="-ldw" \
84 YFLAGS='-y --file-prefix-map=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}' \
84 EXTRA_LDFLAGS="${PERF_EXTRA_LDFLAGS}" \ 85 EXTRA_LDFLAGS="${PERF_EXTRA_LDFLAGS}" \
85 perfexecdir=${libexecdir} \ 86 perfexecdir=${libexecdir} \
86 NO_GTK2=1 \ 87 NO_GTK2=1 \
@@ -214,6 +215,43 @@ do_configure_prepend () {
214 ${S}/tools/build/Makefile.build 215 ${S}/tools/build/Makefile.build
215 fi 216 fi
216 217
218 # start reproducibility substitutions
219 if [ -e "${S}/tools/perf/Makefile.config" ]; then
220 # The following line in the Makefle:
221 # override PYTHON := $(call get-executable-or-default,PYTHON,$(PYTHON_AUTO))
222 # "PYTHON" / "PYTHON_AUTO" have the full path as part of the variable. We've
223 # ensure that the environment is setup and we do not need the full path to be
224 # captured, since the symbol gets built into the executable, making it not
225 # reproducible.
226 sed -i -e 's,$(call get-executable-or-default\,PYTHON\,$(PYTHON_AUTO)),$(notdir $(call get-executable-or-default\,PYTHON\,$(PYTHON_AUTO))),g' \
227 ${S}/tools/perf/Makefile.config
228
229 # The following line:
230 # srcdir_SQ = $(patsubst %tools/perf,tools/perf,$(subst ','\'',$(srcdir))),
231 # Captures the full src path of perf, which of course makes it not
232 # reproducible. We really only need the relative location 'tools/perf', so we
233 # change the Makefile line to remove everything before 'tools/perf'
234 sed -i -e "s%srcdir_SQ = \$(subst ','\\\'',\$(srcdir))%srcdir_SQ = \$(patsubst \%tools/perf,tools/perf,\$(subst ','\\\'',\$(srcdir)))%g" \
235 ${S}/tools/perf/Makefile.config
236 fi
237 if [ -e "${S}/tools/perf/tests/Build" ]; then
238 # OUTPUT is the full path, we have python on the path so we remove it from the
239 # definition. This is captured in the perf binary, so breaks reproducibility
240 sed -i -e 's,PYTHONPATH="BUILD_STR($(OUTPUT)python)",PYTHONPATH="BUILD_STR(python)",g' \
241 ${S}/tools/perf/tests/Build
242 fi
243 if [ -e "${S}/tools/perf/util/Build" ]; then
244 # To avoid bison generating #ifdefs that have captured paths, we make sure
245 # all the calls have YFLAGS, which contains prefix mapping information.
246 sed -i -e 's,$(BISON),$(BISON) $(YFLAGS),g' ${S}/tools/perf/util/Build
247 fi
248 if [ -e "${S}/scripts/Makefile.host" ]; then
249 # To avoid yacc (bison) generating #ifdefs that have captured paths, we make sure
250 # all the calls have YFLAGS, which contains prefix mapping information.
251 sed -i -e 's,$(YACC),$(YACC) $(YFLAGS),g' ${S}/scripts/Makefile.host
252 fi
253 # end reproducibility substitutions
254
217 # We need to ensure the --sysroot option in CC is preserved 255 # We need to ensure the --sysroot option in CC is preserved
218 if [ -e "${S}/tools/perf/Makefile.perf" ]; then 256 if [ -e "${S}/tools/perf/Makefile.perf" ]; then
219 sed -i 's,CC = $(CROSS_COMPILE)gcc,#CC,' ${S}/tools/perf/Makefile.perf 257 sed -i 's,CC = $(CROSS_COMPILE)gcc,#CC,' ${S}/tools/perf/Makefile.perf