head	1.27;
access;
symbols
	newcvs:1.1.1.1
	NEWCVS:1.1.1;
locks; strict;
comment	@# @;


1.27
date	2004.09.01.03.12.06;	author kuriyama;	state Exp;
branches;
next	1.26;

1.26
date	2002.10.13.23.25.06;	author peter;	state Exp;
branches;
next	1.25;

1.25
date	2002.10.13.23.24.15;	author peter;	state Exp;
branches;
next	1.24;

1.24
date	2002.10.13.22.22.29;	author peter;	state Exp;
branches;
next	1.23;

1.23
date	2001.11.15.13.09.58;	author joe;	state Exp;
branches;
next	1.22;

1.22
date	2001.11.15.12.37.03;	author joe;	state Exp;
branches;
next	1.21;

1.21
date	2001.11.15.12.35.33;	author joe;	state Exp;
branches;
next	1.20;

1.20
date	2001.11.15.12.29.40;	author joe;	state Exp;
branches;
next	1.19;

1.19
date	2001.11.15.12.27.55;	author joe;	state Exp;
branches;
next	1.18;

1.18
date	2001.10.30.10.45.56;	author joe;	state Exp;
branches;
next	1.17;

1.17
date	2001.10.24.01.25.27;	author joe;	state Exp;
branches;
next	1.16;

1.16
date	2001.08.30.23.18.17;	author joe;	state Exp;
branches;
next	1.15;

1.15
date	2001.08.30.23.17.32;	author joe;	state Exp;
branches;
next	1.14;

1.14
date	2001.08.30.21.52.48;	author joe;	state Exp;
branches;
next	1.13;

1.13
date	2000.04.12.02.59.17;	author obrien;	state Exp;
branches;
next	1.12;

1.12
date	99.09.19.13.11.03;	author peter;	state Exp;
branches;
next	1.11;

1.11
date	99.08.27.22.46.56;	author peter;	state Exp;
branches;
next	1.10;

1.10
date	99.08.08.12.36.03;	author peter;	state Exp;
branches;
next	1.9;

1.9
date	99.01.25.01.28.13;	author peter;	state Exp;
branches;
next	1.8;

1.8
date	99.01.24.20.07.28;	author peter;	state Exp;
branches;
next	1.7;

1.7
date	97.05.26.04.07.36;	author peter;	state Exp;
branches;
next	1.6;

1.6
date	97.05.21.15.58.59;	author peter;	state Exp;
branches;
next	1.5;

1.5
date	96.12.23.05.42.37;	author peter;	state Exp;
branches;
next	1.4;

1.4
date	96.02.07.14.35.35;	author peter;	state Exp;
branches;
next	1.3;

1.3
date	95.11.27.05.11.50;	author peter;	state Exp;
branches;
next	1.2;

1.2
date	95.04.18.19.56.26;	author rgrimes;	state Exp;
branches;
next	1.1;

1.1
date	94.05.24.08.59.41;	author rgrimes;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	94.05.24.08.59.42;	author rgrimes;	state Exp;
branches;
next	;


desc
@@


1.27
log
@Avoid warning when cvs has only three numbers in its version string.
@
text
@#!/usr/bin/perl -w
#
# $FreeBSD$

#
# This script is the first thing that is run at commit time
# to determine whether the committer has commit priviledges.
# (See CVSROOT/commitinfo).
#

use strict;
use lib $ENV{CVSROOT};
use CVSROOT::cfg;
my $CVSROOT = $ENV{CVSROOT} || die "Can't determine CVSROOT (commitcheck)!\n";

# Check that the user is committing on the right machine.
#
use Sys::Hostname;
my $hostname = hostname();
if (@@cfg::COMMIT_HOSTS && !grep(/^\Q$hostname\E$/i, @@cfg::COMMIT_HOSTS)) {
	print "Please don't commit on this host!\n";
	print "Please commit on ",
	    join(" or ", @@cfg::COMMIT_HOSTS),
	    " instead.\n";
	exit 1;
}


# Run locally defined extra commitchecks.
if (defined($cfg::COMMITCHECK_EXTRA) && $cfg::COMMITCHECK_EXTRA) {
	die 'commitcheck: $cfg::COMMITCHECK_EXTRA isn\'t a sub!'
	    unless ref($cfg::COMMITCHECK_EXTRA) eq "CODE";

	die "Failed commitcheck_extra\n" unless &$cfg::COMMITCHECK_EXTRA();
}


