0

I am learning how to create deb packages for a small project of mine. I have been able to create the deb package for the binary. So far so good. After the process is finished I can see this:

$ dpkg -c gitmod_0.10-1_amd64.deb
drwxr-xr-x root/root         0 2024-06-01 13:57 ./
drwxr-xr-x root/root         0 2024-06-01 13:57 ./usr/
drwxr-xr-x root/root         0 2024-06-01 13:57 ./usr/bin/
-rwxr-xr-x root/root     31400 2024-06-01 13:57 ./usr/bin/gitmod
drwxr-xr-x root/root         0 2024-06-01 13:57 ./usr/share/
drwxr-xr-x root/root         0 2024-06-01 13:57 ./usr/share/doc/
drwxr-xr-x root/root         0 2024-06-01 13:57 ./usr/share/doc/gitmod/
-rw-r--r-- root/root       154 2024-06-01 13:57 ./usr/share/doc/gitmod/changelog.Debian.gz
-rw-r--r-- root/root        45 2024-06-01 13:57 ./usr/share/doc/gitmod/copyright

I want to be able to generate the package for different releases of debian (or even other distros) so I'd like to be able to have packages like:

gitmod_0.10-1_bullseye_amd64.deb
gitmod_0.10-1_bookworm_amd64.deb

So I need to be able to provide a suffix in a parameterized fashion (even if I need to use template files to generate the files used by debuild to generate the package).

Is it possible to achieve this in a standard fashion?

1 Answer 1

2

Package names are codified: they contain the package name, version (including Debian revision), and architecture. So the only way to add a suffix in the style you’re after is to add it to the Debian revision.

For example, you could specify 0.10-1+deb11u1 in debian/changelog for your Bullseye package, and 0.10-1+deb12u1 for your Bookworm package. This would produce packages in files gitmod_0.10-1+deb11u1_amd64.deb and gitmod_0.10-1+deb12u1_amd64.deb.

For packages targeting different releases of a given distribution, it’s best to use a numeric version so that the package versions are sorted in a way that makes sense. If you use bookworm and bullseye suffixes, and a user ends up with both available through their repositories (e.g. during an upgrade from Debian 11 to 12), apt will prefer the bullseye version because it’s “higher” than the bookworm version. Using deb11u1 and deb12u1 avoids that. See What does the version string from dpkg/aptitude/apt-show-versions mean? for an example.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .