dput-ng or: How I Learned to Stop Worrying and Love the Hooks

2021-02-21 - Louis-Philippe Véronneau

As my contributions to Debian continue to grow in number, I find myself uploading to the archive more and more often.

Although I'm pretty happy with my current sbuild-based workflow, twice in the past few weeks I inadvertently made a binary upload instead of a source-only one.1

As it turns out, I am not the only DD who has had this problem before. As Nicolas Dandrimont kindly pointed to me, dput-ng supports pre and post upload hooks that can be used to lint your uploads. Even better, it also ships with a check-debs hook that lets you block binary uploads.

Pretty neat, right? In a perfect world, enabling the hook would only be a matter of adding it in the hook list of /etc/dput.d/metas/debian.json and using the following defaults:

"check-debs": {
    "enforce": "source",
    "skip": false

Sadly, bug #983160 currently makes this whole setup more complex than it should be and forces me to use two different dput-ng profiles pointing to two different files in /etc/dput.d/metas: a default source-only one (ftp-master) and a binary upload one (ftp-master-binary).

Otherwise, one could use a single profile that disallows binary uploads and when needed, override the hook using something like this:

$ dput --override "check-debs.enforce=debs" foo_1.0.0-1_amd64.changes

I did start debugging the --override issue in dput-ng, but I'm not sure I'll have time to submit a patch anytime soon. In the meantime, I'm happy to report I shouldn't be uploading the wrong .changes file by mistake again!

  1. Thanks to Holger Levsen and Adrian Bunk for catching those and notifying me.