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
- Create ~/.gbp.conf.
- Add the following lines to the appropriate sections in your ~/.gbp.conf:
[DEFAULT] sign-tags = True [buildpackage] ignore-branch = True [dch] multimaint-merge = True
- Add
export DEBEMAIL=[email]
andexport DEBFULLNAME="[name]"
to ~/.bashrc.
Starting a new package with upstream git history
git clone --no-checkout -o upstream [upstream-git-repo-url]
- If needed,
mv [upstream-name] [package-name]
cd [package-name]
- If upstream has release tags:
git checkout -b upstream [latest-release-tag]
- Otherwise:
git checkout -b upstream [upstream-main-branch]
- Otherwise:
- 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.
- If upstream
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.
- If files were removed only for packaging reasons, append
git checkout -b debian/latest
- 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
.
- If no similar package is available, may want to try
- Add
debian/
packaging files and commit. gbp buildpackage --git-pristine-tar-commit --git-upstream-tree=BRANCH
Alternative: Using upstream tarball
- Download the release tarball and rename to
[packagename]-[version].tar.gz
. mkdir [packagename]
cd [packagename]
git init
gbp import-orig ../[packagename]-[version].tar.gz
- Alternative:
gbp import-orig --uscan --upstream-vcs-tag=...
- Alternative:
- 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
.
- If no similar package is available, may want to try
- Add
debian/
packaging files and commit. 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, createdebian/gbp.conf
to indicate this:
[DEFAULT]
debian-branch = debian/latest
pristine-tar = True
sign-tags = True
Setup and run autopkgtest
mkdir ~/autopkgtest
sudo autopkgtest-build-qemu unstable ~/autopkgtest/unstable
autopkgtest --apt-upgrade -B $(debc --list-debs) . -- qemu ~/autopkgtest/unstable
This work is licensed under a Creative Commons Attribution 4.0 International License.