From af8eaab75e12da1ea4909baa697e2f4b5489bc6a Mon Sep 17 00:00:00 2001 From: Martin Jansa Date: Tue, 3 Sep 2024 13:47:48 +0200 Subject: [PATCH] bpftrace: fix buildpaths QA issues * Avoid line statements from bison to fix: WARNING: bpftrace-0.21.2+git-r0 do_package_qa: QA Issue: File /usr/src/debug/bpftrace/0.21.2+git/parser.tab.cc in package bpftrace-src contains reference to TMPDIR [buildpaths] WARNING: bpftrace-0.21.2+git-r0 do_package_qa: QA Issue: File /usr/src/debug/bpftrace/0.21.2+git/location.hh in package bpftrace-src contains reference to TMPDIR [buildpaths] WARNING: bpftrace-0.21.2+git-r0 do_package_qa: QA Issue: File /usr/src/debug/bpftrace/0.21.2+git/parser.tab.hh in package bpftrace-src contains reference to TMPDIR [buildpaths] WARNING: bpftrace-0.21.2+git-r0 do_package_qa: QA Issue: File /usr/src/debug/bpftrace/0.21.2+git/lex.yy.cc in package bpftrace-src contains reference to TMPDIR [buildpaths] * there are still few more buildpaths issues with ptest enabled: WARNING: bpftrace-0.21.2+git-r0 do_package_qa: QA Issue: File /usr/src/debug/bpftrace/0.21.2+git/tests/data/dwarf_data.h in package bpftrace-src contains reference to TMPDIR [buildpaths] WARNING: bpftrace-0.21.2+git-r0 do_package_qa: QA Issue: File /usr/lib/bpftrace/ptest/tests/.debug/bpftrace_test in package bpftrace-dbg contains reference to TMPDIR [buildpaths] WARNING: bpftrace-0.21.2+git-r0 do_package_qa: QA Issue: File /usr/lib/bpftrace/ptest/tests/bpftrace_test in package bpftrace-ptest contains reference to TMPDIR [buildpaths] WARNING: bpftrace-0.21.2+git-r0 do_package_qa: QA Issue: File /usr/lib/bpftrace/ptest/tests/testlibs/cmake_install.cmake in package bpftrace-ptest contains reference to TMPDIR [buildpaths] WARNING: bpftrace-0.21.2+git-r0 do_package_qa: QA Issue: File /usr/lib/bpftrace/ptest/tests/testlibs/CTestTestfile.cmake in package bpftrace-ptest contains reference to TMPDIR [buildpaths] WARNING: bpftrace-0.21.2+git-r0 do_package_qa: QA Issue: File /usr/lib/bpftrace/ptest/tests/testprogs/cmake_install.cmake in package bpftrace-ptest contains reference to TMPDIR [buildpaths] WARNING: bpftrace-0.21.2+git-r0 do_package_qa: QA Issue: File /usr/lib/bpftrace/ptest/tests/testprogs/CTestTestfile.cmake in package bpftrace-ptest contains reference to TMPDIR [buildpaths] * lower buildpaths from ERROR_QA to WARN_QA when ptest is enabled fixing .cmake files might be simple, but the embedded path to dwarf_data.h in bpftrace_test will be more complicated, so will leave it to someone actually using bpftrace (and its ptest). bpftrace/0.21.2+git/package $ grep -R styhead . ./usr/lib/bpftrace/ptest/tests/testlibs/cmake_install.cmake:# Install script for directory: ${WORKDIR}/git/tests/testlibs ./usr/lib/bpftrace/ptest/tests/testlibs/cmake_install.cmake: set(CMAKE_OBJDUMP "${WORKDIR}/recipe-sysroot-native/usr/bin/aarch64-webos-linux/aarch64-webos-linux-objdump") ./usr/lib/bpftrace/ptest/tests/testlibs/CTestTestfile.cmake:# Source directory: ${WORKDIR}/git/tests/testlibs ./usr/lib/bpftrace/ptest/tests/testlibs/CTestTestfile.cmake:# Build directory: ${WORKDIR}/build/tests/testlibs grep: ./usr/lib/bpftrace/ptest/tests/.debug/bpftrace_test: binary file matches grep: ./usr/lib/bpftrace/ptest/tests/bpftrace_test: binary file matches ./usr/lib/bpftrace/ptest/tests/testprogs/cmake_install.cmake:# Install script for directory: ${WORKDIR}/git/tests/testprogs ./usr/lib/bpftrace/ptest/tests/testprogs/cmake_install.cmake: set(CMAKE_OBJDUMP "${WORKDIR}/recipe-sysroot-native/usr/bin/aarch64-webos-linux/aarch64-webos-linux-objdump") ./usr/lib/bpftrace/ptest/tests/testprogs/CTestTestfile.cmake:# Source directory: ${WORKDIR}/git/tests/testprogs ./usr/lib/bpftrace/ptest/tests/testprogs/CTestTestfile.cmake:# Build directory: ${WORKDIR}/build/tests/testprogs ./usr/src/debug/bpftrace/0.21.2+git/tests/data/dwarf_data.h:constexpr inline const char *dwarf_data_cxx_path = "${WORKDIR}/build/tests/data/data_source_cxx"; Signed-off-by: Martin Jansa --- ....txt-allow-to-set-BISON_FLAGS-like-l.patch | 40 +++++++++++++++++++ .../bpftrace/bpftrace_0.21.2.bb | 5 +++ 2 files changed, 45 insertions(+) create mode 100644 dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0002-CMakeLists.txt-allow-to-set-BISON_FLAGS-like-l.patch diff --git a/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0002-CMakeLists.txt-allow-to-set-BISON_FLAGS-like-l.patch b/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0002-CMakeLists.txt-allow-to-set-BISON_FLAGS-like-l.patch new file mode 100644 index 00000000..661dbca4 --- /dev/null +++ b/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0002-CMakeLists.txt-allow-to-set-BISON_FLAGS-like-l.patch @@ -0,0 +1,40 @@ +From ce5d908bb1256ede680fbfd521f087060a567dca Mon Sep 17 00:00:00 2001 +From: Martin Jansa +Date: Tue, 3 Sep 2024 14:17:51 +0200 +Subject: [PATCH] CMakeLists.txt: allow to set BISON_FLAGS like -l + +Signed-off-by: Martin Jansa + +Upstream-Status: Pending +--- + CMakeLists.txt | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 2b60fa26..89bead59 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -100,16 +100,20 @@ include_directories(SYSTEM ${LIBCEREAL_INCLUDE_DIRS}) + + find_package(BISON REQUIRED) + find_package(FLEX REQUIRED) ++ ++# avoid buildpaths in generated #line statements and allow to pass --file-prefix-map=OLD=NEW ++set(BISON_FLAGS "${BISON_FLAGS} -l") ++set(FLEX_FLAGS "${FLEX_FLAGS} -L") + # `parser_class_name` is deprecated and generates warnings in bison >= 3.3. + # But `api.parser.class` is not supported in bison < 3.3. So we must inject + # the %define based on the bison version here. + if(${BISON_VERSION} VERSION_GREATER_EQUAL 3.3) +- set(BISON_FLAGS "-Dapi.parser.class={Parser}") ++ set(BISON_FLAGS "${BISON_FLAGS} -Dapi.parser.class={Parser}") + else() +- set(BISON_FLAGS "-Dparser_class_name={Parser}") ++ set(BISON_FLAGS "${BISON_FLAGS} -Dparser_class_name={Parser}") + endif() + bison_target(bison_parser src/parser.yy ${CMAKE_BINARY_DIR}/parser.tab.cc COMPILE_FLAGS ${BISON_FLAGS} VERBOSE) +-flex_target(flex_lexer src/lexer.l ${CMAKE_BINARY_DIR}/lex.yy.cc) ++flex_target(flex_lexer src/lexer.l ${CMAKE_BINARY_DIR}/lex.yy.cc COMPILE_FLAGS ${FLEX_FLAGS}) + add_flex_bison_dependency(flex_lexer bison_parser) + add_library(parser ${BISON_bison_parser_OUTPUTS} ${FLEX_flex_lexer_OUTPUTS}) + target_compile_options(parser PRIVATE "-w") diff --git a/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace_0.21.2.bb b/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace_0.21.2.bb index addd2c5b..4c888e74 100644 --- a/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace_0.21.2.bb +++ b/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace_0.21.2.bb @@ -21,6 +21,7 @@ PV .= "+git" SRC_URI = "git://github.com/iovisor/bpftrace;branch=master;protocol=https \ file://run-ptest \ file://0001-cmake-Bump-max-LLVM-version-to-19.patch \ + file://0002-CMakeLists.txt-allow-to-set-BISON_FLAGS-like-l.patch \ " SRCREV = "b2e255870ba010d4a7e4852bffcf1c567b016fd0" @@ -45,6 +46,7 @@ EXTRA_OECMAKE = " \ -DCMAKE_BUILD_TYPE=Release \ -DUSE_SYSTEM_BPF_BCC=ON \ -DENABLE_MAN=OFF \ + -DBISON_FLAGS='--file-prefix-map=${WORKDIR}=' \ " COMPATIBLE_HOST = "(x86_64.*|aarch64.*|powerpc64.*|riscv64.*)-linux" @@ -53,3 +55,6 @@ COMPATIBLE_HOST:libc-musl = "null" INHIBIT_PACKAGE_STRIP_FILES += "\ ${PKGD}${PTEST_PATH}/tests/testprogs/uprobe_test \ " + +WARN_QA:append = "${@bb.utils.contains('PTEST_ENABLED', '1', ' buildpaths', '', d)}" +ERROR_QA:remove = "${@bb.utils.contains('PTEST_ENABLED', '1', 'buildpaths', '', d)}"