Lightweight CVS Checkout

Gentoo developers willing to work with the ebuilds often check out the complete gentoo-x86 CVS repository. This page describes a method of creating and maintaining a lightweight CVS checkout backed up by regular (rsync or git) Gentoo repository.

Why lightweight checkout?
Unlike standard CVS checkout which involves fetching all the files from the gentoo-x86 repository, the lightweight method allows you to get only the files you are working on. The remaining files are obtained from a regular repository — obtained through rsync, git, webrsync…

The advantages of this method are:
 * bandwidth and space efficiency — only needed files are fetched and stored,
 * improved performance — only modified files need to be recached, the supplied md5-cache is used for the remaining ebuilds,
 * improved maintainability — there's no longer need to keep all ebuilds up-to-date in the CVS checkout. Instead, just remove them when done and let the regularly synced repository supply them.

The disadvantages of this method are:
 * necessity of manually fetching additional files as they are worked on,
 * inability to run tree-wide repoman scans without merging two repositories.

Before starting
Ensure that you have a Gentoo repository synced via method other than CVS. If you used to sync against CVS, please switch your Package Manager to use rsync, git or another supported method instead.

Automated script
The repository can be easily created using lcvs-init script from lightweight-cvs-toolkit.

The script takes three parameters:
 * 1) location where the repository should be created,
 * 2) CVS username (optional, defaults to current user's username),
 * 3) Repository name (optional, defaults to gentoo-cvs).

Before creating the repository, the script will check system sanity, output the resulting configuration and ask the user for confirmation.

Manual method
Then create a new CVS checkout using the -l option (local) to disable recursive fetching:

(change myuser to your Gentoo username)

It is also convenient to fetch (non-recursively) directories for all ebuild categories. For example:

Afterwards, the metadata for repository should be fetched and layout.conf file updated to state a new repository name, and name gentoo as its master repository. This will allow the checkout to be used as a regular overlay on top of the rsync/git repository.

It is recommended to consistently use the name gentoo-cvs since that provides a convenient way of locating the CVS checkout for scripts.

At this point the repository is ready. It is also a good idea to create a git repository on top of it and store the current state. This can be used to conveniently remove checked out ebuild later and restore the repository to vanilla state.

Finally, add the repository to repos.conf:

Working with a partial checkout
Since partial checkout doesn't have any ebuilds, eclasses, licenses or profiles by default (inherits them all from gentoo implicitly), the files being worked need to be fetched manually. cvs up -dP can be used for this. For example, if you want to work on dev-foo/bar, you'd do:

You can also pass multiple directories to cvs up:

When done working with the files, it is useful to remove them. Otherwise, the old versions will confuse your Package Manager in the future.

If you used git during the repository creation (both methods above do), you can also let it clean any new files: