commit:     35347b119f54654434e1d2f2fec9c07327b3e6e2
Author:     David Seifert <soap <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 10 20:17:42 2019 +0000
Commit:     David Seifert <soap <AT> gentoo <DOT> org>
CommitDate: Sat Aug 10 20:17:42 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=35347b11

app-crypt/libnitrokey: Fix tests when git is not installed

Closes: https://bugs.gentoo.org/689614
Package-Manager: Portage-2.3.71, Repoman-2.3.17
Signed-off-by: David Seifert <soap <AT> gentoo.org>

 .../files/libnitrokey-3.5-tests-version-gitless.patch  | 18 ++++++++++++++++++
 app-crypt/libnitrokey/libnitrokey-3.5.ebuild           |  2 ++
 2 files changed, 20 insertions(+)

diff --git 
a/app-crypt/libnitrokey/files/libnitrokey-3.5-tests-version-gitless.patch 
b/app-crypt/libnitrokey/files/libnitrokey-3.5-tests-version-gitless.patch
new file mode 100644
index 00000000000..99fc5af0378
--- /dev/null
+++ b/app-crypt/libnitrokey/files/libnitrokey-3.5-tests-version-gitless.patch
@@ -0,0 +1,18 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -129,7 +129,14 @@
+       ERROR_QUIET
+ )
+ ENDIF()
+-IF((NOT ${ADD_GIT_INFO}) OR (${PROJECT_VERSION_GIT_RETURN_CODE}))
++# the version.h generation logic is tricky in a number of ways:
++# 1. git describe on a release tarball will always fail with
++#    a non-zero return code, usually 128
++# 2. If git is not installed, PROJECT_VERSION_GIT_RETURN_CODE
++#    will contain the string 'No such file or directory'
++# Hence fallback to PROJECT_VERSION when the return code is NOT 0.
++IF((NOT ${ADD_GIT_INFO}) OR (NOT ${PROJECT_VERSION_GIT_RETURN_CODE} STREQUAL 
"0"))
++      MESSAGE(STATUS "Setting fallback Git library version")
+       SET(PROJECT_VERSION_GIT "v${PROJECT_VERSION}")
+ ENDIF()
+ MESSAGE(STATUS "Setting Git library version to: " ${PROJECT_VERSION_GIT} )

diff --git a/app-crypt/libnitrokey/libnitrokey-3.5.ebuild 
b/app-crypt/libnitrokey/libnitrokey-3.5.ebuild
index 35712a33722..7d6ebab8f99 100644
--- a/app-crypt/libnitrokey/libnitrokey-3.5.ebuild
+++ b/app-crypt/libnitrokey/libnitrokey-3.5.ebuild
@@ -32,6 +32,8 @@ DEPEND="
        test? ( >=dev-cpp/catch-2.5.0:0 )"
 BDEPEND="virtual/pkgconfig"
 
+PATCHES=( "${FILESDIR}"/${PN}-3.5-tests-version-gitless.patch )
+
 src_configure() {
        local mycmakeargs=(
                -DCMAKE_INSTALL_UDEVRULESDIR="$(get_udevdir)"/rules.d

Reply via email to