Some packaging improvements.

This commit is contained in:
Wayne Davison
2021-10-03 12:02:58 -07:00
parent 78b5bc6629
commit ec8a05f653
4 changed files with 43 additions and 6 deletions

14
md2man
View File

@@ -11,6 +11,13 @@
# 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.
@@ -58,6 +65,7 @@ HTML_END = """\
MAN_START = r"""
.TH "%s" "%s" "%s" "%s" "User Commands"
.\" prefix=%s
""".lstrip()
MAN_END = """\
@@ -91,7 +99,8 @@ def main():
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:
@@ -124,13 +133,14 @@ def main():
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)

View File

@@ -1,3 +1,16 @@
#!/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

View File

@@ -18,6 +18,9 @@ dest = os.environ['HOME'] + '/samba-rsync-ftp'
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')
@@ -44,6 +47,17 @@ def main():
{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'):

View File

@@ -60,9 +60,9 @@ When run via inetd you should add a line like this to /etc/services:
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.