Skip to content

Commit ec8a05f

Browse files
committed
Some packaging improvements.
1 parent 78b5bc6 commit ec8a05f

File tree

4 files changed

+43
-6
lines changed

4 files changed

+43
-6
lines changed

md2man

+12-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@
1111
# The html.parser is used as a state machine that both tweaks the html and
1212
# outputs the nroff data based on the html tags.
1313
#
14+
# We normally grab the prefix from the generated Makefile, which is then used
15+
# in the various other grabbed values (see the Makefile for its ${prefix}
16+
# paths). However, the maintainer can choose to override this prefix by
17+
# exporting RSYNC_OVERRIDE_PREFIX=/usr. This allows the man pages to refer to
18+
# /usr paths (and are thus compatible with the release-rsync script) while
19+
# still having the built rsync get installed into /usr/local for local testing.
20+
#
1421
# Copyright (C) 2020 Wayne Davison
1522
#
1623
# This program is freely redistributable.
@@ -58,6 +65,7 @@ HTML_END = """\
5865

5966
MAN_START = r"""
6067
.TH "%s" "%s" "%s" "%s" "User Commands"
68+
.\" prefix=%s
6169
""".lstrip()
6270

6371
MAN_END = """\
@@ -91,7 +99,8 @@ def main():
9199

92100
if args.test:
93101
env_subs['VERSION'] = '1.0.0'
94-
env_subs['libdir'] = '/usr'
102+
env_subs['bindir'] = '/usr/bin'
103+
env_subs['libdir'] = '/usr/lib/rsync'
95104
else:
96105
for fn in (fi.srcdir + 'version.h', 'Makefile'):
97106
try:
@@ -124,13 +133,14 @@ def main():
124133
txt = fh.read()
125134

126135
txt = re.sub(r'@VERSION@', env_subs['VERSION'], txt)
136+
txt = re.sub(r'@BINDIR@', env_subs['bindir'], txt)
127137
txt = re.sub(r'@LIBDIR@', env_subs['libdir'], txt)
128138

129139
fi.html_in = md_parser(txt)
130140
txt = None
131141

132142
fi.date = time.strftime('%d %b %Y', time.localtime(fi.mtime))
133-
fi.man_headings = (fi.prog, fi.sect, fi.date, fi.prog + ' ' + env_subs['VERSION'])
143+
fi.man_headings = (fi.prog, fi.sect, fi.date, fi.prog + ' ' + env_subs['VERSION'], env_subs['prefix'])
134144

135145
HtmlToManPage(fi)
136146

packaging/pre-push

+15-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1-
#!/bin/sh
1+
#!/bin/bash -e
2+
23
cat >/dev/null # Just discard stdin data
3-
make gensend
4+
5+
if [[ -f /proc/$PPID/cmdline ]]; then
6+
while read -d $'\0' arg ; do
7+
if [[ "$arg" == '--tags' ]] ; then
8+
exit 0
9+
fi
10+
done </proc/$PPID/cmdline
11+
fi
12+
13+
branch=`git rev-parse --abbrev-ref HEAD`
14+
if [[ "$branch" = master && "$*" == *github* ]]; then
15+
make gensend
16+
fi

packaging/release-rsync

+14
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ dest = os.environ['HOME'] + '/samba-rsync-ftp'
1818
ORIGINAL_PATH = os.environ['PATH']
1919

2020
def main():
21+
if not os.path.isfile('packaging/release-rsync'):
22+
die('You must run this script from the top of your rsync checkout.')
23+
2124
now = datetime.now()
2225
cl_today = now.strftime('* %a %b %d %Y')
2326
year = now.strftime('%Y')
@@ -44,6 +47,17 @@ def main():
4447
{dash_line}
4548
""")
4649

50+
with open('build/rsync.1') as fh:
51+
for line in fh:
52+
if line.startswith(r'.\" prefix='):
53+
doc_prefix = line.split('=')[1].strip()
54+
if doc_prefix != '/usr':
55+
warn(f"*** The documentation was built with prefix {doc_prefix} instead of /usr ***")
56+
warn("*** Read the md2man script for a way to override this. ***\n")
57+
break
58+
if line.startswith('.P'):
59+
die("Failed to find the prefix comment at the start of the rsync.1 manpage.")
60+
4761
if not os.path.isdir(dest):
4862
die(dest, "dest does not exist")
4963
if not os.path.isdir('.git'):

rsyncd.conf.5.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ When run via inetd you should add a line like this to /etc/services:
6060
6161
and a single line something like this to /etc/inetd.conf:
6262

63-
> rsync stream tcp nowait root /usr/bin/rsync rsyncd --daemon
63+
> rsync stream tcp nowait root @BINDIR@/rsync rsyncd --daemon
6464
65-
Replace "/usr/bin/rsync" with the path to where you have rsync installed on
65+
Replace "@BINDIR@/rsync" with the path to where you have rsync installed on
6666
your system. You will then need to send inetd a HUP signal to tell it to
6767
reread its config file.
6868

0 commit comments

Comments
 (0)