All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2] systemtap: improve reproducibility
@ 2018-07-20  9:13 Hongxu Jia
  0 siblings, 0 replies; only message in thread
From: Hongxu Jia @ 2018-07-20  9:13 UTC (permalink / raw)
  To: openembedded-core, ross.burton

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

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 ...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 528864c..48cf4ae 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 <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
 
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 0000000..15a6f2a
--- /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 <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
+
diff --git a/meta/recipes-kernel/systemtap/systemtap_git.bb b/meta/recipes-kernel/systemtap/systemtap_git.bb
index b280f58..0b7833e 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
-- 
2.7.4



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-07-20  9:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-20  9:13 [PATCH V2] systemtap: improve reproducibility Hongxu Jia

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.