[oe-commits] [openembedded-core] 13/17: ptest: Reproducibility: Strip build host paths from any installed Makefile

git at git.openembedded.org git at git.openembedded.org
Wed Nov 28 17:39:15 UTC 2018


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit da6c66e961f94441ad744a2740401b39bacabe54
Author: Douglas Royds <douglas.royds at taitradio.com>
AuthorDate: Wed Nov 28 17:53:09 2018 +1300

    ptest: Reproducibility: Strip build host paths from any installed Makefile
    
    A common pattern for ptest is to install a Makefile that provides a make check
    target. These generated Makefiles are normally full of build host paths, to
    hosttools, and to files and scripts within the source or build tree. They also
    commonly include the CFLAGS and CPPFLAGS. None of these build host paths
    can possibly work on-target, so stripping them has no effect on the success of
    the resulting ptests.
    
    Stripping the HOSTTOOLS_DIR has this effect, for instance:
    
        -MKDIR_P = /home/douglas/workspace/upstream/build/tmp/hosttools/mkdir -p
        +MKDIR_P = mkdir -p
    
    The curious WORKDIR/*= pattern avoids non-parseable -fdebug-prefix-map patterns
    in the CFLAGS by adding an arbitrary ".", eg:
    
        -fdebug-prefix-map=.=/usr/src/debug/rsyslog/8.37.0-r0
    
    In all other cases, we simply remove the WORKDIR, eg:
    
        CPP = arm-tait-linux-gnueabi-gcc -E --sysroot=recipe-sysroot ...
    
    Signed-off-by: Douglas Royds <douglas.royds at taitradio.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/classes/ptest.bbclass | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/meta/classes/ptest.bbclass b/meta/classes/ptest.bbclass
index 9d8a798..fa518f6 100644
--- a/meta/classes/ptest.bbclass
+++ b/meta/classes/ptest.bbclass
@@ -3,6 +3,8 @@ DESCRIPTION_${PN}-ptest ?= "${DESCRIPTION}  \
 This package contains a test directory ${PTEST_PATH} for package test purposes."
 
 PTEST_PATH ?= "${libdir}/${BPN}/ptest"
+PTEST_BUILD_HOST_FILES ?= "Makefile"
+
 FILES_${PN}-ptest = "${PTEST_PATH}"
 SECTION_${PN}-ptest = "devel"
 ALLOW_EMPTY_${PN}-ptest = "1"
@@ -45,6 +47,17 @@ do_install_ptest_base() {
     fi
     do_install_ptest
     chown -R root:root ${D}${PTEST_PATH}
+
+    # Strip build host paths from any installed Makefile
+    for filename in ${PTEST_BUILD_HOST_FILES}; do
+        for installed_ptest_file in $(find ${D}${PTEST_PATH} -type f -name $filename); do
+            bbnote "Stripping host paths from: $installed_ptest_file"
+            sed -e 's#${HOSTTOOLS_DIR}/*##g' \
+                -e 's#${WORKDIR}/*=#.=#g' \
+                -e 's#${WORKDIR}/*##g' \
+                -i $installed_ptest_file
+        done
+    done
 }
 
 do_configure_ptest_base[dirs] = "${B}"

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list