commit:     bafea1d5f8c2e86f310eb3e227577156e2a2cfd8
Author:     Christopher Byrne <salah.coronya <AT> gmail <DOT> com>
AuthorDate: Wed Sep  8 02:53:11 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Sep  8 06:46:02 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bafea1d5

app-crypt/tpm2-tools: Fix automagic dependency on sys-libs/efivar

Closes: https://bugs.gentoo.org/812047
Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Christopher Byrne <salah.coronya <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../tpm2-tools-5.1.1-no-efivar-automagic.patch     | 34 ++++++++++
 app-crypt/tpm2-tools/tpm2-tools-5.1.1-r2.ebuild    | 72 ++++++++++++++++++++++
 2 files changed, 106 insertions(+)

diff --git 
a/app-crypt/tpm2-tools/files/tpm2-tools-5.1.1-no-efivar-automagic.patch 
b/app-crypt/tpm2-tools/files/tpm2-tools-5.1.1-no-efivar-automagic.patch
new file mode 100644
index 00000000000..25f3ef43fe3
--- /dev/null
+++ b/app-crypt/tpm2-tools/files/tpm2-tools-5.1.1-no-efivar-automagic.patch
@@ -0,0 +1,34 @@
+https://bugs.gentoo.org/812047
+
+From 0cea7f0f78f1a9e8dca789eb5f2ece052e026bed Mon Sep 17 00:00:00 2001
+From: Christopher Byrne <[email protected]>
+Date: Tue, 7 Sep 2021 20:22:27 -0500
+Subject: [PATCH] configure.ac: Fix automagic depency on libefivar
+
+Signed-off-by: Christopher Byrne <[email protected]>
+---
+ configure.ac | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index f1c17116..bdb4abda 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -62,8 +62,12 @@ PKG_CHECK_MODULES([CRYPTO], [libcrypto >= 1.1.0])
+ PKG_CHECK_MODULES([CURL], [libcurl])
+ 
+ # pretty print of devicepath if efivar library is present
+-PKG_CHECK_MODULES([EFIVAR], [efivar],,[true])
+-AC_CHECK_HEADERS([efivar/efivar.h])
++AC_ARG_WITH([efivar], AS_HELP_STRING([--without-efivar], [Build without 
efivar library (default: test)]))
++
++AS_IF([test "x$with_efivar" != "xno"], [
++      PKG_CHECK_MODULES([EFIVAR], [efivar])
++      AC_CHECK_HEADERS([efivar/efivar.h])
++])
+ 
+ # backwards compat with older pkg-config
+ # - pull in AC_DEFUN from pkg.m4
+-- 
+2.32.0
+

diff --git a/app-crypt/tpm2-tools/tpm2-tools-5.1.1-r2.ebuild 
b/app-crypt/tpm2-tools/tpm2-tools-5.1.1-r2.ebuild
new file mode 100644
index 00000000000..6fe96e4e93f
--- /dev/null
+++ b/app-crypt/tpm2-tools/tpm2-tools-5.1.1-r2.ebuild
@@ -0,0 +1,72 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{8,9} )
+inherit autotools bash-completion-r1 python-single-r1
+
+DESCRIPTION="Tools for the TPM 2.0 TSS"
+HOMEPAGE="https://github.com/tpm2-software/tpm2-tools";
+SRC_URI="https://github.com/tpm2-software/${PN}/releases/download/${PV}/${P}.tar.gz";
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE="+fapi test"
+
+RDEPEND=">=app-crypt/tpm2-tss-3.0.1:=[fapi?]
+       dev-libs/openssl:=
+       net-misc/curl:=
+       sys-libs/efivar:=
+       ${PYTHON_DEPS}"
+DEPEND="${RDEPEND}
+       test? (
+               app-crypt/swtpm
+               app-crypt/tpm2-abrmd
+               app-editors/vim-core
+               dev-tcltk/expect
+               dev-util/cmocka
+               dev-python/pyyaml
+       )"
+BDEPEND="virtual/pkgconfig
+       sys-devel/autoconf-archive"
+
+RESTRICT="!test? ( test )"
+REQUIRED_USE=" ${PYTHON_REQUIRED_USE} "
+
+# One of the tests fails without this patch. See
+# https://github.com/tpm2-software/tpm2-tools/issues/2767
+PATCHES=(
+       "${FILESDIR}/${PN}-5.1.1-fix-tpm-checkquote.patch"
+       "${FILESDIR}/${PN}-5.1.1-no-efivar-automagic.patch"
+)
+
+src_prepare() {
+       sed -i \
+       "s/m4_esyscmd_s(\[git describe --tags --always --dirty\])/${PV}/" \
+       "${S}/configure.ac" || die
+       "${S}/scripts/utils/man_to_bashcompletion.sh"
+       default
+       eautoreconf
+}
+
+src_configure() {
+       econf \
+               $(use_enable fapi) \
+               $(use_enable test unit) \
+               --with-bashcompdir=$(get_bashcompdir) \
+               --enable-hardening
+}
+
+src_install() {
+       default
+
+       mv "${D}/$(get_bashcompdir)/tpm2_completion.bash" \
+          "${D}/$(get_bashcompdir)/tpm2" || die
+       for B in "${D}"/usr/bin/tpm2_*
+       do
+               TPM2_UTILS="${TPM2_UTILS} $(basename ${B})"
+       done
+       bashcomp_alias tpm2 ${TPM2_UTILS}
+}

Reply via email to