[Debian-med-packaging] Bug#984889: assembly-stats natively FTBFS: error: gtest/gtest.h: No such file or directory
Nilesh Patra
nilesh at debian.org
Tue Mar 9 19:03:23 GMT 2021
Package: assembly-stats
Version: 1.0.1+ds-2
Severity: important
X-Debbugs-Cc: nilesh at debian.org
Control: tags -1 patch
Dear Maintainer,
assembly-stats natively FTBFS reason being it forcefully compiles test
files, while the test dependency libgtest-dev is annotated with <!nocheck>
It should respect the nocheck option, and not compile the test files in
such a case.
In order to reproduce this, pass DEB_BUILD_OPTIONS=nocheck and set build
profile to nocheck as well. With sbuild:
$ DEB_BUILD_OPTIONS=nocheck sbuild -j5 -d unstable --source-only-changes --run-lintian --lintian-opts='--color always --display-info --display-experimental --pedantic' --profiles=nocheck
and it results in error:
/usr/bin/c++ -I/usr/include/gtest -Wall -O3 -pthread -o CMakeFiles/runUnitTests.dir/stats_unittest.cpp.o -c /<<PKGBUILDDIR>>/stats_unittest.cpp
/<<PKGBUILDDIR>>/filetype_unittest.cpp:2:10: fatal error: gtest/gtest.h: No such file or directory
2 | #include "gtest/gtest.h"
| ^~~~~~~~~~~~~~~
compilation terminated.
make[3]: *** [CMakeFiles/runUnitTests.dir/build.make:111: CMakeFiles/runUnitTests.dir/filetype_unittest.cpp.o] Error 1
make[3]: *** Waiting for unfinished jobs....
/<<PKGBUILDDIR>>/stats_unittest.cpp:2:10: fatal error: gtest/gtest.h: No such file or directory
2 | #include "gtest/gtest.h"
| ^~~~~~~~~~~~~~~
compilation terminated.
/<<PKGBUILDDIR>>/fastq_unittest.cpp:5:10: fatal error: gtest/gtest.h: No such file or directory
5 | #include "gtest/gtest.h"
| ^~~~~~~~~~~~~~~
compilation terminated.
make[3]: *** [CMakeFiles/runUnitTests.dir/build.make:124: CMakeFiles/runUnitTests.dir/stats_unittest.cpp.o] Error 1
make[3]: *** [CMakeFiles/runUnitTests.dir/build.make:98: CMakeFiles/runUnitTests.dir/fastq_unittest.cpp.o] Error 1
/<<PKGBUILDDIR>>/fasta_unittest.cpp:3:10: fatal error: gtest/gtest.h: No such file or directory
3 | #include "gtest/gtest.h"
| ^~~~~~~~~~~~~~~
compilation terminated.
make[3]: *** [CMakeFiles/runUnitTests.dir/build.make:85: CMakeFiles/runUnitTests.dir/fasta_unittest.cpp.o] Error 1
make[3]: Leaving directory '/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu'
make[2]: *** [CMakeFiles/Makefile2:251: CMakeFiles/runUnitTests.dir/all] Error 2
make[2]: *** Waiting for unfinished jobs....
The patch for the same is given below:
diff --git a/debian/patches/do-not-test-forcefully.patch b/debian/patches/do-not-test-forcefully.patch
new file mode 100644
index 0000000..1fc749f
--- /dev/null
+++ b/debian/patches/do-not-test-forcefully.patch
@@ -0,0 +1,23 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -5,11 +5,15 @@
+
+ file(COPY test_files DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+ #add_subdirectory(gtest-1.7.0)
+-enable_testing()
+-include_directories(/usr/include/gtest)
+-add_executable(runUnitTests fasta_unittest.cpp fastq_unittest.cpp filetype_unittest.cpp stats_unittest.cpp)
+-target_link_libraries(runUnitTests gtest gtest_main fasta fastq filetype stats)
+-add_test(runUnitTests runUnitTests)
++option(BUILD_TESTS "Parameter to enable/disable build time tests" ON)
++
++if(BUILD_TESTS)
++ enable_testing()
++ include_directories(/usr/include/gtest)
++ add_executable(runUnitTests fasta_unittest.cpp fastq_unittest.cpp filetype_unittest.cpp stats_unittest.cpp)
++ target_link_libraries(runUnitTests gtest gtest_main fasta fastq filetype stats)
++ add_test(runUnitTests runUnitTests)
++endif()
+
+ add_library(fasta fasta.cpp)
+ add_library(fastq fastq.cpp)
diff --git a/debian/patches/series b/debian/patches/series
index 9fc23ad..49aafd6 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
use_debian_packages_gtest.patch
+do-not-test-forcefully.patch
diff --git a/debian/rules b/debian/rules
index aae41d2..9f13e4b 100755
--- a/debian/rules
+++ b/debian/rules
@@ -11,5 +11,8 @@ export DEB_BUILD_MAINT_OPTIONS=hardening=+all
%:
dh $@
+override_dh_auto_configure:
+ dh_auto_configure -- -DBUILD_TESTS=$(if $(filter nocheck,$(DEB_BUILD_OPTIONS)),OFF,ON)
+
override_dh_auto_install:
dh_install obj-$(DEB_BUILD_GNU_TYPE)/assembly-stats usr/bin
-- System Information:
Debian Release: bullseye/sid
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 5.7.0-2-amd64 (SMP w/8 CPU threads)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: unable to detect
Versions of packages assembly-stats depends on:
ii libc6 2.31-3
ii libgcc-s1 11-20210220-1
ii libstdc++6 11-20210220-1
assembly-stats recommends no packages.
assembly-stats suggests no packages.
-- no debconf information
More information about the Debian-med-packaging
mailing list