Tuesday, September 27, 2005

Checkout from CVS to web folder

- CVS kind of forces us to check out to /htdocs/{projectname}/index.php instead of /htdocs/www/index.php. There might be a way around this (I'm sure there is), but we did not find it.
To work around that, we remove the symbolic link at Modwest that send everything to www, and put in a symbolic link pointing to {projectname}, so that www.oursite.com takes index.php from /htdocs/{projectname}/index.php. The commands we used to do this, using the {projectname} of e.g. myproj, were...
rm -f _
ln -s myproj _

- the cvs checkout command needs the -d option to specify where the CVSROOT dir is

- the cvs command needs to have the current directory set to the directory where checkout should occur.

- We wanted to force the checkout by calling a URL, therefore our first attempt was to write a PHP script like this...
passthru ("cd /htdocs");
passthru ("cvs -d /cvs myproj");
?>
...and put this in the /htdocs/myproj directory and call it via www.oursite.com/checkout.php. This failed, however, since the cvs command always used the php script directory instead of the directory specified in the cd command. Therefore, we wrote a shell script, checkoutCmd, and call the script.
passthru ("./checkoutCmd");
?>

- To make the checkoutCmd script, we did the following...
cd /htdocs/myproj
vi checkoutCmd
...and the script you create with vi is...
cd /htdocs
cvs -d /cvs myproj
...save the file, and do...
chmod 755 checkoutCmd
...and run it as follows...
./checkoutCmd

Checkout to the web serve folder can now be done via www.oursite.com/checkout.php
Post a Comment