poky/meta/recipes-devtools/libdnf/libdnf/enable_test_data_dir_set.patch
Joe Slater d88024e783 libdnf: allow reproducible binary builds
Use a static TESTDATADIR if tests are disabled.  Allow
override of TESTDATADIR if tests are enabled since the
default will be wrong for target builds.

(From OE-Core rev: 43d24a3726dc1b639261429cc6537e947281143c)

Signed-off-by: Joe Slater <joe.slater@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-07-25 15:11:05 +01:00

27 lines
753 B
Diff

libdnf: allow reproducible binary builds
Use a dummy directory for test data if not built WITH_TESTS. Allow for overriding
TESTDATADIR, since the default is guaranteed to be wrong for target builds.
Upstream-Status: Pending
Signed-off-by: Joe Slater <joe.slater@windriver.com>
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -133,7 +133,12 @@ add_definitions(-DG_LOG_DOMAIN=\\"libdnf
add_definitions(-D_FILE_OFFSET_BITS=64)
# tests
-add_definitions(-DTESTDATADIR=\\"${CMAKE_SOURCE_DIR}/data/tests\\")
+if(NOT WITH_TESTS)
+ set(TEST_DATA_DIR "/notests")
+elseif(NOT DEFINED TEST_DATA_DIR)
+ set(TEST_DATA_DIR "${CMAKE_SOURCE_DIR}/data/tests")
+endif()
+add_definitions(-DTESTDATADIR=\\"${TEST_DATA_DIR}\\")
# librhsm
if(ENABLE_RHSM_SUPPORT)