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 
.gitattributesis causing tests to be dropped:git rm .gitattributesgit 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.1to the version. - If non-DFSG files were removed, append 
+dfsg.1to 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 --createto 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 initgbp 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 --createto 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-upstreamfrom pkg-js-tools to generate debian/upstream/metadata. - Run 
lintian-brushto 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/latestor similar, createdebian/gbp.confto indicate this: 
[DEFAULT]
debian-branch = debian/latest
pristine-tar = True
sign-tags = True
Setup and run autopkgtest
mkdir ~/autopkgtestsudo autopkgtest-build-qemu unstable ~/autopkgtest/unstableautopkgtest --apt-upgrade -B $(debc --list-debs) . -- qemu ~/autopkgtest/unstable

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