commit: 13868852bdc3c59e75c8b15ba4c16ee84dc24b1c
Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 5 14:25:22 2025 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Wed Mar 5 14:25:41 2025 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=13868852
net-misc/openrdap: cleanup go usage, add shell completion
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
net-misc/openrdap/openrdap-0.9.1.ebuild | 26 +++++++++++++++++++++-----
1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/net-misc/openrdap/openrdap-0.9.1.ebuild
b/net-misc/openrdap/openrdap-0.9.1.ebuild
index 0d4fb631053f..9caae444c5a7 100644
--- a/net-misc/openrdap/openrdap-0.9.1.ebuild
+++ b/net-misc/openrdap/openrdap-0.9.1.ebuild
@@ -3,9 +3,7 @@
EAPI=8
-inherit go-module
-
-go-module_set_globals
+inherit go-module toolchain-funcs shell-completion
DESCRIPTION="RDAP command line client"
HOMEPAGE="
@@ -16,17 +14,35 @@ SRC_URI="
https://github.com/openrdap/rdap/archive/refs/tags/v${PV}.tar.gz ->
${P}.tar.gz
https://dev.gentoo.org/~conikost/distfiles/${P}-vendor.tar.xz
"
-S="${WORKDIR}/${PN/open/}-${PV}"
+S=${WORKDIR}/${P/open/}
LICENSE="BSD MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
src_compile() {
- go build ./cmd/rdap || die
+ ego build ./cmd/rdap
+
+ if ! tc-is-cross-compiler; then
+ elog "generating shell completion files"
+ # those commands exit OK with 1, so we can't use die
+
+ ./rdap --completion-script-bash > rdap.bash
+ grep -q "complete -F" rdap.bash || die "bash completion script
is invalid"
+
+ ./rdap --completion-script-zsh > rdap.zsh
+ grep -q "compdef rdap" rdap.zsh || die "zsh completion script
is invalid"
+ fi
}
src_install() {
dobin rdap
einstalldocs
+
+ if ! tc-is-cross-compiler; then
+ newbashcomp rdap.bash rdap
+ newzshcomp rdap.zsh _rdap
+ else
+ ewarn "Shell completion files not installed! Install them
manually with '${PN} completion --help'"
+ fi
}