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 <hongxu.jia@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Hongxu Jia
2018-07-20 17:13:50 +08:00
committed by Richard Purdie
parent b7b203d8ea
commit 077ad46934
3 changed files with 67 additions and 8 deletions

View File

@@ -5,32 +5,52 @@ Subject: [PATCH] Install python modules to correct library dir.
Upstream-Status: Inappropriate [oe-core specific]
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
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 <hongxu.jia@windriver.com>
---
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

View File

@@ -0,0 +1,31 @@
From 6288ba5df0a8c73ef842b609081449ac4de86123 Mon Sep 17 00:00:00 2001
From: Hongxu Jia <hongxu.jia@windriver.com>
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 <hongxu.jia@windriver.com>
---
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 <boost/version.hpp>
-#include <boost/utility/string_ref.hpp> //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

View File

@@ -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