man svn-buildpackage (Commandes) - build Debian packages from SVN repository
NAME
svn-buildpackage - build Debian packages from SVN repository
SYNOPSIS
svn-buildpackage [ OPTIONS... ] [ OPTIONS for dpkg-buildpackage ]
DESCRIPTION
Builds Debian package within the SVN repository. The source code repository must be in the format created by svn-inject, and this script must be executed from the work directory (trunk/package).
By default, the working directory is used as the main source directory (assuming the whole upstream source is beeing 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").
The default behaviour is following:
Check the working directory, complain on uncommited files (also see --svn-ignore-new)
Copy the orig tarball to the build area if neccessary (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
OPTIONS
- -h, --help
- Show the help message
- --svn-verbose
- More verbose program output
- --svn-dont-clean
- Don't run debian/rules clean (default: clean first)
- --svn-dont-purge
- Don't run remove the build directory when the build is done. (Default: wipe after successfull build)
- --svn-export
- Just export the working directory and do neccessary code merge operations, then exit.
- --svn-no-links
- Don't use file links but try to export or do hard copies of the working directory (default: use links where possible). This is useful if your package fails to build because some files, empty directories, broken links, ... cannot not be transported with in the default link-copy mode.
- --svn-ignore-new, --svn-ignore
- Don't stop on svn conflicts or new/changed files. To set this behaviour for single files set the "deb:ignoreM" property to 1 on them. Also see documentation of the svn:ignore property in the SVN book.
- --svn-tag
- Final build: Tag, export, build cleanly & make new changelog entry
- --svn-tag-only, --svn-only-tag
- Don't build the package, do only the tag copy
- --svn-retag
- If an existing target directory has been found while trying to create the tag copy, remove the target directory first.
- --svn-reuse
- If possible, reuse an existing build directory in subsequent builds. The build directory is not purged after the build, it is not renamed when a build starts and the files are just copied over into it. Usefull in mergeWithUpstream mode with large package.
- --svn-lintian, --svn-linda
- Run lintian or linda on the resulting changes file when done.
- --svn-move
- When done, move the created files (as listed in .changes) to the parent directory, relativ to the one where svn-buildpackage was started.
- --svn-move-to=...
- Specifies the target directory to move generated files to.
- --svn-pkg=packagename
- Overrides the detected package name, use with caution. May be set too late during the processing (ie. still have the old value when expanding shell variables).
- --svn-override=var=value,anothervar=value
- Overrides any config variable that has been autodetected or found in .svn/deb-layout.
- --svn-builder=COMMAND
- Specifies alternative build command instead of dpkg-buildpackage, eg. debuild, pdebuild, etc. 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.
- --svn-pass-diff
- Experimental function to generate the .diff.gz contents using svn and pass it to dpkg-buildpackage. Requires a hacked dpkg-buildpackage script.
- --svn-prebuild, --svn-postbuild, --svn-pretag, --svn-posttag
- Commands (hooks) to be executed before/after the build/tag command invocations. Examples to fetch the orig tarball from a local pool (trying pool/libX/... to):
svn-buildpackage --svn-prebuild='a="wget -c http://mymirror/debian/main/pool/"; b="/$package/${package}_${upstream_version}.orig.tar.gz"; $a$(echo $package|cut -c0-1)$b || $a$(echo $package | cut -c0-4)$b'
Multiple retries with a bashism:
svn-buildpackage --svn-prebuild='wget -c http://mymirror/debian/main/pool/{`echo $package | cut -c0-1`,`echo $package | cut -c0-4`}/$package/${package}_${upstream_version}.orig.tar.gz'
Or using a bounty, see below...
svn-b --svn-prebuild="wget http://mymirror/debian/main/pool/$guess_loc"
CONFIGURATION FILE
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 basicaly a list of the long command line options (without leading minus signs), one argument per line (but without quotes embrassing multi-word arguments). The variables are expanded with the system shell if potential shell variables were found there. Avoid ~ sign because of unreliable expansion, better use $HOME instead. Example: svn-builder=debuild -EPATH
svn-no-links
svn-override=origDir=$HOME/debian/upstream/$PACKAGE
# svn-ignore-new
#svn-lintian
DIRECTORY LAYOUT HANDLING
By default, svn-buildpackage expects a configuration file with path/url declaration, .svn/deb-layout. The values there can be overriden 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.
ENVIRONMENT VARIABLES
Following environment variables are exported by svn-buildpackage and can be used in hook commands or the package build system.
- PACKAGE, package
- The source package name
- SVN_BUILDPACKAGE
- Version of svn-buildpackage
- TAG_VERSION, debian_version
- The complete Debian version string, also used for the tag copy
- non_epoch_version
- Same as debian_version but without any epoch strings
- upstream_version
- Same as debian_version but without Debian extensions
- guess_loc
- Guessed upstream source package name in the pool, something like libm/libmeta-html-perl_3.2.1.0.orig.tar.gz
- DIFFSRC
- (experimental) shows the location of generated diff file
Following variables are understood by svn-buildpackage:
- FORCETAG
- Tells to ignore the signs for an incomplete changelog
- FORCEEXPORT
- Export upstream source from the repository even if mergeWithUpstream property is set
RECOMMENDATIONS
First thing, using shell aliases makes sense. Example for the 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" That simply has the meaning: "just build no matter what", the same without re-exporting on repeated builds and "build for upload and tag".
To access remote repositories, the shell access (via ssh) is the easiest way to create the link. However, it requires to enter the password and this happens more often with svn-buildpackage. There are workarounds: use ssh key without passphrase (insecure and still slow connection) or use the fsh tool which keeps a persistent connection in background and behaves like a rsh/ssh command. For details, see svn-buildpackage manual.
Another way to get a remote link is using the Subversion DAV module (with SSL and Apache user authentication), see svn-buildpackage HOWTO manual for details.