From 077ad469349734fe82f4cc920ed8375f5282d9dc Mon Sep 17 00:00:00 2001 From: Hongxu Jia Date: Fri, 20 Jul 2018 17:13:50 +0800 Subject: systemtap: improve reproducibility - Fix build path issue of .pyc files: Supply "--root" directory to the "install" command. - Fix build path issue of c++ object files: Use relative dir to include header string_ref. - Fix build path issue of c library generated by distutils: Add OE's CFLAGS which contains `-fdebug-prefix-map' options to setup.py [YOCTO #12528] (From OE-Core rev: 806a8626c3fb5020666152b295f12541f5f61ffd) Signed-off-by: Hongxu Jia Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- ...all-python-modules-to-correct-library-dir.patch | 36 +++++++++++++++++----- ...1-improve-reproducibility-for-c-compiling.patch | 31 +++++++++++++++++++ meta/recipes-kernel/systemtap/systemtap_git.bb | 8 +++++ 3 files changed, 67 insertions(+), 8 deletions(-) create mode 100644 meta/recipes-kernel/systemtap/systemtap/0001-improve-reproducibility-for-c-compiling.patch diff --git a/meta/recipes-kernel/systemtap/systemtap/0001-Install-python-modules-to-correct-library-dir.patch b/meta/recipes-kernel/systemtap/systemtap/0001-Install-python-modules-to-correct-library-dir.patch index 528864cc93..48cf4aee85 100644 --- a/meta/recipes-kernel/systemtap/systemtap/0001-Install-python-modules-to-correct-library-dir.patch +++ b/meta/recipes-kernel/systemtap/systemtap/0001-Install-python-modules-to-correct-library-dir.patch @@ -5,32 +5,52 @@ Subject: [PATCH] Install python modules to correct library dir. Upstream-Status: Inappropriate [oe-core specific] Signed-off-by: Alexander Kanavin + +Add OE's CFLAGS which contains `-fdebug-prefix-map' options to +setup.py + +Supply "--root" directory to the "install" command, and use +it as a prefix to strip off the purported filename encoded +in bytecode files. (It strips build path prefix from .pyc files) + +Signed-off-by: Hongxu Jia --- - python/Makefile.am | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) + python/Makefile.am | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/python/Makefile.am b/python/Makefile.am -index a254480f9..efe9f3c01 100644 +index a254480..578602f 100644 --- a/python/Makefile.am +++ b/python/Makefile.am -@@ -47,7 +47,7 @@ install-exec-local: +@@ -8,6 +8,10 @@ AUTOMAKE_OPTIONS = subdir-objects + AM_CPPFLAGS = -I$(srcdir)/../includes + AM_CPPFLAGS += -I$(abs_builddir)/../includes/sys + ++# Add OE's CFLAGS which contains `-fdebug-prefix-map' options to ++# fix build path issue ++AM_CPPFLAGS += $(CFLAGS) ++ + # Any script in the following variable will get byte-compiled at + # install time. + pkglibexecpython_PYTHON = +@@ -47,7 +51,7 @@ install-exec-local: if HAVE_PYTHON2_PROBES (cd $(srcdir); CFLAGS="$(AM_CPPFLAGS)" $(PYTHON) setup.py build \ --build-base $(shell readlink -f $(builddir))/py2build \ - install --prefix $(DESTDIR)$(prefix) \ -+ install --prefix $(DESTDIR)$(prefix) --install-lib=$(DESTDIR)${pythondir} \ ++ install --root $(DESTDIR) --prefix $(prefix) --prefix $(prefix) --install-lib=${pythondir} \ --single-version-externally-managed \ --record $(shell readlink -f $(builddir))/py2build/install_files.txt \ --verbose) -@@ -55,7 +55,7 @@ endif +@@ -55,7 +59,7 @@ endif if HAVE_PYTHON3_PROBES (cd $(srcdir); CFLAGS="$(AM_CPPFLAGS)" $(PYTHON3) setup.py build \ --build-base $(shell readlink -f $(builddir))/py3build \ - install --prefix $(DESTDIR)$(prefix) \ -+ install --prefix $(DESTDIR)$(prefix) --install-lib=$(DESTDIR)${python3dir} \ ++ install --root $(DESTDIR) --prefix $(prefix) --install-lib=${python3dir} \ --single-version-externally-managed \ --record $(shell readlink -f $(builddir))/py3build/install_files.txt \ --verbose) -- -2.11.0 +2.7.4 diff --git a/meta/recipes-kernel/systemtap/systemtap/0001-improve-reproducibility-for-c-compiling.patch b/meta/recipes-kernel/systemtap/systemtap/0001-improve-reproducibility-for-c-compiling.patch new file mode 100644 index 0000000000..15a6f2a9a5 --- /dev/null +++ b/meta/recipes-kernel/systemtap/systemtap/0001-improve-reproducibility-for-c-compiling.patch @@ -0,0 +1,31 @@ +From 6288ba5df0a8c73ef842b609081449ac4de86123 Mon Sep 17 00:00:00 2001 +From: Hongxu Jia +Date: Wed, 18 Jul 2018 16:58:33 +0800 +Subject: [PATCH] improve reproducibility for c++ compiling + +Use relative dir to include header string_ref to +strip build path prefix in c++ object file + +Upstream-Status: Inappropriate [oe specific] + +Signed-off-by: Hongxu Jia +--- + stringtable.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/stringtable.h b/stringtable.h +index 5fc42e7..6fd8a1e 100644 +--- a/stringtable.h ++++ b/stringtable.h +@@ -19,7 +19,7 @@ + + #if defined(HAVE_BOOST_UTILITY_STRING_REF_HPP) + #include +-#include //header with string_ref ++#include "@RELATIVE_STAGING_INCDIR@/boost/utility/string_ref.hpp" //header with string_ref + + // XXX: experimental tunables + #define INTERNED_STRING_FIND_MEMMEM 1 /* perf stat indicates a very slight benefit */ +-- +2.7.4 + diff --git a/meta/recipes-kernel/systemtap/systemtap_git.bb b/meta/recipes-kernel/systemtap/systemtap_git.bb index b280f583e2..0b7833e901 100644 --- a/meta/recipes-kernel/systemtap/systemtap_git.bb +++ b/meta/recipes-kernel/systemtap/systemtap_git.bb @@ -3,6 +3,8 @@ HOMEPAGE = "https://sourceware.org/systemtap/" require systemtap_git.inc +SRC_URI += "file://0001-improve-reproducibility-for-c-compiling.patch" + DEPENDS = "elfutils" EXTRA_OECONF += "--with-libelf=${STAGING_DIR_TARGET} --without-rpm \ @@ -25,6 +27,12 @@ PACKAGECONFIG[python3-probes] = "--with-python3-probes,--without-python3-probes, inherit autotools gettext pkgconfig distutils3-base +do_configure_prepend () { + # Improve reproducibility for c++ object files + reltivepath="${@os.path.relpath(d.getVar('STAGING_INCDIR'), d.getVar('S'))}" + sed -i "s:@RELATIVE_STAGING_INCDIR@:$reltivepath:g" ${S}/stringtable.h +} + do_install_append () { if [ ! -f ${D}${bindir}/stap ]; then # translator disabled case, need to leave only minimal runtime -- cgit v1.2.3-54-g00ecf