#
# Ensure the minimum version of cvs is installed.
#
my $VERSTR = `$cfg::PROG_CVS -v`;
$VERSTR =~ s/.*Concurrent\D*(\S*).*/$1/s;
$VERSTR =~ s/\D+/./g;
$VERSTR =~ s/\.$/.0/;
my $VERSION = sprintf "%d%02d%02d%02d\n", split /\./, $VERSTR;
unless ($VERSION && $VERSION >= $cfg::MINCVSVERSION) {
	print "The wrong version of CVS is installed (commitcheck)!\n";
	exit 1;
}


#
# Does the access control list allow them commit access?
#
system("$CVSROOT/CVSROOT/cvs_acls.pl", @@ARGV);
if ($? >> 8) {
	print "Access control checks failed! (cvs_acls.pl)\n";
	exit 1;
}

#
# Last minute checks and preparations for log_accum.pl later.  This
# records the last directory in this commit so that log_accum knows when
# to finish coalescing commit messages and mail it.
#
system("$CVSROOT/CVSROOT/commit_prep.pl", @@ARGV);
if ($? >> 8) {
	print "commit_prep.pl failed!\n";
	exit 1;
}

exit 0;		# Lets do it!

#end
@


1.26
log
@Lets see if we are back in business.
@
text
@d44 1
@


1.25
log
@Here we go, lets see if we are back in business..
@
text
@@


1.24
log
@*plonk*.  Turn off commits for a while.
@
text
@a15 2
die "No commits please while stuff gets moved around. Please try later.\n";

@


1.23
log
@Replace a reference that I missed to cvs with $cfg::PROG_CVS.

Submitted by:	Mathieu Arnold <arn_mat@@club-internet.fr>
@
text
@d16 1
@


1.22
log
@Relegate the group check that we do in the FreeBSD project to the
configuration file using the new COMMITCHECK_EXTRA config option.
@
text
@d42 1
a42 1
my $VERSTR = `/usr/bin/cvs -v`;
@


1.21
log
@Add a new configuration option: COMMITCHECK_EXTRA.  This is a
reference to an anonymous subroutine that if defined gets run at
commitcheck time.  It allows the admin to run further checks to
see whether committing is allowed.
@
text
@a29 11
# Sanity check to make sure we've been run through the wrapper and are
# now primary group 'ncvs'.
#
my $GRP=`/usr/bin/id -gn`;
chomp $GRP;
unless ( $GRP =~ /^ncvs$/ ) {
	print "You do not have group ncvs (commitcheck)!\n";
	exit 1;
}


@


1.20
log
@Rewrite the file comment now that all the FreeBSD specific stuff
has been removed.
@
text
@d29 1
d39 10
@


1.19
log
@Move the definition of the minimum version of cvs that we'll work with
into the configuration file.
@
text
@d6 3
a8 4
# BEWARE:  If you are "borrowing" this code for use on another cvs
# repository, please make sure you change all references to '@@FreeBSD.org'
# in the log_accum script.  Otherwise your commit messages will be sent
# to 'cvs-committers@@freebsd.org' etc.  This could be highly embarrassing. :-)
@


1.18
log
@Add the hosts that we're allowed to commit on to the configuration
file instead of hard coding them.
@
text
@a14 2


