antoniop
committed
on 17 Mar 23
Move api in a namespace to comply with automated tests
CVSROOT/postcommit_actions (+6 -2)
1 1 #!/usr/local/bin/python2.3
2 2
3 3 # Adapted by bdolicki for openacs.org
4 4 # Changes to http://dev.zope.org/CVS/postcommit_actions :
5 5 #   001  The original file forced python2.1.  We are using python2.3 and it works
6 6 #   fine.
7 7 #   002  Set some variables
8 8 #   003  We want to put something like username@openacs.org as the sender email.
9 9 #        (too bad we don't have LDAP, actually)
  10 #   004  Reduced size of sent emails
10 11
11 12 """Apply checkin actions dictated by traffic_table.py, as checkins occur.
12 13
13 14 Special provisions to fork into the background, disconnected from tty, so
14 15 the user and (more critically) CVS locks aren't held just pending completion
15 16 of notification and other potentially meandering actions.
16 17
17 18 Options:
18 19
19 20  --verbose - operate in verbose mode, with output to OUTPUT_LOG in the
20 21              detached copy, and to stdout before the detach (and forever if
21 22              --wait specified)
22 23
23 24  --dryrun - do not actually do any of the activities
24 25
25 26  --wait - do not fork into the background (and leave output in stdout/stderr)
26 27           This is for internal use by the script when forking.
27 28
28 29  --msgfile MSGFILENM - internal - get log message from MSGFILENM (and delete)
29 30
 
59 60 import getopt
60 61 import smtplib
61 62 import socket, whrandom, getpass
62 63
63 64 CVSROOT = os.path.split(SCRIPT_DIR)[0]
64 65 CVSROOT_ABS = os.path.abspath('..')
65 66 # 002
66 67 #USE_LDAP = 1
67 68 USE_LDAP = 0
68 69 LDAP_PORT = 389
69 70 LDAP_HOST = "your.ldap.host"
70 71 # 002 TODO is it OK to use this address?
71 72 #OFFICIAL_SENDER = "cvs-admin@your.domain"
72 73 OFFICIAL_SENDER = "webmaster@openacs.org"
73 74
74 75 # 003
75 76 MY_DOMAIN = "openacs.org"
76 77
77 78 # Ceiling on number of lines per file report (diff or "added"), at which point
78 79 # we go to excerpts from the beginning and end:
79   FILE_LINES_LIMIT = 1500
  80 # 004
  81 #FILE_LINES_LIMIT = 1500
  82 FILE_LINES_LIMIT = 500
80 83 # Number of lines in beginning and end excerpts when FILE_LINES_LIMIT is hit:
81   FILE_EXCERPTS_LINES = 200
  84 #FILE_EXCERPTS_LINES = 200
  85 FILE_EXCERPTS_LINES = 50
82 86
83 87 CUSTOM_TRAFFIC_TABLE = "%s/custom_traffic_table.py" % CVSROOT
84 88
85 89 import re
86 90
87 91 import traffic_table
88 92 import adjustlinks
89 93
90 94 # Hook up with an outboard file.
91 95 if os.path.exists(CUSTOM_TRAFFIC_TABLE):
92 96     execfile(CUSTOM_TRAFFIC_TABLE)
93 97
94 98 # OUTPUT_LOG must be writable by anyone whose checkins will invoke this
95 99 # script in order for their logging to happen.
96 100 OUTPUT_LOG = "%s/cvs-postcommit_actions.log" % CVSROOT
97 101
98 102 # Set CVSMASTER to the email address of someone managing your CVS mirroring.
99 103 # Notices about any caught malfunctions will be sent to this address.
100 104 # 002 TODO is it OK to use this address?
101 105 #CVSMASTER = "cvs-admin@zope.com"