commit:     1494dde4f27b31dd269d646e5ce0298f082c4716
Author:     Matt Whitlock <gentoo <AT> mattwhitlock <DOT> name>
AuthorDate: Tue Oct 24 15:43:47 2023 +0000
Commit:     Florian Schmaus <flow <AT> gentoo <DOT> org>
CommitDate: Wed Oct 25 08:37:19 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1494dde4

net-p2p/bitcoin-core: add warnings about unlikely USE flag combos

Signed-off-by: Matt Whitlock <gentoo <AT> mattwhitlock.name>
Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>

 net-p2p/bitcoin-core/bitcoin-core-25.1.ebuild | 42 ++++++++++++++++++++++++---
 1 file changed, 38 insertions(+), 4 deletions(-)

diff --git a/net-p2p/bitcoin-core/bitcoin-core-25.1.ebuild 
b/net-p2p/bitcoin-core/bitcoin-core-25.1.ebuild
index 351ec614e96f..a5818124e34f 100644
--- a/net-p2p/bitcoin-core/bitcoin-core-25.1.ebuild
+++ b/net-p2p/bitcoin-core/bitcoin-core-25.1.ebuild
@@ -95,6 +95,36 @@ PATCHES=(
        "${FILESDIR}/init.patch"
 )
 
+efmt() {
+       : ${1:?} ; local l ; while read -r l ; do "${!#}" "${l}" ; done < <(fmt 
"${@:1:$#-1}")
+}
+
+pkg_pretend() {
+       if ! use daemon && ! use gui && ! has_version 
"${CATEGORY}/${PN}[-daemon,-gui(-),-qt5(-)]" ; then
+               efmt ewarn <<-EOF
+                       You are enabling neither USE="daemon" nor USE="gui". 
This is a valid
+                       configuration, but you will be unable to run a Bitcoin 
node using this
+                       installation.
+               EOF
+       fi
+       if use daemon && ! use bitcoin-cli && ! has_version 
"${CATEGORY}/${PN}[daemon,-bitcoin-cli]" ; then
+               efmt ewarn <<-EOF
+                       You are enabling USE="daemon" but not 
USE="bitcoin-cli". This is a valid
+                       configuration, but you will be unable to interact with 
your bitcoind node
+                       via the command line using this installation.
+               EOF
+       fi
+       if ! use berkdb && ! use sqlite &&
+               { { use daemon && ! has_version 
"${CATEGORY}/${PN}[daemon,-berkdb,-sqlite]" ; } ||
+                 { use gui && ! has_version 
"${CATEGORY}/${PN}[gui,-berkdb,-sqlite]" ; } ; }
+       then
+               efmt ewarn <<-EOF
+                       You are enabling neither USE="berkdb" nor USE="sqlite". 
This is a valid
+                       configuration, but your Bitcoin node will be unable to 
open any wallets.
+               EOF
+       fi
+}
+
 pkg_setup() {
        use test && python-any-r1_pkg_setup
 }
@@ -209,10 +239,6 @@ src_install() {
        fi
 }
 
-efmt() {
-       : ${1:?} ; local l ; while read -r l ; do "${!#}" "${l}" ; done < <(fmt 
"${@:1:$#-1}")
-}
-
 pkg_preinst() {
        if use daemon && [[ -d "${EROOT}/var/lib/bitcoin/.bitcoin" ]] ; then
                if [[ -h "${EROOT}/var/lib/bitcoin/.bitcoin" ]] ; then
@@ -254,6 +280,14 @@ pkg_postinst() {
                        - Running bitcoind directly: add that user to the 'tor' 
user group.
                        EOF
        fi
+
+       if use bitcoin-cli && use daemon ; then
+               efmt -su elog <<-EOF
+                       To use bitcoin-cli with the /etc/init.d/bitcoind 
service:
+                        - Add your user(s) to the 'bitcoin' group.
+                        - Symlink ~/.bitcoin to /var/lib/bitcoind.
+               EOF
+       fi
 }
 
 pkg_postrm() {

Reply via email to