a16 1
my $MINCVSVERSION = "1090900";	# 1.9.9p0
d47 1
a47 1
unless ( $VERSION && $VERSION >= $MINCVSVERSION ) {
@


1.17
log
@Rip out the final references to internat.freebsd.org.

Requested by:	will
@
text
@d13 3
d23 1
a23 1
use Sys::Hostname;			# get hostname() function
d25 5
a29 2
if ($hostname !~ /^freefall.freebsd.org$/) {
	print "Please commit on Freefall!\n";
@


1.16
log
@Test that this script still works in practice.
@
text
@d3 1
a3 1
# $FreeBSD: CVSROOT/commitcheck,v 1.15 2001/08/30 23:17:32 joe Exp $
d22 1
a22 2
if ($hostname !~ /^freefall.freebsd.org$/ &&
    $hostname !~ /^internat.freebsd.org$/) {
a23 1
	print "(or Internat for crypto.)\n";
@


1.15
log
@This is the captain speaking.  Fasten your seat belts and relax; we don't
envisage any turbulence but just in case....

Convert this script from shell to perl.
@
text
@d3 1
a3 1
# $FreeBSD: CVSROOT/commitcheck,v 1.14 2001/08/30 21:52:48 joe Exp $
@


1.14
log
@Fix some typos.
@
text
@d1 1
a1 1
#! /bin/sh
d3 1
a3 1
# $FreeBSD: CVSROOT/commitcheck,v 1.13 2000/04/12 02:59:17 obrien Exp $
d11 27
a37 16
case "`hostname | tr A-Z a-z`" in
freefall.freebsd.org|internat.freebsd.org)
	# Sanity check to make sure we've been run through the wrapper and are
	# now primary group 'ncvs'.
	#
	GRP=`/usr/bin/id -gn`
	if [ "x$GRP" != "xncvs" ]; then
		echo "You do not have group ncvs!"
		exit 1
	fi
	;;
*)
	echo "Please commit on Freefall\!"
	echo "(and Internat for crypto.)"
	exit 1
esac
d42 8
a49 5
VERS=`/usr/bin/cvs -v | awk '$1 == "Concurrent" { print $5 }' | awk -F. '{printf "%d%02d%02d\n",$1,$2,$3}'`
if [ "x${VERS}" = "x" -o ${VERS} -lt 10909 ]; then
	echo "The wrong version of CVS is installed!" 1>&2
	exit 1
fi
d55 5
a59 7
if $CVSROOT/CVSROOT/cvs_acls.pl ${1+"$@@"}
then
	:	# OK
else
	echo "Access control checks failed! (cvs_acls.pl)" 1>&2
	exit 1
fi
d66 7
a72 7
if $CVSROOT/CVSROOT/commit_prep.pl ${1+"$@@"}
then
	:	# OK
else
	echo "commit_prep.pl failed!" 1>&2
	exit 1
fi
d74 1
a74 1
exit 0		# Lets do it!
@


1.13
log
@Move the group NCVS check to the freebsd.org section.  This reduces the
amount of editing one needs to do to use the FreeBSD CVSROOT configuration
on other projects.

Approved by:	peter
@
text
@d3 1
a3 1
# $FreeBSD: CVSROOT/commitcheck,v 1.12 1999/09/19 13:11:03 peter Exp $
d9 1
a9 1
# to 'cvs-committers@@freebsd.org' etc.  This could be highly embarresing. :-)
d50 1
a50 1
# Last minute checks and preperations for log_accum.pl later.  This
@


1.12
log
@Sync with internat.freebsd.org crypto repo.  (part 1)

Submitted by:	markm
@
text
@d3 1
a3 1
# $FreeBSD: CVSROOT/commitcheck,v 1.11 1999/08/27 22:46:56 peter Exp $
d12 9
a20 5
freefall.freebsd.org)
	:
	;;
internat.freebsd.org)
	:
a26 10

#
# Sanity check to make sure we've been run through the wrapper and are now
# primary group 'ncvs'.
#
GRP=`/usr/bin/id -gn`
if [ "x$GRP" != "xncvs" ]; then
	echo "You do not have group ncvs!"
	exit 1
fi
@


1.11
log
@$Id$ -> $FreeBSD$
@
text
@d3 1
a3 1
# $FreeBSD$
d15 3
d19 2
a20 1
	echo "Please commit on freefall...."
@


1.10
log
@Check for group ncvs before we get in too far.
@
text
@d3 1
a3 1
# $Id: commitcheck,v 1.9 1999/01/25 01:28:13 peter Exp $
@


1.9
log
@Reenable cvs commits on freefall.
@
text
@d3 1
a3 1
# $Id: commitcheck,v 1.8 1999/01/24 20:07:28 peter Exp $
d19 10
@


1.8
log
@block commit
@
text
@d3 1
a3 5
# $Id: commitcheck,v 1.7 1997/05/26 04:07:36 peter Exp $

echo "Freefall is half way through an upgrade and lots of things are broken.."
echo "cvs is currently failing until the new kernel goes in."
exit 1
@


