summaryrefslogtreecommitdiff
path: root/web-server/wwwcvs-orig-files/modules/wwwgnu-nongnu/files/new.py
diff options
context:
space:
mode:
Diffstat (limited to 'web-server/wwwcvs-orig-files/modules/wwwgnu-nongnu/files/new.py')
-rw-r--r--web-server/wwwcvs-orig-files/modules/wwwgnu-nongnu/files/new.py72
1 files changed, 72 insertions, 0 deletions
diff --git a/web-server/wwwcvs-orig-files/modules/wwwgnu-nongnu/files/new.py b/web-server/wwwcvs-orig-files/modules/wwwgnu-nongnu/files/new.py
new file mode 100644
index 0000000..dd455a6
--- /dev/null
+++ b/web-server/wwwcvs-orig-files/modules/wwwgnu-nongnu/files/new.py
@@ -0,0 +1,72 @@
+import os,sys
+import string
+from mod_python import apache, util
+from syslog import *
+import stat
+
+# baughj, 2007.07.06 - add logging, usage of subprocess
+# baughj, 2007.07.16 - make sure to chgrp/chmod checked out directory so that
+# it can be updated by wwwcvs user later - why doesn't everything (cron job,
+# etc) run as one user?
+# add new 'translation' type for translation team webspace, see RT #348523.
+# ward, 2008-08-18
+
+# Stripped out actual cvs update, this script now just requests an update.
+# See /usr/local/bin/update-cvs.sh for the actual cvs update code (and that
+# script is run from cron)
+# ward, 2012-09-26
+
+CHECKOUT = "/var/www/savannah-checkouts/"
+LOGFILE = "/var/log/wwwcvs/new-savannah-project.log"
+
+def touch(fname, times=None):
+ with file(fname, 'a'):
+ os.utime(fname, times)
+ os.chmod(fname, stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | stat.S_IWGRP | stat.S_IROTH | stat.S_IWOTH)
+
+def request_update (type, project=''):
+ if type == 'www':
+ touch('/usr/local/to-update/www')
+ syslog(LOG_INFO, "Update requested for type: %s" % type)
+ return
+ touch('/usr/local/to-update/%s___%s' % (type, project))
+ syslog(LOG_INFO, "Update requested for type: %s (project %s)" % (type,project))
+ return
+
+def handler (req):
+ openlog('savannah-update', 0, LOG_LOCAL6)
+ form = util.FieldStorage (req)
+
+ req.content_type = 'text/html'
+ req.send_http_header ()
+
+ type = None
+ project = None
+ if form.has_key('type'):
+ type = form['type']
+ if form.has_key('project'):
+ project = form['project']
+
+ if (type == 'www'):
+ request_update('www')
+ req.content_type = 'text/html'
+ req.send_http_header ()
+ return apache.OK
+
+ if not (type and project):
+ syslog(LOG_ERR, 'Error: missing type or project. Aborting.')
+ return apache.HTTP_NOT_FOUND
+
+ if (type != 'gnu') and (type != 'non-gnu') and (type != 'translations'):
+ syslog(LOG_ERR, "Error: Type unknown, was %s. Aborting." % type)
+ return apache.HTTP_NOT_FOUND
+
+ if string.find (project, "/") != -1:
+ syslog(LOG_ERR, "Error: / found in project name %s" % project)
+ return apache.HTTP_NOT_FOUND
+
+ request_update(type,project)
+ req.content_type = 'text/html'
+ req.send_http_header ()
+
+ return apache.OK