Cool :) 

Attached is some documentation on what all the scripts do, and
step by step instructions for installing the whole system on a new CVS
repository.

--Jeff


On Sun, 4 Feb 2001, Jon Stevens wrote:

> on 2/4/01 12:03 AM, "Jeff Turner" <[EMAIL PROTECTED]> wrote:
> 
> > Hi,
> > 
> > I'd like to use the Jakarta CVS access control and commit emailing for a
> > company CVS server. This is the stuff get get if you run 'cvs checkout
> > CVSROOT'.
> > 
> > There isn't any indication that the files are under the APL (or any
> > license), so can I assume it's in the public domain and usable by anyone?
> > 
> > I'll post installation instructions if that's the case.
> > 
> > 
> > --Jeff
> 
> Yep, it is in the public domain. Have fun.
> 
> -jon
> 
> -- 
> If you come from a Perl or PHP background, JSP is a way to take
> your pain to new levels. --Anonymous
> <http://jakarta.apache.org/velocity/> | <http://java.apache.org/turbine/>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
Jeff Turner <[EMAIL PROTECTED]>
Written 4 Feb 2001
$Revision: 1.2 $ $Date: 2001/02/04 10:26:42 $

Introduction
============

This file documents the Apache projects' CVS setup, namely the contents of
the CVSROOT directory, and how to install the Apache CVS system on a new
system. All comments and improvements welcome.



Access Control Lists
====================

The Apache access control system is very flexible and very simple (much better
than the OS username technique described in the CVS book). The ACLs (access
control lists) determine whether a user has *write* access. Who has read access
is still determined by the 'readers', 'writers' and 'passwd' files. The Apache
ACLs work in addition to the standard CVS mechanism, not replacing it.

Here is a list of new files implementing the ACL, and what they do:

avail
          The access control lists for determining write access. See
          the description in cvs_acls.pl

cvs_acls.pl
          Program that parses 'avail' and decides whether a user has
          commit access

commit_prep.pl
          Once a user has been authenticated against the ACL, this
          script creates a list of the files modified in this commit.
          This data is stored for later use by the logging script
          log_accum.pl. In this way, log_accum.pl can combine
          changes in multiple directories, and mail a single message.

commitcheck
          Program invoked from commitinfo (the standard
          CVS hook into the commit process), which in turn invokes
          cvs_acls.pl and commit_prep.pl.




Commit message Mailing System
=============================

By default with CVS, if files README and src/Foo.java are modified, two
separate commit messages will be emailed to the committers. This is because CVS
has a very file-centric model, and has little idea of project-wide differences,
and thus doesn't associate the changes in README and src/Foo.java.

The Apache script 'log_accum.pl' works in tandem with the commit checking
script 'commit_prep.pl' to accumulate all changes made in one commit, and the
mailing *one* message to the list.

'log_accum.pl' by default mails an Apache list, and thus needs minor
modification. See below for details.




Getting ACLs working on a new system
====================================

Here are the steps I performed to use the Apache CVSROOT system on a new CVS
repository:

1) Download the Apache CVSROOT directory as follows:

  [~/jakarta]$ cvs -d :pserver:[EMAIL PROTECTED]:/home/cvspublic login
  password: anoncvs
  [~/jakarta]$ cvs -d :pserver:[EMAIL PROTECTED]:/home/cvspublic checkout 
CVSROOT


2) Download the new server CVSROOT directory:

  [~/server]$ cvs -d :ext:jeff@localhost:/usr/local/src/CVS
  [~/server]$ cvs checkout CVSROOT


3) Tag the current version of new server's CVSROOT from a CVSROOT sandbox: 

  [~/server/CVSROOT]$ cvs tag before_apache


4) Copy the following files from the checked-out jakarta CVSROOT to the
checked-out server CVSROOT:

  [~/server/CVSROOT]$ cp ~/jakarta/CVSROOT/commitcheck .
  [~/server/CVSROOT]$ cp ~/jakarta/CVSROOT/cvs_acls.pl .
  [~/server/CVSROOT]$ cp ~/jakarta/CVSROOT/commit_prep.pl .
  [~/server/CVSROOT]$ cp ~/jakarta/CVSROOT/avail .


