MAINTAINING A LOCAL BRANCH
I have described how to maintain two versions of the source tree, a stable version in /FreeBSD/FreeBSD-4.x and a current version in /FreeBSD/FreeBSD-current. There is absolutely nothing preventing you from breaking out other versions of the source tree into /FreeBSD/XXX. In fact, my /FreeBSD partition also contains
.Ox ,
.Nx , and various flavors of Linux. You may not necessarily be able to build non- Fx operating systems on your master server, but being able to collect and manage source distributions from a central server is a very useful thing to be able to do and you can certainly export to machines which can build those other operating systems. Many developers choose to maintain a local branch of
.Fx to test patches or build a custom distribution. This can be done with CVS or another source code management system (SubVersion, Perforce, BitKeeper) with its own repository. Since the main
.Fx tree is based on CVS, the former is convenient.
First, you need to modify your cvsup(1) environment to avoid it modifying the local changes you have committed to the repository. It is important to remove the delete keyword from your supfile and to add the CVSROOT subdirectory to your refuse file. For more information, see cvsup(1).
The
.Fx version of cvs(1) examines a custom environmental variable, CVS_LOCAL_BRANCH_NUM, which specifies an integer to use when doing a cvs(1) tag / rtag. Set this number to something high (say 1000) to avoid colliding with potential future branches of the main repository. For example, branching a file with version 1.4 produces 1.4.1000. Future commits to this branch will produce revisions 1.4.1000.1, 1.4.1000.2, etc.
To fork your local branch, do:
cvs rtag -r RELENG_4 -b LOCAL_RELENG_4 src
After this, you can check out a copy from your local repository using the new tag and begin making changes and committing them. For more information on using CVS, see cvs(1).
WARNING! The cvsup(1) utility may blow away changes made on a local branch in some situations. This has been reported to occur when the master CVS repository is directly manipulated or an RCS file is changed. At this point, cvsup(1) notices that the client and server have entirely different RCS files, so it does a full replace instead of trying to send just deltas. Ideally this situation should never arise, but in the real world it happens all the time.
While this is the only scenario where the problem should crop up, there have been some suspicious-sounding reports of CVS_LOCAL_BRANCH_NUM lossage that cannot be explained by this alone. Bottom line is, if you value your local branch then you should back it up before every update.
UPDATING VIA CVS
The advantage of using cvsup(1) to maintain an updated copy of the CVS repository instead of using it to maintain source trees directly is that you can then pick and choose when you bring your source tree (or pieces of your source tree) up to date. By using a cron(8) job to maintain an updated CVS repository, you can update your source tree at any time without any network cost as follows:
(on the main development server)
cd /usr/src
cvs -d /home/ncvs update
cd /usr/src2
cvs -d /home/ncvs update
cd /usr/ports
cvs -d /home/ncvs update
It is that simple, and since you are exporting the whole lot to your clients, your clients have immediate visibility into the updated source. This is a good time to also remind you that most of the cvs(1) operations you do will be done as "root", and that certain options are required for CVS to operate properly on the
.Fx repository. For example, -Pd is necessary when running cvs update. These options are typically placed in your ~/.cvsrc (as already described) so you do not have to respecify them every time you run a cvs(1) command. Maintaining the CVS repository also gives you far more flexibility in regards to breaking out multiple versions of the source tree. It is a good idea to give your /FreeBSD partition a lot of space (I recommend 8-12GB) precisely for that reason. If you can make it 15GB I would do it.
I generally do not cvs update via a cron(8) job. This is because I generally want the source to not change out from under me when I am developing code. Instead I manually update the source every so often... when I feel it is a good time. My recommendation is to only keep the CVS repository synchronized via cron(8).
SEE ALSO
crontab(1), crontab(5), build(7), firewall(7), release(7), tuning(7), diskless(8)
HISTORY