aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjoe <joe@FreeBSD.org>2001-11-15 20:35:33 +0800
committerjoe <joe@FreeBSD.org>2001-11-15 20:35:33 +0800
commit58e7d63643c07c23319ebe79c89e9652f890a6a5 (patch)
tree16765977a13ecb91d01d9a09649b968f32be6446
parent3795775ad7428efb3a05f3b3f8d6d13ed26e9034 (diff)
downloadfreebsd-ports-gnome-58e7d63643c07c23319ebe79c89e9652f890a6a5.tar.gz
freebsd-ports-gnome-58e7d63643c07c23319ebe79c89e9652f890a6a5.tar.zst
freebsd-ports-gnome-58e7d63643c07c23319ebe79c89e9652f890a6a5.zip
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.
-rwxr-xr-xCVSROOT/cfg.pm14
-rwxr-xr-xCVSROOT/commitcheck11
2 files changed, 21 insertions, 4 deletions
diff --git a/CVSROOT/cfg.pm b/CVSROOT/cfg.pm
index 705f7f4ca821..eabc2bc565fb 100755
--- a/CVSROOT/cfg.pm
+++ b/CVSROOT/cfg.pm
@@ -14,10 +14,11 @@
package cfg;
use strict;
use vars qw(
- $ADD_TO_LINE $CHECK_HEADERS $DEBUG $EXCLUDE_FILE $FILE_PREFIX
- $IDHEADER $LAST_FILE $MAILADDRS $MAILBANNER $MAILCMD $MAIL_BRANCH_HDR
- $MAIL_ON_DIR_CREATION $MAIL_TRANSFORM $MINCVSVERSION $PID $PROG_CVS
- $PROG_MV $TMPDIR $UNEXPAND_RCSID %TEMPLATE_HEADERS @COMMIT_HOSTS
+ $ADD_TO_LINE $CHECK_HEADERS $COMMITCHECK_EXTRA $DEBUG $EXCLUDE_FILE
+ $FILE_PREFIX $IDHEADER $LAST_FILE $MAILADDRS $MAILBANNER $MAILCMD
+ $MAIL_BRANCH_HDR $MAIL_ON_DIR_CREATION $MAIL_TRANSFORM $MINCVSVERSION
+ $PID $PROG_CVS $PROG_MV $TMPDIR $UNEXPAND_RCSID %TEMPLATE_HEADERS
+ @COMMIT_HOSTS
);
my $CVSROOT = $ENV{'CVSROOT'} || die "Can't determine \$CVSROOT!";
@@ -62,6 +63,11 @@ $PROG_MV = '/bin/mv'; # mv(1)
# The minimum version of cvs that we will work with.
$MINCVSVERSION = "1090900"; # 1.9.9p0
+# Additional commit time checks. This is an anonymous subroutine
+# that gets called early on in the validation process to see whether
+# the committer is allowed to commit.
+$COMMITCHECK_EXTRA = "";
+
################
### logcheck ###
diff --git a/CVSROOT/commitcheck b/CVSROOT/commitcheck
index aa58ef37d0a6..65e0bc929468 100755
--- a/CVSROOT/commitcheck
+++ b/CVSROOT/commitcheck
@@ -26,6 +26,7 @@ if (@cfg::COMMIT_HOSTS && !grep(/^\Q$hostname\E$/i, @cfg::COMMIT_HOSTS)) {
exit 1;
}
+
# Sanity check to make sure we've been run through the wrapper and are
# now primary group 'ncvs'.
#
@@ -36,6 +37,16 @@ unless ( $GRP =~ /^ncvs$/ ) {
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.
#