|
|
@ -32,7 +32,6 @@ mandir = os.getenv('MANDIR', os.path.join(topdir, 'doc/man'))
|
|
|
|
|
|
|
|
|
|
|
|
# Verify that all the required binaries are usable, and extract copyright
|
|
|
|
# Verify that all the required binaries are usable, and extract copyright
|
|
|
|
# message in a first pass.
|
|
|
|
# message in a first pass.
|
|
|
|
copyright = None
|
|
|
|
|
|
|
|
versions = []
|
|
|
|
versions = []
|
|
|
|
for relpath in BINARIES:
|
|
|
|
for relpath in BINARIES:
|
|
|
|
abspath = os.path.join(builddir, relpath)
|
|
|
|
abspath = os.path.join(builddir, relpath)
|
|
|
@ -42,18 +41,17 @@ for relpath in BINARIES:
|
|
|
|
print(f'{abspath} not found or not an executable', file=sys.stderr)
|
|
|
|
print(f'{abspath} not found or not an executable', file=sys.stderr)
|
|
|
|
sys.exit(1)
|
|
|
|
sys.exit(1)
|
|
|
|
# take first line (which must contain version)
|
|
|
|
# take first line (which must contain version)
|
|
|
|
verstr = r.stdout.split('\n')[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
|
|
|
|
verstr = verstr.split()[-1]
|
|
|
|
verstr = verstr.split()[-1]
|
|
|
|
assert verstr.startswith('v')
|
|
|
|
assert verstr.startswith('v')
|
|
|
|
|
|
|
|
# remaining lines are copyright
|
|
|
|
|
|
|
|
copyright = r.stdout.split('\n')[1:]
|
|
|
|
|
|
|
|
assert copyright[0].startswith('Copyright (C)')
|
|
|
|
|
|
|
|
|
|
|
|
# Only bitcoin-qt prints the copyright message on --version, so store it specifically.
|
|
|
|
versions.append((abspath, verstr, copyright))
|
|
|
|
if relpath == 'src/qt/bitcoin-qt':
|
|
|
|
|
|
|
|
copyright = r.stdout.split('\n')[1:]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
versions.append((abspath, verstr))
|
|
|
|
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.')
|
|
|
|
print('To properly generate man pages, please commit your changes (or discard them), rebuild, then run this script again.')
|
|
|
|
print('To properly generate man pages, please commit your changes (or discard them), rebuild, then run this script again.')
|
|
|
@ -61,13 +59,13 @@ if any(verstr.endswith('-dirty') for (_, verstr) in versions):
|
|
|
|
|
|
|
|
|
|
|
|
with tempfile.NamedTemporaryFile('w', suffix='.h2m') as footer:
|
|
|
|
with tempfile.NamedTemporaryFile('w', suffix='.h2m') as footer:
|
|
|
|
# Create copyright footer, and write it to a temporary include file.
|
|
|
|
# Create copyright footer, and write it to a temporary include file.
|
|
|
|
assert copyright
|
|
|
|
# Copyright is the same for all binaries, so just use the first.
|
|
|
|
footer.write('[COPYRIGHT]\n')
|
|
|
|
footer.write('[COPYRIGHT]\n')
|
|
|
|
footer.write('\n'.join(copyright).strip())
|
|
|
|
footer.write('\n'.join(versions[0][2]).strip())
|
|
|
|
footer.flush()
|
|
|
|
footer.flush()
|
|
|
|
|
|
|
|
|
|
|
|
# Call the binaries through help2man to produce a manual page for each of them.
|
|
|
|
# Call the binaries through help2man to produce a manual page for each of them.
|
|
|
|
for (abspath, verstr) in versions:
|
|
|
|
for (abspath, verstr, _) in versions:
|
|
|
|
outname = os.path.join(mandir, os.path.basename(abspath) + '.1')
|
|
|
|
outname = os.path.join(mandir, os.path.basename(abspath) + '.1')
|
|
|
|
print(f'Generating {outname}…')
|
|
|
|
print(f'Generating {outname}…')
|
|
|
|
subprocess.run([help2man, '-N', '--version-string=' + verstr, '--include=' + footer.name, '-o', outname, abspath], check=True)
|
|
|
|
subprocess.run([help2man, '-N', '--version-string=' + verstr, '--include=' + footer.name, '-o', outname, abspath], check=True)
|
|
|
|