Some packaging improvements.
authorWayne Davison <wayne@opencoder.net>
Sun, 3 Oct 2021 19:02:58 +0000 (12:02 -0700)
committerWayne Davison <wayne@opencoder.net>
Sun, 10 Oct 2021 16:28:24 +0000 (09:28 -0700)
md2man
packaging/pre-push
packaging/release-rsync
rsyncd.conf.5.md

diff --git a/md2man b/md2man
index 7f783c56cc704ccd8b570acaf62052a81b695463..fa1d2e82479ca4b1f32d5cfb0ae59619e61de0f6 100755 (executable)
--- a/md2man
+++ b/md2man
 # 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)
 
index 04b0d20b45385c4c6c3f78826cc3236a9d6507a2..8a713695ef2a3ab96926809b53ca6c32c9861965 100755 (executable)
@@ -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
index 02cc2f0849efdf995703c0a23f6bdbd821fecc08..f7cfcfe5cf6bf0cf0b5103edff168605edbebbf4 100755 (executable)
@@ -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'):
index b70532b102659ae706eeb186b835b186ed5e1143..730ef71e19e6cd256ce0f5b180626bb4a8c12dd6 100644 (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.