mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 02:33:24 -03:00
Merge bitcoin/bitcoin#30986: contrib: skip missing binaries in gen-manpages
Some checks failed
CI / test each commit (push) Has been cancelled
CI / macOS 14 native, arm64, no depends, sqlite only, gui (push) Has been cancelled
CI / macOS 14 native, arm64, fuzz (push) Has been cancelled
CI / Win64 native, VS 2022 (push) Has been cancelled
CI / Win64 native fuzz, VS 2022 (push) Has been cancelled
CI / ASan + LSan + UBSan + integer, no depends, USDT (push) Has been cancelled
Some checks failed
CI / test each commit (push) Has been cancelled
CI / macOS 14 native, arm64, no depends, sqlite only, gui (push) Has been cancelled
CI / macOS 14 native, arm64, fuzz (push) Has been cancelled
CI / Win64 native, VS 2022 (push) Has been cancelled
CI / Win64 native fuzz, VS 2022 (push) Has been cancelled
CI / ASan + LSan + UBSan + integer, no depends, USDT (push) Has been cancelled
ee6185372f
gen-manpages: Prompt error if no binaries are found (Andre)299e2220e9
gen-manpages: implement --skip-missing-binaries (Andre Alves) Pull request description: Instead of stopping the execution of gen-manpages.py when a binary is not found, continue generating manpages for the available binaries and skip the missing ones. A new argument, `--skip-missing-binaries`, has been added to enable this behavior. ```sh ➜ bitcoin git:(fix-gen-manpages) ✗ ./contrib/devtools/gen-manpages.py --help usage: gen-manpages.py [-h] [-s] options: -h, --help show this help message and exit -s, --skip-missing-binaries skip generation for binaries that are not found ``` closes #30985 This PR also includes an error prompt if no binaries are found in the build path. ACKs for top commit: achow101: ACKee6185372f
laanwj: re-ACKee6185372f
Tree-SHA512: af4a0a5e26e508a51ab63f8aa9f98a6d6af9d7682a16791d8a6a61d49e44cb0147453f628ad5910f65d4efa6e3c7b6605c007259c23230b54888845bfaeb050c
This commit is contained in:
commit
7590e93bc7
1 changed files with 23 additions and 2 deletions
|
@ -6,6 +6,7 @@ import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import argparse
|
||||||
|
|
||||||
BINARIES = [
|
BINARIES = [
|
||||||
'src/bitcoind',
|
'src/bitcoind',
|
||||||
|
@ -16,6 +17,18 @@ BINARIES = [
|
||||||
'src/qt/bitcoin-qt',
|
'src/qt/bitcoin-qt',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser(
|
||||||
|
formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"-s",
|
||||||
|
"--skip-missing-binaries",
|
||||||
|
action="store_true",
|
||||||
|
default=False,
|
||||||
|
help="skip generation for binaries that are not found in the build path",
|
||||||
|
)
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
# Paths to external utilities.
|
# Paths to external utilities.
|
||||||
git = os.getenv('GIT', 'git')
|
git = os.getenv('GIT', 'git')
|
||||||
help2man = os.getenv('HELP2MAN', 'help2man')
|
help2man = os.getenv('HELP2MAN', 'help2man')
|
||||||
|
@ -38,8 +51,12 @@ for relpath in BINARIES:
|
||||||
try:
|
try:
|
||||||
r = subprocess.run([abspath, "--version"], stdout=subprocess.PIPE, check=True, text=True)
|
r = subprocess.run([abspath, "--version"], stdout=subprocess.PIPE, check=True, text=True)
|
||||||
except IOError:
|
except IOError:
|
||||||
print(f'{abspath} not found or not an executable', file=sys.stderr)
|
if(args.skip_missing_binaries):
|
||||||
sys.exit(1)
|
print(f'{abspath} not found or not an executable. Skipping...', file=sys.stderr)
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
print(f'{abspath} not found or not an executable', file=sys.stderr)
|
||||||
|
sys.exit(1)
|
||||||
# take first line (which must contain version)
|
# take first line (which must contain version)
|
||||||
verstr = r.stdout.splitlines()[0]
|
verstr = r.stdout.splitlines()[0]
|
||||||
# last word of line is the actual version e.g. v22.99.0-5c6b3d5b3508
|
# last word of line is the actual version e.g. v22.99.0-5c6b3d5b3508
|
||||||
|
@ -51,6 +68,10 @@ for relpath in BINARIES:
|
||||||
|
|
||||||
versions.append((abspath, verstr, copyright))
|
versions.append((abspath, verstr, copyright))
|
||||||
|
|
||||||
|
if not versions:
|
||||||
|
print(f'No binaries found in {builddir}. Please ensure the binaries are present in {builddir}, or set another build path using the BUILDDIR env variable.')
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
if any(verstr.endswith('-dirty') for (_, verstr, _) in versions):
|
if any(verstr.endswith('-dirty') for (_, verstr, _) in versions):
|
||||||
print("WARNING: Binaries were built from a dirty tree.")
|
print("WARNING: Binaries were built from a dirty tree.")
|
||||||
print('man pages generated from dirty binaries should NOT be committed.')
|
print('man pages generated from dirty binaries should NOT be committed.')
|
||||||
|
|
Loading…
Add table
Reference in a new issue