builddeb - Build Debian packages from Bazaar branches

Version 2.5.1dev
Branch lp:bzr-builddeb
Home page https://launchpad.net/bzr-builddeb
Owner james-w
GNU/Linux Yes
Windows No
Mac OS X No

bzr-builddeb - manage packages in a Bazaar branch.

bd-do

Purpose

Run a command in an exported package, copying the result back.

Usage

bzr bd-do [COMMAND...]

Options

--usage Show usage message and options.
-v, --verbose Display more information.
-q, --quiet Only display errors and warnings.
-h, --help Show help message.

Description

For a merge mode package the full source is not available, making some operations difficult. This command allows you to run any command in an exported source directory, copying the resulting debian/ directory back to your branch if the command is successful.

For instance:

bzr bd-do

will run a shell in the unpacked source. Any changes you make in the debian/ directory (and only those made in that directory) will be copied back to the branch. If you exit with a non-zero exit code (e.g. “exit 1”), then the changes will not be copied back.

You can also specify single commands to be run, e.g.

bzr bd-do “dpatch-edit-patch 01-fix-build”

Note that only the first argument is used as the command, and so the above example had to be quoted.

builddeb

Purpose

Builds a Debian package from a branch.

Usage

bzr builddeb [BRANCH_OR_BUILD_OPTIONS...]

Options

-e, --export-only
 Export only, don’t build.
--dont-purge Don’t purge the build directory after building.
--result Present only for compatibility with bzr-builddeb <= 2.0. Use –result-dir instead.
-v, --verbose Display more information.
--package-merge
 Build using the appropriate -v and -sa options for merging in the changes from another source.
--merge Merge the debian part of the source in to the upstream tarball.
-h, --help Show help message.
--export-upstream-revision=ARG
 Select the upstream revision that will be exported.
-S, --source Build a source package.
--split Automatically create an .orig.tar.gz from a full source branch.
--usage Show usage message and options.
--native Build a native package.
--strict Refuse to build if there are unknown files in the working tree, –no-strict disables the check.
-w, --working-tree
 This option has no effect.
-r ARG, --revision=ARG
 See “help revisionspec” for details.
--use-existing Use an existing build directory.
--build-dir=ARG
 The dir to use for building.
--reuse Try to avoid exporting too much on each build. Only works in merge mode; it saves unpacking the upstream tarball each time. Implies –dont-purge and –use- existing.
--result-dir=ARG
 Directory in which to place the resulting package files.
--builder=ARG Command to build the package.
--export-upstream=ARG
 Create the .orig.tar.gz from a bzr branch before building.
-q, --quiet Only display errors and warnings.
--orig-dir=ARG Directory containing the .orig.tar.gz files. For use when onlydebian/ is versioned.
--quick Quickly build the package, uses quick-builder, which defaults to “fakeroot debian/rules binary”.

Description

If BRANCH is specified it is assumed that the branch you wish to build is located there. If it is not specified then the current directory is used.

By default, if a working tree is found, it is used to build. Otherwise the last committed revision found in the branch is used. To force building the last committed revision use –revision -1. You can also specify any other revision with the –revision option.

If you only wish to export the package, and not build it (especially useful for merge mode), use –export-only.

To leave the build directory when the build is completed use –dont-purge.

Specify the command to use when building using the –builder option, by default “debuild” is used. It can be overriden by setting the “builder” variable in you configuration. You can specify extra options to build with by adding them to the end of the command, after using “–” to indicate the end of the options to builddeb itself. The builder that you specify must accept the options you provide at the end of its command line.

You can also specify directories to use for different things. –build-dir is the directory to build the packages beneath, which defaults to ‘../build-area’. ‘–orig-dir’ specifies the directory that contains the .orig.tar.gz files , which defaults to ‘..’. ‘–result-dir’ specifies where the resulting package files should be placed, which defaults to ‘..’. –result-dir will have problems if you use a build command that places the results in a different directory.

The –reuse option will be useful if you are in merge mode, and the upstream tarball is very large. It attempts to reuse a build directory from an earlier build. It will fail if one doesn’t exist, but you can create one by using –export-only.

–quick allows you to define a quick-builder in your configuration files, which will be used when this option is passed. It defaults to ‘fakeroot debian/rules binary’. It is overriden if –builder is passed. Using this and –reuse allows for fast rebuilds.

Aliases

bd

dh-make

Purpose

Helps you create a new package.

Usage

bzr dh-make PACKAGE_NAME VERSION TARBALL

Options

-v, --verbose Display more information.
-q, --quiet Only display errors and warnings.
--v3 Use dpkg-source format v3.
--usage Show usage message and options.
--bzr-only Don’t run dh_make.
-h, --help Show help message.

Description

This code wraps dh_make to do the Bazaar setup for you, ensuring that your branches have all the necessary information and are correctly linked to the upstream branches where necessary.

The basic use case is satisfied by

which will import the tarball with the correct tags etc. and then run dh_make for you in order to start the packaging.

If there upstream is available in bzr then run the command from the root of a branch of that corresponding to the 0.1 release.

If there is no upstream available in bzr then run the command from outside a branch and it will create a branch for you in a directory named the same as the package name you specify as the second argument.

If you do not wish to use dh_make, but just take advantage of the Bazaar specific parts then use the –bzr-only option.

Aliases

dh_make

import-dsc

Purpose

Import a series of source packages.

Usage

bzr import-dsc [FILES...]

Options

--usage Show usage message and options.
-v, --verbose Display more information.
-q, --quiet Only display errors and warnings.
-F ARG, --file=ARG
 File containing URIs of source packages to import.
