Hello there,
following up on this bug and on some fediverse conversation [0].
# How to propose a patch to a maintainer, and produce a patched .deb package?
I'll be demonstrating this from a Debian 12 pristine VPS, to make sure none of
the assumptions I long use on my local machine apply. I guess this will also
serve as a demonstration on how this is way too complex (or on how my
knowledge is too outdated).
## Setup
* Install the needed tools
$ sudo apt update; sudo apt install -y devscripts quilt
* Configure the local environment (needed for proper changelog generation)
$ export DEBFULLNAME="Didier 'OdyX' Raboud"
$ export DEBEMAIL=odyx@debian.org
## Get the source package
Here, you can use either the binary package name, or the source package name.
$ debcheckout alsa-ucm-conf; cd alsa-ucm-conf
This gives you the latest maintainer view of the source package, in the alsa-
ucm-conf directory, so very likely at the status of the latest unstable (which
is what a patch will need to target). Let's make sure we base our work on the
latest unstable upload:
$ git checkout debian/1.2.14-1; git switch -c fix-bug-1110637
## Patch the source code
There are multiple ways to handle this patching, but let's just demonstrate
the direct method, not fiddling with the patch queue manually:
Let's just raw-apply the revert to the source package tree via "patch -R"
$ wget -q -O - 'https://github.com/alsa-project/alsa-ucm-conf/commit/
7283759a381ca1fc2589da213daa05f9d3b84aac.patch' | patch -p1 -R
At this point, what one has is the upstream source, the debian/ repository,
and some files patched. One needs a new changelog entry (so as to generate
binary packages that do _not_ have the same version as provided by Debian: the
'+' will sort later than the current version):
$ dch --local +2025081100 "Revert 'USB-Audio: Add focusrite scarlett 18i20
lineup' (Closes: #1110637)"
Finally, build a new source package. To do that, one needs the upstream
tarball as available from the Debian archive, dget is convenient for this:
$ cd ..; dget --download-only 'https://deb.debian.org/debian/pool/main/a/
alsa-ucm-conf/alsa-ucm-conf_1.2.14-1.dsc'; cd -
Now we can generate a patch with our changes, using dpkg-source:
$ dpkg-source --commit --include-removal
It'll ask for a patch name (mostly, anything goes), and some metadata. I've
attached the patch file to this email.
Then one needs to remove all their local changes:
$ quilt pop -a
Finally, we can build the new source package:
$ dpkg-buildpackage --build=source
This gives us a set of new files:
- ../alsa-ucm-conf_1.2.14-1+20250811001.dsc
- ../alsa-ucm-conf_1.2.14-1+20250811001.debian.tar.xz
We can see the full difference between the source packages this way:
$ debdiff ../alsa-ucm-conf_1.2.14-1.dsc ../alsa-ucm-
conf_1.2.14-1+20250811001.dsc
I've attached the resulting .debdiff to this email.
At this point, we have a source Debian package, but no installable binaries.
So…
## Build a locally-patched Debian package from a source package
Generally, one wants to build Debian packages in isolated environments (to
avoid installing massive build-depends on one's main machine, to avoid
pollution from the machine's environment, etc). A somewhat simple way to do
this is to use `debocker` (which will leverage docker):
$ sudo apt install debocker
$ sudo adduser debian docker
$ logout
… login
$ cd alsa-ucm-conf
$ debocker build
After a long process, this produces the following .deb file:
- ../alsa-ucm-conf_1.2.14-1+20250811001_all.deb
That said, in this particular case, as the source package has only very
minimal build-depends, the following is enough (and much faster):
$ dpkg-buildpackage --build=binary
… which produces the same .deb file, which you can pass around and install
wherever necessary.
## Bug-metadata update
Finally, as we're giving the maintainer a patch, we can update the bug's
metadata via Control pseudo-headers:
Control tags -1 +patch +upstream
(where -1 indicates that we're addressing this very bug number).
I hope this all was more helpful than confusing!
Best, OdyX
[0] from https://wandering.shop/@aesthr/114999646041061682
On Sat, 9 Aug 2025 18:01:36 +0200 Esther Weidauer <esther@selfawaresoup.com> wrote:
7283759a381ca1fc2589da213daa05f9d3b84aac)