On Tue, 2010-12-21 at 19:09 +0000, Karl Berry wrote:
> - we migrate to something more modern, i.e. allowing each project to
>       choose its own VCS for webpages (this has been requested by users
>       numerous times);
> 
> Indeed.  The issue at hand has been resolved and webmasters have access
> to the GNU web page CVS repos again.
> 
> For the record, though, here is my argument for keeping those GNU /web
> pages under CVS for the time being.  I wrote this in response to someone
> who asked me about switching his package's web pages to git:
> 
> 1) no single VC would suit everyone;
> 
> 2) supporting multiple VC's would require lots of changes to the
>    infrastructure and tools, taking lots of time -- especially of the
>    FSF sysadmins, whose time is scarcest of all;

The fsf-side does just an update.

Some time ago, tired of having to remember which VCS was being used by
each of the projects I follow occasionally, I wrote a trivial script
called "up" which guesses the repository format and calls the
appropriate command. Please find it attached.

If we replace explicit calls to "cvs up" with this script, we've solved
half of the problem. The other half of the problem is the initial
checkout, for which we'd need to be explicitly told which VCS to use, or
by trying all the supported formats in sequence.


> Anyway, the first change to be made in this regard will be to switch www
> itself from CVS, primarily so changes can be better tested on something
> other than the live www.gnu.org.  (Yavor, by now you've probably seen
> the www-discuss mail about that.  Email me with your thoughts ...)
> After that happens, maybe we can turn our attention to the project
> repos.

Agreed. For reference, I'm attaching the web-server side of the script
which updates www, gnu and non-gnu projects.

-- 
   // Bernie Innocenti - http://codewiz.org/
 \X/  Sugar Labs       - http://sugarlabs.org/

Attachment: up
Description: application/shellscript

import os,sys
import string
from mod_python import apache, util
import subprocess
import time
from syslog import *

# 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

CHECKOUT = "/var/www/savannah-checkouts/"
LOGFILE = "/var/log/wwwcvs/new-savannah-project.log"

def updatewww ():
    os.chdir ('/var/www/')
    os.environ["CVS_RSH"] = 'ssh'

    syslog(LOG_INFO,"Working...")
    try:
        cvs = subprocess.Popen(['/usr/bin/sudo','-u','wwwcvs','/usr/bin/cvs',"update", "-Pd", '.'],
                               stdout=subprocess.PIPE,
                               close_fds=True)
    except Exception, e:
        syslog(LOG_ERR,"Unknown exception occured in CVS update of /var/www")
        syslog(LOG_ERR,"Exception was: %s" % e)
        req.content_type = 'text/html'
        req.send_http_header()
        req.write("CVS update failed: %s" % e)
        return apache.OK
                                    
    # This is a blocking read
    syslog(LOG_INFO, cvs.stdout.read())

def handler (req):
    openlog('savannah-cvs-commit', 0, LOG_LOCAL6)
    syslog(LOG_INFO, "Request received...")
    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']

    syslog(LOG_INFO, "type: %s" % type)
    syslog(LOG_INFO, "project: %s" % project)

    if (type == 'www'):
        syslog(LOG_INFO, "/var/www: Beginning checkout")
        updatewww()
        req.content_type = 'text/html'
        req.send_http_header ()
        syslog(LOG_INFO, "/var/www: checkout done")
        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

    syslog(LOG_INFO, "New/update project request: %s (%s)" % (type,project))

    os.chdir (CHECKOUT + type)
    os.environ["CVS_RSH"] = 'ssh'

    try:
        syslog(LOG_INFO, "%s: Beginning checkout" % project)
        cvs = subprocess.Popen(['/usr/bin/sudo','-u','wwwcvs','/usr/bin/cvs',"-d",":pserver:[email protected]:/webcvs/%s" % project,
                                "checkout", "-P", project],
                               stdout=subprocess.PIPE,
                                close_fds=True)
    except Exception, msg:
        syslog(LOG_ERR, "%s: Unknown exception occured in CVS subprocess (%s)" % (project,msg))
        req.content_type = 'text/html'
        req.send_http_header()
        req.write("CVS checkout failed: %s" % msg)
        return apache.OK

    # This is a blocking read
    syslog(LOG_INFO, cvs.stdout.read())

    syslog(LOG_INFO, "%s: CVS checkout completed." % project)
    #syslog(LOG_INFO, "%s: CVS checkout completed. Fixing permissions..." % project)
    #try:
    #    retcode = subprocess.call(["/bin/chgrp", "-R", "wwwcvs",
    #                               "%s%s/%s" % (CHECKOUT, type, project)])
    #    retcode2 = subprocess.call(["/bin/chmod", "-R", "g+rw",
    #                                "%s%s/%s" % (CHECKOUT, type, project)])

    #    if (retcode, retcode2) != (0,0):            
    #        syslog(LOG_ERR, "%s: ERROR: chgrp returned %s" % (project,retcode))
    #        syslog(LOG_ERR, "%s: ERROR: chmod returned %s" % (project,retcode2))
    
    #except Exception, e:
    #    syslog(LOG_INFO, "error")
    #    syslog(LOG_INFO, "%s: ERROR: %s" % (project,e))
        
    #syslog(LOG_INFO, "%s: Permissions updated." % project)
    syslog(LOG_INFO, "%s: Complete." % project)
    req.content_type = 'text/html'
    req.send_http_header ()

    #req.write ("cvs checkout complete")

    return apache.OK

Reply via email to