-h, --help Show help message.

Description

Provide a number of source packages (.dsc files), and they will be imported to create a branch with history that reflects those packages.

The first argument is the distribution that these source packages were uploaded to, one of “debian” or “ubuntu”. It can also be the target distribution from the changelog, e.g. “unstable”, which will be resolved to the correct distribution.

You can also specify a file (possibly remote) that contains a list of source packages (.dsc files) to import using the –file option. Each line is taken to be a URI or path to import. The sources specified in the file are used in addition to those specified on the command line.

If you have an existing branch containing packaging and you want to import a .dsc from an upload done from outside the version control system you can use this command.

import-upstream

Purpose

Imports an upstream tarball.

Usage

bzr import-upstream VERSION LOCATION [UPSTREAM_BRANCH]

Options

--usage Show usage message and options.
-r ARG, --revision=ARG
 See “help revisionspec” for details.
-v, --verbose Display more information.
-q, --quiet Only display errors and warnings.
-h, --help Show help message.

Description

This will import an upstream tarball in to your branch, but not modify the working tree. Use merge-upstream if you wish to directly merge the new upstream version in to your tree.

The imported revision can be accessed using the tag name that will be reported at the end of a successful operation. The revision will include the pristine-tar data that will allow other commands to recreate the tarball when needed.

For instance:

$ bzr import-upstream 1.2.3 ../package_1.2.3.orig.tar.gz

If upstream is packaged in bzr, you should provide the upstream branch whose tip commit is the closest match to the tarball:

$ bzr import-upstream 1.2.3 ../package_1.2.3.orig.tar.gz ../upstream

After doing this, commands that assume there is an upstream tarball, like ‘bzr builddeb’ will be able to recreate the one provided at import-upstream time, meaning that you don’t need to distribute the tarball in addition to the branch.

If you want to manually merge with the imported upstream, you can do:

$ bzr merge . -r tag:upstream-1.2.3

The imported revision will have file ids taken from your branch, the upstream branch, or previous tarball imports as necessary. In addition the parents of the new revision will be the previous upstream tarball import and the tip of the upstream branch if you supply one.

mark-uploaded

Purpose

Mark that this branch has been uploaded, prior to pushing it.

Usage

bzr mark-uploaded

Options

--force Mark the upload even if it is already marked.
-v, --verbose Display more information.
-q, --quiet Only display errors and warnings.
--merge Merge the debian part of the source in to the upstream tarball.
--usage Show usage message and options.
-h, --help Show help message.

Description

When a package has been uploaded we want to mark the revision that it was uploaded in. This command automates doing that by marking the current tip revision with the version indicated in debian/changelog.

merge-package

Purpose

Merges source packaging branch into target packaging branch.

Usage

bzr merge-package SOURCE

Options

--usage Show usage message and options.
-v, --verbose Display more information.
-q, --quiet Only display errors and warnings.
-h, --help Show help message.

Description

This will first check whether the upstream branches have diverged.

If that’s the case an attempt will be made to fix the upstream ancestry so that the user only needs to deal wth packaging branch merge issues.

In the opposite case a normal merge will be performed.

merge-upstream

Purpose

Merges a new upstream version into the current branch.

Usage

bzr merge-upstream [LOCATION] [UPSTREAM_BRANCH]

Options

--force Force a merge even if the upstream branch has not changed.
-v, --verbose Display more information.
--package=ARG The name of the source package.
-q, --quiet Only display errors and warnings.
--last-version=ARG
 The full version of the last time upstream was merged.
-d ARG, --directory=ARG
 Working tree into which to merge.
--version=ARG The upstream version number of this release, for example “0.2”.
--snapshot Merge a snapshot from the upstream branch rather than a new upstream release.
--usage Show usage message and options.
--distribution=ARG
 The distribution that this release is targetted at.
-r ARG, --revision=ARG
 See “help revisionspec” for details.
-h, --help Show help message.
Merge algorithm:
--merge-type=ARG
 Select a particular merge algorithm.
--diff3 Merge using external diff3
--lca LCA-newness merge
--merge3 Native diff3-style merge
--weave Weave-based merge

Description

Takes a new upstream version and merges it in to your branch, so that your packaging changes are applied to the new version.

You must supply the source to import from, and the version number of the new release. The source can be a .tar.gz, .tar, .tar.bz2, .tgz or .zip archive, or a directory. The source may also be a remote file described by a URL.

You must supply the version number of the new upstream release using –version, unless you’re importing from an upstream branch, in which case it can be guessed from that.

The distribution this version is targetted at can be specified with –distribution. This will be used to guess the version number suffix that you want, but you can always correct it in the resulting debian/changelog.

If there is no debian changelog in the branch to retrieve the package name from then you must pass the –package option. If this version will change the name of the source package then you can use this option to set the new name.

examples:

bzr merge-upstream --version 0.2             http://example.org/releases/scruff-0.2.tar.gz

If you are merging a branch as well as the tarball then you can specify the branch after the tarball, along with -r to specify the revision of that branch to take:

bzr merge-upstream --version 0.2             http://example.org/releases/scruff-0.2.tar.gz             http://scruff.org/bzr/scruff.dev -r tag:0.2

If there is no upstream release tarball, and you want bzr-builddeb to create the tarball for you:

bzr merge-upstream --version 0.2 http://scruff.org/bzr/scruff.dev

Note that the created tarball is just the same as the contents of the branch at the specified revision. If you wish to have something different, for instance the results of running “make dist”, then you should create the tarball first, and pass it to the command as in the second example.

Aliases

mu