1.7
log
@Update version check to cope with the probability that cvs will soon bump
it's version digits into double digits, eg: cvs-1.10.0.  Bump minimum
number for the version installed on freefall.
@
text
@d3 5
a7 1
# $Id: commitcheck,v 1.6 1997/05/21 15:58:59 peter Exp $
@


1.6
log
@Put a warning next to the check for commits on freefall about the mail
being sent to cvs-*@@freebsd.org.  Also, some minor cosmetic tweaks.
Reviewed by:
Submitted by:
Obtained from:
@
text
@d3 1
a3 1
# $Id: commitcheck,v 1.5 1996/12/23 05:42:37 peter Exp $
d23 2
a24 2
VERS=`/usr/bin/cvs -v | awk '$1 == "Concurrent" { print $5 }' | tr -d .`
if [ "x${VERS}" = "x" -o ${VERS} -lt 180 ]; then
@


1.5
log
@Add a check to make sure that cvs on freefall isn't spammed again with
an older version!
@
text
@d3 1
a3 1
# $Id: commitcheck,v 1.4 1996/02/07 14:35:35 peter Exp $
d5 8
a12 2
case "`hostname`" in
freefall*)
d20 3
d25 1
a25 1
	echo "The wrong version of CVS is installed!"
d30 22
a51 4
if $CVSROOT/CVSROOT/cvs_acls.pl ${1+"$@@"}; then
   if $CVSROOT/CVSROOT/commit_prep.pl ${1+"$@@"}; then
      exit 0
   fi
d54 1
a54 1
exit 1
@


1.4
log
@Attempt to fix some outstanding bugs/misfeatures/bogons in the CVSROOT
code, as well as simplifying some admin procedures.

The main change is to stop multi-directory commits only having the subject
info of the last directory, and not being sent to all the lists, and not
being logged to the appropriate commitlogs.

updateCVSROOT is gone (yay!), it's functionality is replaced by a cvs-1.6
feature - the 'checkoutlist' file, which is designed explicitly for this.
This will stop the easy-import users from getting told the mailing list
is out of date when a committer has been added but had missed out on being
put on the cvs-committers mailing list.

Update the comments and info in the *info files with the cvs-1.6 headers,
this fixes a few typos, clarifys some things, corrects some misleading
comments, etc.

Some stub files added to indicate how new cvs-1.6+ functionality is used,
but left commented out (taginfo, cvswrappers, etc)

All hard-coded references to /home/ncvs are changed back to $CVSROOT
(as suggested to me by bde) now that cvs-1.6+ makes a special effort
to ensure $CVSROOT is always set.  This allows the $CVSROOT files to be
used elsewhere (eg: for testing) with much less pain.

mkavail is history as well, it was often being forgotten.  cvs-committers
now takes the user list from /etc/group:ncvs via a trivial perl script.
This is so that we still have the ability to temporarily disable commit
access via 'avail' without cutting off the cvs-committers mailing list.
Since /etc/group editing is still required, this is not a new admin
overhead.  If we ever change so that membership of "ncvs" is not required
(eg: /usr/bin/cvs becomes setgid and access control is via avail) then
we are going to have to do it some other way.  (I have ideas)

I have tested this on my machines, but it is possible that I have missed
something.  As usual, please yell if I've botched it.
@
text
@d3 1
a3 1
# $Id$
d13 7
@


1.3
log
@Correct typo "commiters" -> "committers" as noticed by Satoshi
Also, try a simple sanity check in "commitcheck" to try and head off
accidental commits on thud over NFS...
@
text
@d14 2
a15 2
if /usr/bin/perl $CVSROOT/CVSROOT/cvs_acls.pl ${1+"$@@"}; then
   if /usr/bin/perl $CVSROOT/CVSROOT/commit_prep.pl ${1+"$@@"}; then
@


1.2
log
@Hard code path to perl as /usr/bin/perl so we stop picking it up from
/usr/local.

Submitted by:	asami
@
text
@d3 10
a12 1
# $FreeBSD$
@


1.1
log
@Initial revision
@
text
@d5 2
a6 2
if perl $CVSROOT/CVSROOT/cvs_acls.pl ${1+"$@@"}; then
   if perl $CVSROOT/CVSROOT/commit_prep.pl ${1+"$@@"}; then
@


1.1.1.1
log
@Initial CVSROOT setup
@
text
@@
