Author: sopwith
Update of /cvs/dirsec/CVSROOT
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv20496
Modified Files:
loginfo syncmail
Log Message:
do *docs*
Index: loginfo
===================================================================
RCS file: /cvs/dirsec/CVSROOT/loginfo,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- loginfo 20 Oct 2005 18:48:52 -0000 1.8
+++ loginfo 8 Dec 2005 20:18:40 -0000 1.9
@@ -27,3 +27,4 @@
#DEFAULT (echo ""; id; echo %{sVv}; date; cat) >>
$CVSROOT/CVSROOT/commitlog
DEFAULT $CVSROOT/CVSROOT/syncmail %{sVv} cvsdirsec(a)fedora.redhat.com
ALL /cvs/extras/CVSROOT/dolog.pl -r /cvs/dirsec localdelivery(a)cvs-int.fedora.redhat.com
+ALL $CVSROOT/CVSROOT/syncmail --require-keyword='*docs*' %{sVv}
relnotes(a)fedoraproject.org
Index: syncmail
===================================================================
RCS file: /cvs/dirsec/CVSROOT/syncmail,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- syncmail 15 Apr 2005 15:43:19 -0000 1.1
+++ syncmail 8 Dec 2005 20:18:40 -0000 1.2
@@ -2,9 +2,10 @@
# -*- Python -*-
#
# PLEASE DO NOT EDIT THIS FILE IN PLACE IN THE CVS TREE!!!
-# check out the CVSROOT/admin directory on your local machine,
+# check out the CVSROOT directory on your local machine,
# make the changes there and commit. Otherwise your changes
# will be lost. --gafton
+# - updated by sopwith to add a --require-keyword option that only sends mail if
'keyword' is found in the comment message
#
# - updated by gafton to allow for --nodiff option. The nodiff option
# still sends out messages when something changes in a directory, but
@@ -62,6 +63,9 @@
Use <path> as the environment variable CVSROOT. Otherwise this
variable must exist in the environment.
+ --require-keyword=STRING
+ Only send mail if STRING is found in the commit message.
+
--nodiff
Don't bother generating the full diff, just report if the files changed
or not.
@@ -183,7 +187,7 @@
return string.join(lines, '')
# send mail using sendmail
-def blast_mail(subject, people):
+def blast_mail(subject, people):
global optDiffStat
# the redirection sequence in this command is actually intentional
@@ -198,7 +202,11 @@
del diff_files[-3:]
if diff_files[-3:] == ['-', 'Imported', 'sources']:
del diff_files[-3:]
-
+ commit_message = sys.stdin.read()
+ for I in optRequireKeyword:
+ if I not in commit_message:
+ return
+
# cannot wait for child process or that will cause parent to retain cvs
# lock for too long. Urg!
if not os.fork(): # in the child
@@ -206,20 +214,21 @@
time.sleep(2)
fp = os.popen(sendmail, 'w')
fp.write("Content-Type: TEXT/PLAIN; charset=US-ASCII\n")
- fp.write("Subject: %s\n" % subject)
- fp.write("To: %s\n" % people)
+ fp.write("Subject: %s\n" % (subject,))
+ fp.write("To: %s\n" % (people,))
if os.environ.has_key("CVSROOT"):
fp.write("X-CVSROOT: %s\n" % (os.environ["CVSROOT"],))
username = pwd.getpwuid(os.getuid())[0]
- fp.write("X-CVS-Module: %s\n" % cvs_module)
- fp.write("X-CVS-Directory: %s\n" % cvs_dir)
- fp.write("X-CVS-Server: %s\n" % (os.uname()[1],))
+ hostname = os.uname()[1]
+ fp.write("X-CVS-Module: %s\n" % (cvs_module,))
+ fp.write("X-CVS-Directory: %s\n" % (cvs_dir,))
fp.write("X-CVS-User: %s\n" % (username,))
+ fp.write("X-CVS-Server: %s\n" % (hostname,))
fp.write("Precedence: first-class\n")
fp.write("\n")
fp.write("Author: %s\n\n" % (username,))
# now insert the CVS blurb
- fp.write(sys.stdin.read())
+ fp.write(commit_message)
fp.write('\n')
# append the diffs if available and sensible
graphics = re.compile(r".*\.(jp(e)?g|gif|png|tif(f)?),", re.IGNORECASE)
@@ -245,14 +254,16 @@
global DIFF_HEAD_LINES
global DIFF_TAIL_LINES
global DIFF_TRUNCATE_IF_LARGER
+ global optRequireKeyword
try:
opts, args = getopt.getopt(sys.argv[1:], 'h', [
'cvsroot=', 'quiet', 'nodiff', 'nodiffstat',
'help',
- 'headlines=', 'taillines=', 'truncate='])
+ 'headlines=', 'taillines=', 'truncate=',
'require-keyword='])
except getopt.error, msg:
usage(1, msg)
+ optRequireKeyword = []
# parse the options
for opt, arg in opts:
if opt in ('-h', '--help'):
@@ -268,12 +279,14 @@
optDiffStat = 0
elif opt == '--nodiffstat':
optDiffStat = 0
- elif opt == 'headlines=':
+ elif opt == '--headlines':
DIFF_HEAD_LINES = arg
- elif opt == 'taillines=':
+ elif opt == '--taillines':
DIFF_TAIL_LINES = arg
- elif opt == 'truncate=':
+ elif opt == '--truncate':
DIFF_TRUNCATE_IF_LARGER = arg
+ elif opt == '--require-keyword':
+ optRequireKeyword.append(arg)
# What follows is the specification containing the files that were
# modified. The argument actually must be split, with the first component