Skip to content

Debian Packaging Checklist

Michael R. Crusoe edited this page Nov 22, 2024 · 62 revisions

Install Development Packages

  1. https://wiki.debian.org/sbuild#Setup
sudo apt-get install devscripts build-essential cdbs dh-r routine-update
# cdbs is for licensecheck2dep5
wget https://salsa.debian.org/med-team/community/helper-scripts/raw/master/inject-into-salsa-git
wget https://salsa.debian.org/r-pkg-team/dh-r/raw/master/scripts/itp_from_debian_dir
mv inject-into-salsa-git itp_from_debian_dir ~/bin
chmod a+x ~/bin/inject-into-salsa-git ~/bin/itp_from_debian_dir

Read https://salsa.debian.org/mehdi/salsa-scripts/blob/master/README.md to setup your ~/.ssh/salsarc

R Debianization

# from dh-r
prepare_missing_cran_package $packagename
# cd to each created package directory and use the below command
gbp buildpackage
# make changes as needed (`debian/copyright`) and then:
inject-into-salsa-git
# using itp_from_debian_dir this way is from dh-r >= 20190122
itp_from_debian_dir "This package is a precondition for $packagename"
# or
itp_from_debian_dir "This package is needed to run the test suite of $packagename"
# or
itp_from_debian_dir "This package will be team maintained by Debian-Med"

non-R Initial Debianization

mkdir ~/debian/packagename
cd ~/debian/packagename
git init
gbp import-orig --pristine-tar ~/debian/upstream/package_version.orig.tar.gz
# -- or --
gbp import-orig --pristine-tar https://path/to/package.tar.gz 
git archive --format=tar [email protected]:med-team/community/package_template.git master| tar -xf -
rm debian/changelog
dch --create --package ${packagename} --newversion ${upstream_version}-1
# copy other files from /usr/share/debhelper/dh_make/debian/ as needed (postinstall, etc)

# build with `Rules-Requires-Root: no` and without, compare using diffoscope.
# No difference? Then keep `Rules-Requires-Root: no`

inject-into-salsa-git
itp_from_debian_dir
routine-update -u
mk-build-deps --install --root=sudo
licensecheck --copyright -r `find -type f` | /usr/lib/cdbs/licensecheck2dep5 | /usr/bin/less

Autopkgtest

https://salsa.debian.org/med-team/community/package_template/-/blob/master/debian/tests/run-unit-test?ref_type=heads Setup at https://ci.debian.net/doc/file.MAINTAINERS.html; Test via sbuild or more directly via

rm -Rf /tmp/output-dir
autopkgtest --shell-fail --output-dir /tmp/output-dir \
  /path/to/PACKAGE_x.y-z_amd64.changes  -- unshare

Checklist

  • cme fix dpkg
  • VCS fields in debian/control
  • recent date in Changelog
  • intent to package bug number in Changelog
  • debian/upstream/metadata removed or filled out https://wiki.debian.org/UpstreamMetadata#Fields
  • debian/upstream/metadata valid YAML? perl -MYAML::XS -e '$/=""; Load(<STDIN>)' < metadata
  • Archive repacked if there are 'Excluded-Files' in debian/copyright https://wiki.debian.org/UscanEnhancements
  • if repacking, append upstream version with +dfsg1 (non-free files removed) or +ds1 (just cruft)
  • builds in a clean 'sid' environment; example: sbuild
  • try build in a stable environment; if deps are available by the package FTBFS then amend the builddeps to require minimum working version.
  • Are both arch-independent and arch-dependent packages built? Then test with dpkg-buildpackage -B & dpkg-buildpackage -A or gbp buildpackage --git-pbuilder -B & gbp buildpackage --git-pbuilder -A or cowbuilder-dist sid build ../package.dsc --binary-indep & cowbuilder-dist sid build ../package.dsc --binary-arch

Tips

Removing architectures

Useful for removing binary packages for 32-bit or big-endian architectures, after the source package has been restricted to a matching subset of any.

To check if there are reverse dependencies that will also need to be removed:

ssh mirror.ftp-master.debian.org "dak rm --architecture=armel,armhf,i386 --binary-only --partial --rdep-check --no-action $SOURCEPACKAGE"

(Source)

$ reportbug ftp.debian.org
[…]                                      
 1 ANAIS     Package removal - Architecture Not Allowed In Source.
 2 ICE       Package removal - Internal Compiler Error.
 3 NBS       Package removal - Not Built [by] Source.
 4 NPOASR    Package removal - Never Part Of A Stable Release.
 5 NVIU      Package removal - Newer Version In Unstable.
 6 ROM       Package removal - Request Of Maintainer.
 7 ROP       Package removal - Request of Porter.
 8 RoQA      Package removal - Requested by the QA team.
 9 other     Not a package removal request, report other problems.
10 override  Change override request.

Choose the request type: 1  # or 6
Please enter the reason for removal: i386 no longer supported upstream
Is this removal request for specific architectures? [y|N|?]? y
Please enter the arch list separated by a space: i386 hurd-i386 kfreebsd-i386
Submit this report on ftp.debian.org (e to edit) [Y|n|a|c|e|i|l|m|p|q|d|t|s|?]? s
Please add the email address. Just press ENTER if you don't want anymore.
> Debian Med team <[email protected]>

arch troubleshooting

  • Okay on 32-bit but not i386? Try adding this to debian/rules:
ifneq (,$(filter $(DEB_HOST_ARCH), i386))
export DEB_CXXFLAGS_MAINT_APPEND += -ffloat-store
endif

arch feelings

  • arm64: RaspberryPI4, good for teaching, 64 bit, NEON SIMD, almost a must. Powerful ARM64 servers are available on Amazon AWS at a good price. There are ARM64 HPC facilities, and more coming. Apple is rumoured to be releasing an ARM64 macbook soon.
  • armel: likely to be dropped for buster so don't worry about it
  • armhf: might be dropped for buster so don't worry about it
  • i386: meh, but do try
  • mips{64,}el: meh, not a priority for scientific/research software
  • ppc64el/s390x: not a personal interest
  • riscv64: open hardware FTW, so lets try hard here!

Generic Dockerfile for 3rd-parties to debug package building

  1. Create a generic.Dockerfile:
FROM docker.io/debian:sid-slim

COPY . /build
WORKDIR /build

RUN apt-get update && \
	apt-get -y build-dep .

RUN dpkg-buildpackage -uc -us -b
  1. Obtain source from salsa.debian.org or dget a dsc file into a subdirectory, and change into that directory
  2. docker build -f ../generic.Dockerfile . (Optionally, use podman build instead)