Fixes #17506
gen-manapages.py should check enabled build options when generating docs
Fixes #17506
gen-manapages.py should check enabled build options when generating docs
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--006a51241073e994b41acfe9ec718e94-->
For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/29457.
<!--021abf342d371248e50ceaed478a90ca-->
See the guideline for information on the review process. A summary of reviews will appear here.
<!--174a7506f384e20aa4161008e828411d-->
Reviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
85 | + config.read(conffile) 86 | + 87 | + docs_to_exlude = [] 88 | + if (binary == 'bitcoind' or binary == 'bitcoin-qt') and not config['components'].getboolean('HAVE_SYSTEM'): 89 | + docs_to_exlude += ['shutdownnotify', 'alertnotify', 'startupnotify', 'blocknotify'] 90 | + return parse_and_remove_subsections_from_doc(document, docs_to_exlude)
My understanding would be that the check returns an error to recommend to build with the component, when a component is missing, no?
<!--85328a0da195eb286784d51f73fa0af9-->
🚧 At least one of the CI tasks failed. Make sure to run all tests locally, according to the documentation.
Possibly this is due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.
Leave a comment here, if you need help tracking down a confusing failure.
<sub>Debug: https://github.com/bitcoin/bitcoin/runs/21766942690</sub>
Probably should be a way to override this, in case someone actually wants a custom-fit manpage?
76 | + 77 | + if binary == 'bitcoin-wallet' and not config['components'].getboolean('ENABLE_WALLET'): 78 | + print(error_message.format(component="Wallet functionality", file=file)) 79 | + sys.exit(1) 80 | + 81 | + if (binary == 'bitcoind' or binary == 'bitcoin-qt') and not config['components'].getboolean('USE_UPNP'):
what is the point of re-doing the check for every binary?
fixed
@luke-jr you mean away to override the changes or the help2man generation?
63 | +conffile = os.path.join(builddir, 'test/config.ini') 64 | +config.read(conffile) 65 | + 66 | +error_message = "Aborting generating manpages…\nError: {component} support is not enabled.\nPlease enable it and try again." 67 | + 68 | +if not config['components'].getboolean('HAVE_SYSTEM'):
This seems arbitrary and prone to breakage, giving the hardcoding of specific components. It also doesn't cover all of the relevant components in any case, i.e at least decl_fork and natpmp (which both effect manpage output) are missing any sort of check.
This seems arbitrary and prone to breakage, giving the hardcoding of specific components.
I don't think there is a better alternative, is there?
Not sure. Although I think any changes here can wait until after CMake, as this script will likely need to be (partially) rewritten after that change in any case.
changes here can wait until after CMake, as this script will likely need to be (partially) rewritten after that change in any case.
Can you explain this? config ini should be unrelated to the build system and shouldn't be affected by it.
This is hardcoding component names / variables, and they are likely to change during the switchover.
Are you still working on this?
Thanks for working on this issue, however this needs update after the cmake change.. This is the new contents of test/config.ini:
[components]
# Which components are enabled. These are commented out by `configure` if they were disabled when running config.
ENABLE_WALLET=true
USE_SQLITE=true
#USE_BDB=true
ENABLE_CLI=true
ENABLE_BITCOIN_UTIL=true
ENABLE_WALLET_TOOL=true
ENABLE_BITCOIND=true
#ENABLE_FUZZ_BINARY=true
#ENABLE_ZMQ=true
ENABLE_EXTERNAL_SIGNER=true
#ENABLE_USDT_TRACEPOINTS=true
i'm not sure there is a way around hardcoding component names, as they have different effects on options we can't automatically detect here, but we may want to be more thorough: explicitly include lists of components that must be enabled, and components that we don't care about. If any unknown components appear, also error out so that can be resolved first.
@laanwj I updated the PR to include the suggestions
69 | + 'ENABLE_CLI': 'CLI', 70 | + 'ENABLE_BITCOIN_UTIL': 'Bitcoin utility', 71 | + 'ENABLE_WALLET_TOOL': 'Wallet tool', 72 | + 'ENABLE_BITCOIND': 'Bitcoind', 73 | + 'ENABLE_EXTERNAL_SIGNER': 'External Signer', 74 | +}
Missing HAVE_SYSTEM?
76 | +enabled_components = { 77 | + 'USE_BDB': 'Berkeley DB', 78 | + 'ENABLE_FUZZ_BINARY': 'Fuzz testing binary', 79 | + 'ENABLE_ZMQ': 'ZeroMQ support', 80 | + 'ENABLE_USDT_TRACEPOINTS': 'USDT tracepoints', 81 | +}
Not sure about silently ignoring those. The goal of the script is to generate the manpages of the releases, and fail if it can't.
Allowing third parties to generate their own manpages can be implemented behind an option, or not at all.
@maflcko, are you suggesting the default behaviour should be to also fail if the enabled components are missing?
19 | +'build/src/bitcoind', 20 | +'build/src/bitcoin-cli', 21 | +'build/src/bitcoin-tx', 22 | +'build/src/bitcoin-wallet', 23 | +'build/src/bitcoin-util', 24 | +'build/src/qt/bitcoin-qt',
You can't just change the relative path to include an unrelated prefix. This breaks when using BUILDDIR. Please see the conflicting pull request on how to correctly do it.
This just fails on the release binaries. Please make sure to test the code yourself before asking for review. If you run into issues, you can ask questions.
BUILDDIR=bld ./contrib/devtools/gen-manpages.py
Aborting generating manpages...
Error: 'HAVE_SYSTEM' (System component) support is not enabled.
Please enable it and try again.
You'll probably have to use bld/src/bitcoin-build-config.h instead of the test ini. It seems odd anyway to tie the test config to this.
<!--cf906140f33d8803c4a75a2196329ecb-->
🐙 This pull request conflicts with the target branch and needs rebase.
<!--13523179cfe9479db18ec6c5d236f789-->
⌛ There hasn't been much activity lately and the patch still needs rebase. What is the status here?
Drafted for now. @BrandonOdiwuor are you still working on this?
<!--13523179cfe9479db18ec6c5d236f789-->
⌛ There hasn't been much activity lately and the patch still needs rebase. What is the status here?