info-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: same file multilple places


From: Jesus Manuel NAVARRO LOPEZ
Subject: Re: same file multilple places
Date: Fri, 24 Aug 2001 10:44:09 +0200

Hi, Henrik:

Henrik Gemal wrote:
> 
> I've now been using CVS for a long time and love, but:
> How can I have the same file in two different directories
> 
> I develop websites and use have to have the a certain file in all of the
> sites. Can this be done?
> 
> Lets say I have the following file structure:
> cvsroot/websites/killer
> cvsroot/websites/killer/error.cgi
> cvsroot/websites/sucker
> cvsroot/websites/killer/error.cgi
> 
> I'de like to only have the file "error.cgi" checked in once so if I
> update the file in either killer or sucker the other will be updated the
> next time I do cvs update
> 

Something seems to be messed here:
> Lets say I have the following file structure:
> cvsroot/websites/killer
> ----------> cvsroot/websites/killer/error.cgi
> cvsroot/websites/sucker
> ----------> cvsroot/websites/killer/error.cgi

This is the very same file!!! You *can't* have a file with the same name
and same location twice!!!
I think what you migth mean is:
        cvsroot/websites/killer
        cvsroot/websites/killer/error.cgi
        cvsroot/websites/sucker
        cvsroot/websites/sucker/error.cgi
Rigth?
Then, you want to only have *one* copy of your 'error.cgi' file
somewhere in your repository and this copy being shared here and there
(it's unimportant if you want just one copy somewhere at each web site,
or you need some copies on different places of the same web site).
That's all well and good: if the file has to stay the same, you don't
want it to be stored multiple times in the repository, since then your
team can forget to update all the copies when a change is applied, and
loose sync.
Now, you have a simple approach: look at the CVS modules configuration
file [$CVSROOT]/CVSROOT/modules and how to configure it.  This way you
can have just one file at the repository (or a bunch of them) which is
copied multiple times under the checked out copy.

But, as a general issue, we're talking here about Build Process.  It
seems that to-date, your repository matches one-to-one your websites'
structure and contents, but this is not needed nor even advisable
(because the very problem you have found, among other things).
Think about it a moment: were your team developing, let's say, C
programs, the programs themselves wouldn't be in the repository, but the
source code files, rigth?.  Then using, for instance, a Makefile (which
can/should be under the SCM control tool too) you'd build your product
from the sources.  This is what you have to do for a web site too.  The
only difference is that the build process doesn't involve a compile
stage, but only moving/reordering files, fixing configuration params
(for instance, if the web has to access a database, the database server
IP/login/passwds for each server can/will be different for each one of
them) and the like.
Then from the "sources" of the web site (and the sources have only one
copy of each file*1) you apply rules (it can be done with make too, or
simple shell scripts or anything you want/fit) and end with a final
product (the proper layout for your web site).  Depending on your
environment, the build process can also include the
delivery-to-the-production-place too.

*1 And even not the finished content, but what is needed to
automatically create the *real* finished file.  Coming back to the
database example, there could be a db.cfg file looking at the repository
like this:

db.cfg
# Configuration file for DB access from our Web sites
login: [HERE LOGIN]
passwd: [HERE PASSWORD]
server: [HERE IP]
db: [HERE DB NAME]

...which after the (for instance) perl-script-driven build process
(which could be something like "./web_creator.pl --host www.onesite.com
--language php4 --dblogin user --dbpasswd my_passwd --dbserver 1.2.3.4
--db my_web_db") results in a file not even named 'db.cfg' but 'db.inc'
looking like this:

db.inc
<!-- DB ACCESS CONFIGURATION FILE.  AUTOMAGICALLY CREATED - DON'T
EDIT!!! ->
<!-- BUILT FOR PHP SITES ->
<!-- REVISION 1.0.7 ->
<!-- BUILT ON 24/AUG/2001 - 8:34:21 GMT ->
<!-- Always by WEB CREATIONS, INC. ->

<?php
$login = "user";
$passwd = "my_passwd";
$server = "1.2.3.4";
$db = "my_web_db";
?>

HTH.
-- 
SALUD,
Jesús
***
address@hidden
***


reply via email to

[Prev in Thread] Current Thread [Next in Thread]