SVN-BUILDPACKAGE(1) | Command reference | SVN-BUILDPACKAGE(1) |
svn-buildpackage - build Debian packages from SVN repository
svn-buildpackage [[ OPTIONS... ] [ OPTIONS for dpkg-buildpackage ]]
Builds a Debian package from a Subversion repository. The source code repository must be in the format created by svn-inject, and this script must be executed from the working directory (trunk/package).
By default, the working directory is used as the main source directory (assuming the whole upstream source is being stored in the repository). The alternative is so called "merge mode". With this method, only the debian directory (and maybe some other modified files) are stored in the repository. At build time, the contents of the svn trunk are copied to the extracted tarball contents (and can overwrite parts of it). To choose this working model, set the svn property mergeWithUpstream on the debian directory
$ svn propset mergeWithUpstream 1 debian
mergeWithUpstream requires that the build system can prepare a tarball, typically using make dist and autotools. All upstream packages will have some form of tarball creation support and native packages that use autotools or which have internal tarball support can use mergeWithUpstream to handle generated files that are needed to build the package but are not present in SVN. See the HOWTO guide for examples of how this can be done. Native packages that do not use autotools and do not have internal tarball support can still add generated files to the source package tarball using the useNativeDist make target in the top level Makefile. This custom target must be idempotent and only modify / generate the desired files using only the exported SVN source and build dependencies. To allow svn-buildpackage to use an make native-dist target in your top level Makefile, set the useNativeDist property on the ./debian/ directory:
$ svn propset useNativeDist 1 debian
The default behaviour of svn-buildpackage is as follows:
Check the working directory, complain on uncommited files (also see --svn-ignore-new)
Copy the orig tarball to the build area if necessary (also see --svn-no-links)
Extract the tarball (in merge mode) or export the svn work directory to the build directory (also see below and --svn-no-links)
Build with dpkg-buildpackage (also see --svn-builder, --svn-lintian, etc.)
Create a changelog entry for the future version
svn-buildpackage accepts the following options on the command-line:
--svn-builder=COMMAND
WARNING: shell quotation rules do not completely apply here, better use wrappers for complex constructs. Using this option may break --svn-lintian and --svn-move functionality. Some functions may be disabled when a custom build command is used because the output file location is not predictable.
Default: use dpkg-buildpackage.
--svn-ignore-new | --svn-ignore
Default: Stop on conflicts or new/changed files.
--svn-dont-clean
Default: clean first
--svn-no-links
Default: use links where possible.
--svn-dont-purge
Default: remove after successful build.
--svn-reuse
Default: build directory is removed.
--svn-rm-prev-dir
Default: rename old directories with a 'obsolete' suffix.
--svn-export
Default: Off.
--svn-tag
Default: Off.
--svn-tag-only | --svn-only-tag
Default: Off.
--svn-retag
Default: Off.
--svn-noautodch
Default: A new UNRELEASED changelog entry is set via dch.
--svn-lintian
Default: Off.
--svn-move
Default: Off.
--svn-move-to=...
Default: Off. (Files are left where the build command puts them.)
--svn-pkg=packagename
Default: Off.
--svn-arch=ARCH
Default: Off.
--svn-override=var=value,anothervar=value
Default: Off.
--svn-prebuild | --svn-postbuild | --svn-pretag | --svn-posttag
Please note that the prebuild and postbuild hooks replace the normal prebuild and postbuild actions of svn-buildpackage. For prebuild, this means that the build dependencies will not be checked. For postbuild, this means that the resulting files won't be moved, and lintian will not be run.
Defaults: Off.
--svn-noninteractive
Default: Off.
--svn-savecfg
With this parameter svn-buildpackage will (partly) replicate the old behaviour. In contrast to the deprecated behaviour, the .svn/deb-layout is regarded as a local override; the old behaviour simply ignored any versioned layout information if it found .svn/deb-layout.
This option was provided since it can be useful when creating a local override file.
Default: Off.
--svn-download-orig
Default: Off.
--svn-verbose
Default: Off.
-h | --help
For more detailed information on how to use svn-buildpackage, see the HOWTO http://svn-bp.alioth.debian.org/[1].
To start working with existing native Debian package from a *.dsc file, import it into the repository with command:
svn-inject package_0.1.dsc svn://host/debian/devel/packages
To start working with existing upstream package in Debian from a *.dsc file, import it into the repository with command:
svn-inject -o package_0.1-2.dsc svn://host/debian/devel/packages
Before building an upstream package, ensure the original source is available, e.g. if uscan is working:
svn mkdir ../tarballs svn propset svn:ignore "*" ../tarballs uscan --force-download --destdir ../tarballs
To test building the package from Subversion repository, use command below. Refer to dpkg-buildpackage(1) manual page for the -us etc. options:
svn-buildpackage --svn-lintian -us -uc -rfakeroot
To check that package build in a clean state, test it with pbuilder(1):
svn mkdir ../build-area # To store results svn propset svn:ignore "*" ../build-area svn-buildpackage --svn-ignore-new --svn-builder=pdebuild
When a new upstream release becomes available, commit all changes and have the working tree in clean state. Then use svn-upgrade(1) to import the new release:
svn status # Check that there are no uncommited changes svn-upgrade --verbose ../package-2.0.tar.gz
svn-buildpackage's behaviour can be modified using the file ~/.svn-buildpackage.conf. Additional parts can be added in each package working directory using the file .svn/svn-buildpackage.conf. It is essentially a list of the long command line options (without leading minus signs), one argument per line (without quotes surrounding multi-word arguments). The variables are expanded with the system shell if shell variables are found there. Avoid ~ sign because of unreliable expansion: it is better to use $HOME instead. Example:
svn-builder=debuild -EPATH svn-no-links svn-override=origDir=$HOME/debian/upstream/$PACKAGE # svn-ignore-new #svn-lintian
By default, svn-buildpackage expects a configuration file with path/url declaration, .svn/deb-layout. The values there can be overridden with the --svn-override option, see above. If a config file could not be found, the settings are autodetected following the usual assumptions about local directories and repository layout. In addition, the contents of a custom file debian/svn-deblayout will be imported during the initial configuration. Package maintainers can store this file in the repository to pass correct defaults to new svn-buildpackage users. The format is the same as in the file .svn/deb-layout. As an alternative to the debian/svn-deblayout file, maintainers can set Subversion properties for the debian/ directory; any properties of debian/ which have a name of the form svn-bp:PROP will be the source of a PROP setting which has the value indicated by the first line of the property value. If a full svn URL is not given, the repository root will be prepended to this value.
The following environment variables are exported by svn-buildpackage and can be used in hook commands or the package build system.
PACKAGE, package
SVN_BUILDPACKAGE
TAG_VERSION, debian_version
non_epoch_version
upstream_version
guess_loc
DIFFSRC
All the layout properties are exported to the environment, too. The following ones have meaning to svn-buildpackage.
buildArea
trunkUrl
tagsUrl
origDir
origUrl
The following variables are understood by svn-buildpackage:
FORCETAG
FORCEEXPORT
DEBIAN_FRONTEND
Use shell aliases. Here are some examples for Bash:
alias svn-b="svn-buildpackage -us -uc -rfakeroot --svn-ignore" alias svn-br="svn-b --svn-dont-purge --svn-reuse" alias svn-bt="svn-buildpackage --svn-tag -rfakeroot"
Those commands have respective meanings: build regardless of new or changed files; build regardless of new or changed files and reuse the build directory; build (for upload) and tag.
SSH is the easiest way to access remote repositories, although it usually requires entering a password more frequently with svn-buildpackage. Workarounds include using an ssh key without a passphrase (although this is insecure and still relatively slow), or the SSH connection caching feature present in recent versions of SSH. For details, see the svn-buildpackage manual.
Another way to get a remote link is using the Subversion DAV module (with SSL and Apache user authentication), see the svn-buildpackage HOWTO manual for details.
/usr/share/doc/svn-buildpackage/()
Eduard Bloch
Goneri Le Bouder
Neil Williams
Copyright © 2009 Eduard Bloch
May 2009 | Release: 0.8.2 |