Package maintainance using CDBS and git-buildpackage

Building the package

No special handling is required for normal package builds.

In particular, you can completely ignore the file debian/ file and simply use debian/control directly, if you are not interested in CDBS.

Upgrading to new upstream source

Official releases are tagged and signed and binary diffs of tarballs are stored using pristine-tar. This is documented below /usr/share/doc/git-buildpackage/manual-html/.

A custom build target shows current upstream and packaging versions:

debian/rules print-version

Current upstream source is fetched (and repackaged as needed) using this other build target:

debian/rules get-orig-source

Importing git tag + tarball

When upstream also use git, and need no DFSG-nonfre files stripped from source, it is preferred to keep that synchronized with our git: Look for a git URL in Source paragraph of debian/copyright file.

First (once) make sure your local clone tracks upstream git:

git remote add upstream-repo ${upstream_git_url}

1. Fetch new upstream source, overriding DEB_UPSTREAM_TARBALL_VERSION:

debian/rules get-orig-source DEB_UPSTREAM_TARBALL_VERSION=${new_upstream_version}

2. Import tag + fetched source:

git-import-orig --pristine-tar --sign-tags --upstream-vcs-tag=${tag} ${path-to-fetched-tarball}

Importing tarball w/ checksum

When upstream does not use git, we have less ability to follow upstream activity, so extra care should be taken to ensure the integrity of imported code, by use of a checksum for the tarball.

1. Fetch new upstream source, overriding DEB_UPSTREAM_TARBALL_VERSION and suppressing existing DEB_UPSTREAM_TARBALL_MD5:

debian/rules get-orig-source DEB_UPSTREAM_TARBALL_MD5= DEB_UPSTREAM_TARBALL_VERSION=${new_upstream_version}

2. Import fetched source:

git-import-orig --pristine-tar --sign-tags ${path-to-fetched-tarball}

3. Store new md5sum to help ensure identical source is received later.

Avoid alternative import methods

Please avoid other upgrade methods e.g. using uscan, especially when repackaging to strip non-DFSG files.

When copyright check is enabled and the source package is detected to contain new files or changed copyright or licensing statements, the following is emitted during normal builds:

WARNING: The following (and possibly more) new or changed notices discovered:


To fix the situation please do the following:
  1) Fully compare debian/copyright_hints with debian/copyright_newhints
  2) Update debian/copyright as needed
  3) Replace debian/copyright_hints with debian/copyright_newhints

To treat such warnings as errors and avoid removing debian/copyright_newhints in clean target when different, set DEB_MAINTAINER_MODE=1 during build.

Maintaining packaging build routines

This source package wraps debhelper commands and other tedious parts of the build routines using the CDBS framework. Please refer to the actual makefile snippets included from debian/rules for details on their purpose and ways to override defaults.

Setting DEB_MAINTAINER_MODE=1 enables additional build routines helpful during development of the package, but unfit for normal builds. This typically includes the CDBS feature of auto-updating debian/control with CDBS-related build-dependencies, which is forbidden by Debian Policy as build environment must not change during automated builds.

Use git for your package at collab-maint area of Alioth

Create new git locally from pristine tarball:

    mkdir mypkg
    cd mypkg
    git init
    cd ..
    mkdir tarballs
    cd tarballs
    mv my_pkg.tgz mypkg_1.2.3.orig.tar.gz
    cd ../mypkg
    git-import-orig --pristine-tar --sign-tags ../tarballs/mypkg_1.2.3.orig.tar.gz

Create debian packaging

    mkdir debian
    nano debian/rules
    nano debian/control
    nano debian/gbp.conf
    git add debian
    git commit

Publish git at collab-maint area of Alioth

    git remote add origin
    git config branch.master.remote origin
    git config branch.master.merge refs/heads/master
    ssh "cd /git/collab-maint && ./setup-repository mypkg 'mypkg Debian packaging'"
    git push --all; git push --tags

If you already have some Debian packaging then it is even easier

Bootstrap local git

    git-import-dsc --pristine-tar --sign-tags mypkg_1.2.3.dsc

Or more elegantly you can bootstrap with as much history from past packaging as is possible:

Bootstrap local git

    (copy URLs from icons at right of "versions" in left side)
    dget -d
    debsnap -d . mypkg
    git-import-dscs --pristine-tar --sign-tags mypkg*

You might still want to apply my cdbs-skel files. Use same commands and follow the git instructions to resolve any conflicts that might occur (if e.g. the packaging already contained a README.source).

See Also

Package Relationship management with CDBS

--- CategoryGit