Gentoo Development Guide

Subversion Sources

As with CVS, an eclass exists for working directly with upstream Subversion repositories. See subversion.eclass for a full list of functions and variables. Also see the CVS Sources ection.

Disadvantages of Subversion Sources

Note that Subversion ebuilds should not generally be added to the tree for much the same reasons that live CVS ebuilds should not (see Disadvantages of CVS Sources). Indeed, there should be even less impetus to add a live Subversion ebuild than a live CVS ebuild, as Subversion checkouts are roughly a factor of five larger than an equivalent CVS checkout.

It is safer (and better for the user) to make a snapshot instead. For example, gentoo-syntax snapshots could be made using:

$ svn export svn://svn.berlios.de/svnroot/repos/gentoo-syntax -r HEAD gentoo-syntax

Using Subversion Sources

Note

Subversion ebuilds must be either with empty KEYWORDS or package.masked (but not both). Empty KEYWORDS are strongly preferred. This applies to "live" ebuilds (-9999) and to ebuilds that extract a static revision but still use Subversion for fetching.

To use a Subversion source, subversion.eclass must be inherited, and then at least ESVN_REPO_URI must be set. The following variables are also noteworthy:

Variable Purpose Example
ESVN_REPO_URI Server and path (http, https, svn) "svn://svn.example.com/foobar/trunk"
ESVN_STORE_DIR Unpack location ESVN_STORE_DIR="${DISTDIR}/svn-src"
ESVN_PROJECT Project name of ebuild ESVN_PROJECT="${PN/-svn}"
ESVN_BOOTSTRAP Bootstrap command or script ESVN_BOOTSTRAP="autogen.sh"
ESVN_PATCHES Patches to apply during bootstrap ESVN_PATCHES="${FILESDIR}/*.patch"

See the eclass itself and subversion.eclass for the full range of options. To perform the actual checkout, use the subversion_src_unpack function, which calls both subversion_svn_fetch and subversion_bootstrap itself.

Here is a simple example, based upon the Subversion options in litu-svn-20040902.ebuild; this approach is sufficient for most Subversion ebuilds:

inherit subversion

ESVN_REPO_URI="http://tao.uab.es/ion/svn/libtu/trunk"
ESVN_PROJECT="libtu-snapshot"