Commit 9b17b075 authored by Leigh Stoller's avatar Leigh Stoller

Oh, such a silly little project ... Added CVS support to Emulab. When

enabled in the defs file:

	CVSSUPPORT=1

each project gets a stub CVS tree created (using 'cvs init') in
/proj/$pid/CVS. It is up to users obviously to do something with
that tree, and of course they have to either set their CVSROOT
env variable, or use the -d option to cvs.

The showproject page gets a link to the per-project CVS tree, using
the cvsweb interface, which I hacked up a bit to allow restricted
access to specific project trees, via a ?pid=$pid argument to the URL.
Without the ?pid argument, it falls back to normal behaviour, which is
check the cvsallowed bit in the users table, and provide access to the
Emulab source repo.

If you are curious, go here:

	https://www.emulab.net/cvsweb/cvsweb.php3/?pid=testbed
parent fe97cadb
......@@ -1363,6 +1363,7 @@ done
#
......@@ -1413,6 +1414,7 @@ PLAB_ROOTBALL="change.me"
PLAB_SLICEPREFIX="utah_elab"
WIKISUPPORT=0
WINSUPPORT=0
CVSSUPPORT=0
TBLOGFACIL="local5"
LINKTEST_NSPATH="/share/linktest-ns"
BOSSEVENTPORT=2927
......@@ -1919,17 +1921,17 @@ for ac_hdr in ulxmlrpcpp/ulxr_config.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:1923: checking for $ac_hdr" >&5
echo "configure:1925: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1928 "configure"
#line 1930 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1933: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1935: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
......@@ -1968,17 +1970,17 @@ for ac_hdr in linux/videodev.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:1972: checking for $ac_hdr" >&5
echo "configure:1974: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1977 "configure"
#line 1979 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1982: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1984: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
......@@ -2011,7 +2013,7 @@ done
# Extract the first word of "gtk-config", so it can be a program name with args.
set dummy gtk-config; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:2015: checking for $ac_word" >&5
echo "configure:2017: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_GTK_CONFIG'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
......@@ -2090,7 +2092,7 @@ fi
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
echo "configure:2094: checking for a BSD compatible install" >&5
echo "configure:2096: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
......@@ -2151,7 +2153,7 @@ esac
# Extract the first word of "rsync", so it can be a program name with args.
set dummy rsync; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:2155: checking for $ac_word" >&5
echo "configure:2157: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_RSYNC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
......@@ -2309,6 +2311,7 @@ outfiles="$outfiles Makeconf GNUmakefile \
tools/GNUmakefile \
tools/pcapper/GNUmakefile tools/teachswitch/GNUmakefile \
tools/webcamapplet/GNUmakefile tools/whol/GNUmakefile \
tools/selectapplet/GNUmakefile \
$eventfiles \
$winfiles \
apache/GNUmakefile apache/httpd.conf \
......@@ -2584,6 +2587,7 @@ s%@SSLCERT_ORGNAME@%$SSLCERT_ORGNAME%g
s%@FRISEBEEMCASTADDR@%$FRISEBEEMCASTADDR%g
s%@FRISEBEEMCASTPORT@%$FRISEBEEMCASTPORT%g
s%@WINSUPPORT@%$WINSUPPORT%g
s%@CVSSUPPORT@%$CVSSUPPORT%g
s%@TBOPSEMAIL@%$TBOPSEMAIL%g
s%@TBOPSEMAIL_NOSLASH@%$TBOPSEMAIL_NOSLASH%g
s%@TBLOGSEMAIL@%$TBLOGSEMAIL%g
......
......@@ -145,6 +145,7 @@ AC_SUBST(SSLCERT_ORGNAME)
AC_SUBST(FRISEBEEMCASTADDR)
AC_SUBST(FRISEBEEMCASTPORT)
AC_SUBST(WINSUPPORT)
AC_SUBST(CVSSUPPORT)
#
# Offer both versions of the email addresses that have the @ escaped
......@@ -194,6 +195,7 @@ PLAB_ROOTBALL="change.me"
PLAB_SLICEPREFIX="utah_elab"
WIKISUPPORT=0
WINSUPPORT=0
CVSSUPPORT=0
TBLOGFACIL="local5"
LINKTEST_NSPATH="/share/linktest-ns"
BOSSEVENTPORT=2927
......@@ -747,6 +749,7 @@ outfiles="$outfiles Makeconf GNUmakefile \
tools/GNUmakefile \
tools/pcapper/GNUmakefile tools/teachswitch/GNUmakefile \
tools/webcamapplet/GNUmakefile tools/whol/GNUmakefile \
tools/selectapplet/GNUmakefile \
$eventfiles \
$winfiles \
apache/GNUmakefile apache/httpd.conf \
......
......@@ -37,6 +37,7 @@ PLAB_ROOTBALL="plabroot-10.tar.bz2"
WIKISUPPORT=1
WINSUPPORT=1
SFSSUPPORT=0
CVSSUPPORT=1
#
# SSL Certificate stuff. Used to customize config files in ssl directory.
# Note that OrganizationalUnit is set in the cnf file.
......
......@@ -18,6 +18,22 @@ Note that some instructions may have steps that need to occur at a few
different points in the install process - these are marked with the
earliest time one of the steps needs to occur.
20050707: Before build
Decide if you want CVS support turned on. This is some simple
support for per-project CVS trees, stored as /proj/$pid/CVS.
The main thing is that you can use the cvsweb interface. If you
want it, in your defs file:
CVSSUPPORT=1
After your build and install:
sudo /usr/testbed/sbin/cvsinit
which creates the initial CVS trees in all of the existing project
trees.
20041108: Anytime
* Update sql/database-fill-suplement.sql stuff.
......
......@@ -27,15 +27,18 @@ my $TBOPS = "@TBOPSEMAIL@";
my $MKGROUP = "$TB/sbin/mkgroup";
my $SETGROUPS= "$TB/sbin/setgroups";
my $MKACCT = "$TB/sbin/tbacct add";
my $CVSBIN = "/usr/bin/cvs";
my $CHOWN = "/usr/sbin/chown";
my $GRANTTYPE= "$TB/sbin/grantnodetype -d";
my $WIKISUPPORT = @WIKISUPPORT@;
my $CVSSUPPORT = @CVSSUPPORT@;
my $ADDWIKIPROJ = "$TB/sbin/addwikiproj";
my $PROJROOT = "/proj";
my $GRPROOT = "/groups";
my $TFTPROOT = "/tftpboot";
my @DIRLIST = ("exp", "images", "logs", "deltas", "tarfiles", "rpms",
"groups", "tiplogs");
"groups", "tiplogs", "CVS");
my $projhead;
#
......@@ -201,6 +204,23 @@ if (! -e "$TFTPROOT/proj/$pid") {
}
}
#
# Do the CVS stuff if its turned on.
#
my $CVSDIR = "$PROJROOT/$pid/CVS";
if ($CVSSUPPORT && -e $CVSDIR) {
system("$CVSBIN -d $CVSDIR init");
if ($?) {
fatal("Could not cvs init $CVSDIR!");
}
# Chown the tree.
system("$CHOWN -R ${uid}:${gid} $CVSDIR");
if ($?) {
fatal("Could not chown ${uid}:${gid} $CVSDIR!");
}
}
#
# Create groups directory.
#
......
......@@ -19,9 +19,9 @@ BIN_SCRIPTS = delay_config sshtb create_image node_admin link_config \
SBIN_SCRIPTS = vlandiff vlansync withadminprivs export_tables cvsupd.pl \
eventping grantnodetype import_commitlog dhcpd_wrapper \
opsreboot deletenode node_statewait grabwebcams \
grabswitchconfig backupswitches
grabswitchconfig backupswitches cvsinit
LIBEXEC_SCRIPTS = webcreateimage newnode webdeletenode spewleds webcopy \
websetdest spewsource weblinkmon_ctl
websetdest spewsource weblinkmon_ctl webcvsweb
#
# Force dependencies on the scripts so that they will be rerun through
......
#!/usr/bin/perl -wT
#
# EMULAB-COPYRIGHT
# Copyright (c) 2005 University of Utah and the Flux Group.
# All rights reserved.
#
use English;
#
# Initialize the CVS support.
#
sub fatal($);
#
# Configure variables
#
my $TB = "@prefix@";
my $CVSBIN = "/usr/bin/cvs";
my $CHOWN = "/usr/sbin/chown";
my $CVSSUPPORT = @CVSSUPPORT@;
my $PROJROOT = "/proj";
#
# Untaint the path
#
$ENV{'PATH'} = "/bin:/usr/bin";
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
#
# Turn off line buffering on output
#
$| = 1;
#
# Load the Testbed support stuff.
#
use lib "@prefix@/lib";
use libaudit;
use libdb;
use libtestbed;
#
# We have to run this script as root.
#
if ($UID != 0) {
die("*** $0:\n".
" Must run this script as root!\n");
}
if (! $CVSSUPPORT) {
die("*** $0:\n".
" You must turn on CVSSUPPORT in your defs file!\n");
}
my $query_result =
DBQueryFatal("select pid,head_uid from projects");
while (my ($pid,$projhead) = $query_result->fetchrow_array()) {
next
if (! -d "$PROJROOT/$pid");
my $CVSDIR = "$PROJROOT/$pid/CVS";
next
if (-d $CVSDIR && -d "$CVSDIR/CVSROOT");
my (undef,undef,$uid) = getpwnam($projhead)
or fatal("$projhead not in passwd file");
my (undef,undef,$gid) = getgrnam($pid)
or fatal("$pid not in group file");
if (! -e $CVSDIR) {
if (! mkdir("$CVSDIR", 0770)) {
fatal("Could not make directory $CVSDIR: $!");
}
if (! chmod(0770, "$CVSDIR")) {
fatal("Could not chmod directory $CVSDIR: $!");
}
if (! chown($uid, $gid, "$CVSDIR")) {
fatal("Could not chown $CVSDIR to $uid/$gid: $!");
}
}
system("$CVSBIN -d $CVSDIR init");
if ($?) {
fatal("Could not cvs init $CVSDIR!");
}
# Chown the tree.
system("$CHOWN -R ${uid}:${gid} $CVSDIR");
if ($?) {
fatal("Could not chown ${uid}:${gid} $CVSDIR!");
}
}
exit(0);
sub fatal($) {
my($mesg) = $_[0];
die("*** $0:\n".
" $mesg\n");
}
#!/usr/bin/perl -w
#
# EMULAB-COPYRIGHT
# Copyright (c) 2005 University of Utah and the Flux Group.
# All rights reserved.
#
use English;
#
# This gets invoked from the Web interface. Simply a wrapper ...
#
#
# Configure variables
#
my $TB = "@prefix@";
#
# Run the real thing, and never return.
#
exec "$TB/www/cvsweb/cvsweb.cgi", @ARGV;
die("webcvsweb: Could not exec cvsweb: $!");
......@@ -46,7 +46,7 @@
# SUCH DAMAGE.
#
# $FreeBSD: projects/cvsweb/cvsweb.cgi,v 1.119.2.6 2002/09/26 20:56:05 scop Exp $
# $Id: cvsweb.cgi,v 1.2 2004-03-12 00:44:45 ricci Exp $
# $Id: cvsweb.cgi,v 1.3 2005-07-07 21:36:00 stoller Exp $
# $Idaemons: /home/cvs/cvsweb/cvsweb.cgi,v 1.84 2001/10/07 20:50:10 knu Exp $
#
###
......@@ -310,7 +310,7 @@ $maycompress =
# to hold our state - they will be added (with
# their current value) to any link/query string
# you construct
@stickyvars = qw(cvsroot hideattic sortby logsort f only_with_tag);
@stickyvars = qw(cvsroot hideattic sortby logsort f only_with_tag pid);
@unsafevars = qw(logsort only_with_tag r1 r2 rev sortby tr1 tr2);
if (-f $config) {
......@@ -357,6 +357,11 @@ if (defined($input{"content-type"})) {
if ($input{"content-type"} !~ /^[-0-9A-Za-z]+\/[-0-9A-Za-z]+$/);
}
if (@ARGV && $ARGV[0] eq "-repo") {
@CVSrepositories = (
'top' => [$ARGV[1], $ARGV[1]],
);
}
$DEFAULTVALUE{'cvsroot'} = $cvstreedefault;
foreach (keys %DEFAULTVALUE) {
......
......@@ -17,8 +17,31 @@ require("defs.php3");
$uid = GETLOGIN();
LOGGEDINORDIE($uid);
if (! TBCvswebAllowed($uid)) {
# Just for project specific
$scriptargs = "";
#
# Verify form arguments.
#
if (isset($pid) && $pid != "") {
if (!$CVSSUPPORT) {
USERERROR("Project CVS support is not enabled!", 1);
}
if (!TBvalid_pid($pid)) {
PAGEARGERROR("Invalid project ID.");
}
if (! TBValidProject($pid)) {
USERERROR("The project '$pid' is not a valid project.", 1);
}
if (! TBProjAccessCheck($uid, $pid, $pid, $TB_PROJECT_READINFO)) {
USERERROR("You are not a member of Project $pid.", 1);
}
}
else {
if (! TBCvswebAllowed($uid)) {
USERERROR("You do not have permission to use cvsweb!", 1);
}
unset($pid);
}
$script = "cvsweb.cgi";
......@@ -34,7 +57,7 @@ $agent = escapeshellcmd($HTTP_USER_AGENT);
$encoding = escapeshellcmd($HTTP_ACCEPT_ENCODING);
#
# Helpfully enough, escapeshellcmd doesn't escape spaces. Sigh.
# Helpfully enough, escapeshellcmd does not escape spaces. Sigh.
#
$script = preg_replace("/ /","\\ ",$script);
$query = preg_replace("/ /","\\ ",$query);
......@@ -65,9 +88,20 @@ function SPEWCLEANUP()
set_time_limit(0);
register_shutdown_function("SPEWCLEANUP");
$fp = popen("env PATH=./cvsweb/ QUERY_STRING=$query PATH_INFO=$path " .
$shellcmd = "env PATH=./cvsweb/ QUERY_STRING=$query PATH_INFO=$path " .
"SCRIPT_NAME=$name HTTP_USER_AGENT=$agent " .
"HTTP_ACCEPT_ENCODING=$encoding $script",'r');
"HTTP_ACCEPT_ENCODING=$encoding ";
if (isset($pid)) {
# I know, I added an argument to a script that is not supposed to
# take any. So be it; it was easy.
$shellcmd .= "$TBSUEXEC_PATH $uid $pid webcvsweb -repo /proj/$pid/CVS";
}
else {
$shellcmd .= "$script";
}
$fp = popen($shellcmd, 'r');
#
# Yuck. Since we can't tell php to shut up and not print headers, we have to
......
......@@ -16,6 +16,7 @@ $TBWWW = "@TBWWW@";
$THISHOMEBASE = "@THISHOMEBASE@";
$ELABINELAB = @ELABINELAB@;
$WIKISUPPORT = @WIKISUPPORT@;
$CVSSUPPORT = @CVSSUPPORT@;
$CONTROL_NETWORK= "@CONTROL_NETWORK@";
$WIKIURL = "https://${USERNODE}/twiki/bin/newlogon";
$WIKICOOKIENAME = "WikiCookie";
......
......@@ -14,7 +14,7 @@
# A project
#
function SHOWPROJECT($pid, $thisuid) {
global $WIKISUPPORT;
global $WIKISUPPORT, $CVSSUPPORT, $TBPROJ_DIR;
$query_result =
DBQueryFatal("select p.*,g.wikiname from projects as p ".
......@@ -100,6 +100,16 @@ function SHOWPROJECT($pid, $thisuid) {
<A href='$wikiurl'>$wikiname</A></td>
</tr>\n";
}
if ($CVSSUPPORT) {
$cvsdir = "$TBPROJ_DIR/$pid/CVS";
$cvsurl = "cvsweb/cvsweb.php3?pid=$pid";
echo "<tr>
<td>Project CVS Repository:</td>
<td class=\"left\">
$cvsdir <A href='$cvsurl'>(cvsweb)</A></td>
</tr>\n";
}
echo "<tr>
<td>Publicly Visible: </td>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment