commit:     3c265c179aa02408713c500e2d13ab80556b12db
Author:     Daniel Müller <deso <AT> posteo <DOT> net>
AuthorDate: Mon Jan  2 18:17:54 2023 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Thu Jan 12 14:20:17 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3c265c17

app-crypt/nitrocli: Use cargo install for shell-complete

The way we access the shell-complete binary during the build has always
been a hack. There is no way to know for sure where it is located ahead
of time and cargo does not expose this information in an easily
accessible manner. That may lead to shenanigans such as
https://bugs.gentoo.org/889360, where it appears as if a debug build was
forced and that resulted in the executable being available in
target/debug/ as opposed to target/release/.
Fix this issue by using cargo install internally, to force "temporary"
installation in less undefined path.

Closes: https://bugs.gentoo.org/889360
Signed-off-by: Daniel Müller <deso <AT> posteo.net>
Closes: https://github.com/gentoo/gentoo/pull/28938
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 app-crypt/nitrocli/nitrocli-0.4.1.ebuild | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/app-crypt/nitrocli/nitrocli-0.4.1.ebuild 
b/app-crypt/nitrocli/nitrocli-0.4.1.ebuild
index 769a5bd019b6..fcfc2efba490 100644
--- a/app-crypt/nitrocli/nitrocli-0.4.1.ebuild
+++ b/app-crypt/nitrocli/nitrocli-0.4.1.ebuild
@@ -1,4 +1,4 @@
-# Copyright 2017-2021 Gentoo Authors
+# Copyright 2017-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -93,13 +93,20 @@ RDEPEND="
 RESTRICT="test"
 QA_FLAGS_IGNORED="usr/bin/nitrocli"
 
+src_compile() {
+       cargo_src_compile --bin=nitrocli
+       # Install shell-complete binary into source directory to be able to
+       # use it later on.
+       cargo install --bin=shell-complete --path . --root "${S}" || die
+}
+
 src_install() {
        cargo_src_install --bin=nitrocli
 
-       target/release/shell-complete bash > ${PN}.bash || die
+       "${S}"/bin/shell-complete bash > ${PN}.bash || die
        newbashcomp ${PN}.bash ${PN}
 
-       target/release/shell-complete fish > ${PN}.fish || die
+       "${S}"/bin/shell-complete fish > ${PN}.fish || die
        insinto /usr/share/fish/vendor_conf.d/
        insopts -m0755
        doins ${PN}.fish

Reply via email to