Improvements for release process; a gensend hook.

This commit is contained in:
Wayne Davison
2020-06-10 09:21:21 -07:00
parent c5e44330a5
commit 58e8ecf48f
6 changed files with 38 additions and 22 deletions

View File

@@ -150,7 +150,7 @@ t_unsafe$(EXEEXT): $(T_UNSAFE_OBJ)
gen: conf proto.h man
gensend: gen
rsync -aivzc $(GENFILES) $${SAMBA_HOST-samba.org}:/home/ftp/pub/rsync/generated-files/
rsync -aic $(GENFILES) $${SAMBA_HOST-samba.org}:/home/ftp/pub/rsync/generated-files/
conf:
cd $(srcdir) && $(MAKE) -f prepare-source.mak conf
@@ -217,13 +217,13 @@ proto.h-tstamp: $(srcdir)/*.c $(srcdir)/lib/compat.c config.h
man: rsync.1 rsync-ssl.1 rsyncd.conf.5
rsync.1: rsync.1.md md2man latest-year.h Makefile
rsync.1: rsync.1.md md2man NEWS.md Makefile
@$(srcdir)/maybe-make-man $(srcdir) rsync.1.md
rsync-ssl.1: rsync-ssl.1.md md2man latest-year.h Makefile
rsync-ssl.1: rsync-ssl.1.md md2man NEWS.md Makefile
@$(srcdir)/maybe-make-man $(srcdir) rsync-ssl.1.md
rsyncd.conf.5: rsyncd.conf.5.md md2man latest-year.h Makefile
rsyncd.conf.5: rsyncd.conf.5.md md2man NEWS.md Makefile
@$(srcdir)/maybe-make-man $(srcdir) rsyncd.conf.5.md
clean: cleantests

15
md2man
View File

@@ -15,7 +15,7 @@
#
# This program is freely redistributable.
import sys, os, re, argparse, time
import sys, os, re, argparse, subprocess, time
from html.parser import HTMLParser
CONSUMES_TXT = set('h1 h2 p li pre'.split())
@@ -78,16 +78,21 @@ def main():
fi.srcdir = './'
fi.title = fi.prog + '(' + fi.sect + ') man page'
fi.date = None
fi.mtime = None
chk_files = 'latest-year.h Makefile'.split()
if os.path.lexists(fi.srcdir + '.git'):
fi.mtime = int(subprocess.check_output('git log -1 --format=%at'.split()))
chk_files = 'NEWS.md Makefile'.split()
for fn in chk_files:
try:
st = os.lstat(fi.srcdir + fn)
except:
die('Failed to find', fi.srcdir + fn)
if not fi.date:
fi.date = time.strftime('%d %b %Y', time.localtime(st.st_mtime))
if not fi.mtime:
fi.mtime = st.st_mtime
fi.date = time.strftime('%d %b %Y', time.localtime(fi.mtime))
env_subs = { }

View File

@@ -37,9 +37,11 @@ def main():
if not os.path.exists('rsyncd.conf.5.md'):
die("There is no rsync checkout in the current directory.")
mandate_gensend_hook()
if args.make_tar:
check_git_state('master')
cmd_chk(['touch', 'latest-year.h'])
cmd_chk(['touch', 'NEWS.md'])
cmd_chk(['make', gen_target])
cmd_chk(['rsync', '-a', *glob.glob('*.[1-9].html'), dest])

View File

@@ -169,6 +169,17 @@ def get_patch_branches(base_branch):
return branches
def mandate_gensend_hook():
hook = '.git/hooks/pre-push'
if not os.path.exists(hook):
print('Creating hook file:', hook)
cmd_chk(['./rsync', '-a', 'packaging/pre-push', hook])
else:
out, rc = cmd_txt_status(['fgrep', 'make gensend', hook], discard='output')
if rc:
die('Please add a "make gensend" into your', hook, 'script.')
# Snag the GENFILES values out of the Makefile.in file and return them as a list.
def get_extra_files():
cont_re = re.compile(r'\\\n')

3
packaging/pre-push Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/sh
cat >/dev/null # Just discard stdin data
make gensend

View File

@@ -15,11 +15,6 @@ from pkglib import *
dest = os.environ['HOME'] + '/samba-rsync-ftp'
ORIGINAL_PATH = os.environ['PATH']
MAKE_GEN_CMDS = [
'make -f prepare-source.mak conf'.split(),
'./config.status'.split(),
'make gen'.split(),
]
def main():
now = datetime.now()
@@ -28,6 +23,8 @@ def main():
ztoday = now.strftime('%d %b %Y')
today = ztoday.lstrip('0')
mandate_gensend_hook()
curdir = os.getcwd()
signal.signal(signal.SIGINT, signal_handler)
@@ -157,7 +154,6 @@ About to:
- tweak the version in configure.ac and the spec files
- tweak NEWS.md and OLDNEWS.md to ensure header values are correct
- generate configure.sh, config.h.in, and proto.h
- touch the latest-year.h file and generate the manpages
- page through the differences
""")
ans = input("<Press Enter to continue> ")
@@ -213,9 +209,6 @@ About to:
fh.write(txt)
cmd_chk(['packaging/year-tweak'])
cmd_chk([touch, 'latest-year.h']) # This file's date is put in the generated manpages.
cmd_chk(['make', 'reconfigure'])
cmd_chk(['make', 'man'])
print(dash_line)
cmd_run("git diff --color | less -p '^diff .*'")
@@ -233,7 +226,8 @@ About to:
{dash_line}
About to:
- commit all version changes
- git commit all changes
- generate the manpages
- merge the {args.master_branch} branch into the patch/{args.master_branch}/* branches
- update the files in the "patches" dir and OPTIONALLY
(if you type 'y') to launch a shell for each patch
@@ -244,6 +238,9 @@ About to:
if s.returncode:
die('Aborting')
cmd_chk(['make', 'reconfigure'])
cmd_chk(['make', 'gen'])
print(f'Creating any missing patch branches.')
s = cmd_run(f'packaging/branch-from-patch --branch={args.master_branch} --add-missing')
if s.returncode:
@@ -301,8 +298,6 @@ About to:
os.rename(rsync_lastver, 'a')
print(f"Creating {diff_file} ...")
for cmd in MAKE_GEN_CMDS:
cmd_chk(cmd)
cmd_chk(['rsync', '-a', *extra_files, 'b/'])
sed_script = r's:^((---|\+\+\+) [ab]/[^\t]+)\t.*:\1:' # CAUTION: must not contain any single quotes!