Skip to content

Commit

Permalink
doc: Fix gen-manpages to check build options
Browse files Browse the repository at this point in the history
  • Loading branch information
BrandonOdiwuor committed Nov 11, 2024
1 parent 0903ce8 commit 7651dc3
Showing 1 changed file with 48 additions and 6 deletions.
54 changes: 48 additions & 6 deletions contrib/devtools/gen-manpages.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
import subprocess
import sys
import tempfile
import configparser

BINARIES = [
'src/bitcoind',
'src/bitcoin-cli',
'src/bitcoin-tx',
'src/bitcoin-wallet',
'src/bitcoin-util',
'src/qt/bitcoin-qt',
'build/src/bitcoind',
'build/src/bitcoin-cli',
'build/src/bitcoin-tx',
'build/src/bitcoin-wallet',
'build/src/bitcoin-util',
'build/src/qt/bitcoin-qt',
]

# Paths to external utilities.
Expand Down Expand Up @@ -57,6 +58,47 @@
print('To properly generate man pages, please commit your changes (or discard them), rebuild, then run this script again.')
print()

# Check enabled build options
config = configparser.ConfigParser()
conffile = os.path.join(builddir, 'build/test/config.ini')
config.read(conffile)

required_components = {
'ENABLE_WALLET': 'Wallet functionality',
'USE_SQLITE': 'SQLite',
'ENABLE_CLI': 'CLI',
'ENABLE_BITCOIN_UTIL': 'Bitcoin utility',
'ENABLE_WALLET_TOOL': 'Wallet tool',
'ENABLE_BITCOIND': 'Bitcoind',
'ENABLE_EXTERNAL_SIGNER': 'External Signer',
}

enabled_components = {
'USE_BDB': 'Berkeley DB',
'ENABLE_FUZZ_BINARY': 'Fuzz testing binary',
'ENABLE_ZMQ': 'ZeroMQ support',
'ENABLE_USDT_TRACEPOINTS': 'USDT tracepoints',
}

for component, description in required_components.items():
if not config['components'].getboolean(component, fallback=False):
print(
"Aborting generating manpages...\n"
f"Error: '{component}' ({description}) support is not enabled.\n"
"Please enable it and try again."
)
sys.exit(1)

for component in config['components']:
if component.upper() not in required_components and component.upper() not in enabled_components:
print(
"Aborting generating manpages...\n"
f"Error: Unknown component '{component}' found in configuration.\n"
"Please remove it and try again"
)
sys.exit(1)


with tempfile.NamedTemporaryFile('w', suffix='.h2m') as footer:
# Create copyright footer, and write it to a temporary include file.
# Copyright is the same for all binaries, so just use the first.
Expand Down

0 comments on commit 7651dc3

Please sign in to comment.