Note on packaging workflows

  • I use git-buildpackage workflow.
  • I use gbp-pq to manage quilt patches.
  • I typically use pristine-tar.
  • When working with a packaging team, I try to adjust to match other packages that they maintain.

Initial setup

  1. Create ~/.gbp.conf.
  2. Add the following lines to the appropriate sections in your ~/.gbp.conf:
    [DEFAULT]
    sign-tags = True

    [buildpackage]
    ignore-branch = True    

    [dch]
    multimaint-merge = True
  1. Add export DEBEMAIL=[email] and export DEBFULLNAME="[name]" to ~/.bashrc.

Starting a new package with upstream git history

  1. git clone --no-checkout -o upstream [upstream-git-repo-url]
  2. If needed, mv [upstream-name] [package-name]
  3. cd [package-name]
  4. If upstream has release tags: git checkout -b upstream [latest-release-tag]
    • Otherwise: git checkout -b upstream [upstream-main-branch]
  5. Remove any unwanted upstream files:
    • If upstream .gitattributes is causing tests to be dropped:
      • git rm .gitattributes
      • git commit -m "upstream: Drop .gitattributes to keep tests"
    • Also remove any non-DFSG files or embedded libraries.
  6. git tag -s -m "Upstream version [version]" upstream/<version>
    • If files were removed only for packaging reasons, append +ds.1 to the version.
    • If non-DFSG files were removed, append +dfsg.1 to the version.
  7. git checkout -b debian/latest
  8. Find a similar package, copy and adapt its debian/ files to the new package.
    • If no similar package is available, may want to try dh_make --indep --createorig -p [package]_[version].
    • Use dch --create to create debian/changelog template.
    • For Java packages that use Maven build system, try mh_make.
  9. Add debian/ packaging files and commit.
  10. gbp buildpackage --git-pristine-tar-commit --git-upstream-tree=BRANCH

Alternative: Using upstream tarball

  1. Download the release tarball and rename to [packagename]-[version].tar.gz.
  2. mkdir [packagename]
  3. cd [packagename]
  4. git init
  5. gbp import-orig ../[packagename]-[version].tar.gz
    • Alternative: gbp import-orig --uscan --upstream-vcs-tag=...
  6. Find a similar package, copy and adapt its debian/ files to the new package.
    • If no similar package is available, may want to try dh_make --indep --createorig -p [package]_[version].
    • Use dch --create to create debian/changelog template.
    • For Java packages that use Maven build system, try mh_make.
  7. Add debian/ packaging files and commit.
  8. gbp buildpackage

Best Practices

  • Set the Custom CI config path to recipes/debian.yml@salsa-ci-team/pipeline.
  • Use Build-Depends: debhelper-compat (= [compat-level]), and then you do not need the debian/compat file.
  • Run github-debian-upstream from pkg-js-tools to generate debian/upstream/metadata.
  • Run lintian-brush to check for problems.
  • List upstream README and other docs in debian/docs.
  • List upstream example files in debian/examples.
  • If your packaging branch is named debian/latest or similar, create debian/gbp.conf to indicate this:
[DEFAULT]
debian-branch = debian/latest
pristine-tar = True
sign-tags = True

Setup and run autopkgtest

  1. mkdir ~/autopkgtest
  2. sudo autopkgtest-build-qemu unstable ~/autopkgtest/unstable
  3. autopkgtest --apt-upgrade -B $(debc --list-debs) . -- qemu ~/autopkgtest/unstable

Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.