5) Add these new files to the 'checkoutlist' file, so they'll be checked out on
the server CVSROOT:

[~/server/CVSROOT]$ cat >> checkoutlist 
commitcheck
cvs_acls.pl
commit_prep.pl
avail
[$/server/CVSROOT]$


6) Add the new files to CVS, and do a 'cvs update':

[~/server/CVSROOT]$ cvs add cvs_acls.pl commit_prep.pl commitcheck avail 
[~/server/CVSROOT]$ cvs up
A avail
M checkoutlist
A commit_prep.pl
A commitcheck
M commitinfo
A cvs_acls.pl


7) Edit the ACL to allow everyone to edit everything (or customise it now):

[~/server/CVSROOT]$ cat avail
avail
[~/server/CVSROOT]$


8) As a test, forbid yourself commit to a project, in my case 'proj/usl':

[~/server/CVSROOT]$ cat avail
avail
unavail|jeff|proj/usl

[~/server/CVSROOT]$

When I try to commit a change, I get this message:

**** Access denied: Insufficient Karma (jeff|proj/usl)
cvs server: Pre-commit check failed
cvs [server aborted]: correct above errors first!
cvs commit: saving log message in /tmp/cvsz0gU4N

9) Fix the 'avail' file to whatever you want and commit.

10) Tag the CVSROOT to indicate that ACLs are working:

[~/server/CVSROOT]$ cvs tag with_acls




Getting commit logs working on a new system
===========================================


1) Copy the logging files from Jakarta CVSROOT to server CVSROOT:

[~/server/CVSROOT]$ cp ~/jakarta/CVSROOT/loginfo .
[~/server/CVSROOT]$ cp ~/jakarta/CVSROOT/log_accum.pl .


2) Add the new file to CVS:

[~/server/CVSROOT]$ cvs add log_accum.pl 
cvs server: use 'cvs commit' to add this file permanently


3) Add the extra file to 'checkoutlist':

[~/server/CVSROOT]$ cat >> checkoutlist 
log_accum.pl
[~/server/CVSROOT]$ 

4) Add 'log_accum.pl:

[~/server/CVSROOT]$ cvs add log_accum.pl


5) Edit log_accum.pl thusly, customising the email address:

[~/server/CVSROOT]$ diff ~/jakarta/CVSROOT/log_accum.pl log_accum.pl 
53c53
< $MAIL_TO       = 'apache-cvs';
---
> $MAIL_TO       = 'jeff@localhost';
341,343c341,343
<  if (defined($mlist)) {
<      $MAIL_TO = $mlist . "-cvs\@$MLISTHOST";
<  }
---
> # if (defined($mlist)) {
> #     $MAIL_TO = $mlist . "-cvs\@$MLISTHOST";
> # }


6) Create a 'commitlogs' directory in the server *repository* CVSROOT
directory, and make it owned by group 'cvs' (or equivalent):

[/usr/local/src/CVS/CVSROOT]# mkdir commitlogs
[/usr/local/src/CVS/CVSROOT]# chgrp -R cvs commitlogs
[/usr/local/src/CVS/CVSROOT]# ls -la commitlogs
drwxr-xr-x   2 jeff     cvs          4096 Feb  4 16:16 commitlogs
[/usr/local/src/CVS/CVSROOT]#

This is where log_accum.pl will store its logs.


7) Now commit the changes to CVSROOT

[~/server/CVSROOT]$ cvs commit


8) Try making a change to a file and commit. You should see the following:

checking log message for correctness...
Success
Checking in README;
/usr/local/src/CVS/share/csgi/README,v  <--  README
new revision: 1.2; previous revision: 1.1
done
Mailing the commit message...


8) Check on the mailing list or email address for the mail to come through.

All done!
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to