# The html.parser is used as a state machine that both tweaks the html and
# outputs the nroff data based on the html tags.
#
+# We normally grab the prefix from the generated Makefile, which is then used
+# in the various other grabbed values (see the Makefile for its ${prefix}
+# paths). However, the maintainer can choose to override this prefix by
+# exporting RSYNC_OVERRIDE_PREFIX=/usr. This allows the man pages to refer to
+# /usr paths (and are thus compatible with the release-rsync script) while
+# still having the built rsync get installed into /usr/local for local testing.
+#
# Copyright (C) 2020 Wayne Davison
#
# This program is freely redistributable.
MAN_START = r"""
.TH "%s" "%s" "%s" "%s" "User Commands"
+.\" prefix=%s
""".lstrip()
MAN_END = """\
if args.test:
env_subs['VERSION'] = '1.0.0'
- env_subs['libdir'] = '/usr'
+ env_subs['bindir'] = '/usr/bin'
+ env_subs['libdir'] = '/usr/lib/rsync'
else:
for fn in (fi.srcdir + 'version.h', 'Makefile'):
try:
txt = fh.read()
txt = re.sub(r'@VERSION@', env_subs['VERSION'], txt)
+ txt = re.sub(r'@BINDIR@', env_subs['bindir'], txt)
txt = re.sub(r'@LIBDIR@', env_subs['libdir'], txt)
fi.html_in = md_parser(txt)
txt = None
fi.date = time.strftime('%d %b %Y', time.localtime(fi.mtime))
- fi.man_headings = (fi.prog, fi.sect, fi.date, fi.prog + ' ' + env_subs['VERSION'])
+ fi.man_headings = (fi.prog, fi.sect, fi.date, fi.prog + ' ' + env_subs['VERSION'], env_subs['prefix'])
HtmlToManPage(fi)
-#!/bin/sh
+#!/bin/bash -e
+
cat >/dev/null # Just discard stdin data
-make gensend
+
+if [[ -f /proc/$PPID/cmdline ]]; then
+ while read -d $'\0' arg ; do
+ if [[ "$arg" == '--tags' ]] ; then
+ exit 0
+ fi
+ done </proc/$PPID/cmdline
+fi
+
+branch=`git rev-parse --abbrev-ref HEAD`
+if [[ "$branch" = master && "$*" == *github* ]]; then
+ make gensend
+fi
ORIGINAL_PATH = os.environ['PATH']
def main():
+ if not os.path.isfile('packaging/release-rsync'):
+ die('You must run this script from the top of your rsync checkout.')
+
now = datetime.now()
cl_today = now.strftime('* %a %b %d %Y')
year = now.strftime('%Y')
{dash_line}
""")
+ with open('build/rsync.1') as fh:
+ for line in fh:
+ if line.startswith(r'.\" prefix='):
+ doc_prefix = line.split('=')[1].strip()
+ if doc_prefix != '/usr':
+ warn(f"*** The documentation was built with prefix {doc_prefix} instead of /usr ***")
+ warn("*** Read the md2man script for a way to override this. ***\n")
+ break
+ if line.startswith('.P'):
+ die("Failed to find the prefix comment at the start of the rsync.1 manpage.")
+
if not os.path.isdir(dest):
die(dest, "dest does not exist")
if not os.path.isdir('.git'):
and a single line something like this to /etc/inetd.conf:
-> rsync stream tcp nowait root /usr/bin/rsync rsyncd --daemon
+> rsync stream tcp nowait root @BINDIR@/rsync rsyncd --daemon
-Replace "/usr/bin/rsync" with the path to where you have rsync installed on
+Replace "@BINDIR@/rsync" with the path to where you have rsync installed on
your system. You will then need to send inetd a HUP signal to tell it to
reread its config file.