How to create an apt package without the pain
Publishing the json-toolkit into the apt(itude) package manager was a painful few hours of working with poorly documented tools, no examples, and long winded documentation. This guide’s purpose is to help you not go through that same pain. Why are other guides not helpful? Well the official one starts off:
This is a pragmatic approach to learning how to create Debian packages.
Debian packaging is not that hard. Read first the introduction to Debian Packaging.
If the information below doesn't answer your questions, please look in the New Maintainer's Guide and in Debian Policy
You know when they tell you “it’s not that hard” and then read a bunch of docs…something’s wrong
Overview
I’ve made this much easier with a stripped out guide and the only cloneable repo I’ve come across (if someone knows of a better existing one, please let me know).
Create (and configure) a launchpad account (easy)
Create a PPA (personal pacakage archive) in that launch pad account (easy)
Fork https://github.com/tyleradams/apt-sample/ to create a starter repo (easy)
Change my examples to your values to make it your repo (medium)
Publish! (easy)
Launchpad
Yes it’s sketchy looking, and redirects you. Yes it’s ok.
You should see
Then go make an account and get back to this page, then click your name in the upper right hand corner
Create an OpenPGP key
First, get your fingerprint. From launchpad’s guide
Open a terminal and enter:
gpg --fingerprint
GPG will display a message similar to:
pub 1024D/12345678 2007-01-26
Key fingerprint = 0464 39CD 2486 190A 2C5A 0739 0E68 04DC 16E7 CB72
Geoffrey Hayes (My OpenPGP key) <geoffrey@bungle.com>
sub 2048g/ABCDEF12 2007-01-26Highlight and copy only the numeric fingerprint:
0464 39CD 2486 190A 2C5A 0739 0E68 04DC 16E7 CB72
in the example above.
Then add the key. Click this:
Paste your fingerprint there.
Also make sure to export your new DEBSIGN_KEY and GPG_KEY as bash variables in .bashrc
export DEBSIGN_KEY=DEADBEEF
export GPGKEY=DEADBEEF2
Create a PPA
Click yourself in the upper right hand corner
Create a new PPA
Follow instructions.
Fork
git clone https://github.com/tyleradams/apt-sample
cd apt-sample
Change
Use ripgrep to get a feel for the repo and what you need to replace, here’s every parameter that will change.
rg -n hello-world
rg -n "Tyler Adams"
rg -n "tyler@blitzblitzblitz.com"
rg -n code-faster
rg -n jammy
rg -n 1.0.0
rg -n 1.0.0-1
changelog
Update the changelog to just have one entry, mine needed to be multiple because even the second time around, I made mistakes
Publish
make package version=1.0.0
make publish version=1.0.0-1
And in the future, you’ll bump the version according to semver and what’s in debian/changelog
Wait a couple of minutes, check your email for the status
Then go to your PPA from your launchpad home page
Click yours, then look for
Wait And click “View package details” and look for
Installing your package
In your PPA, look for this:
Upgrading your package
Add a new entry in debian/changelog, for example
hello-world (1.0.1-1) jammy; urgency=medium [Tyler Adams] * Add the executable -- Tyler Adams <tyler@blitzblitzblitz.com> Mon, 13 Jul 2023 20:26:11 -0400 hello-world (1.0.0-1) jammy; urgency=medium [Tyler Adams] * Initial release -- Tyler Adams <tyler@blitzblitzblitz.com> Mon, 10 Apr 2023 20:26:11 -0400
Clean, pack, and publish
make clean make package version=1.0.1 make publish version=1.0.1-1
Let me know if you have any questions, even with clear instructions, it can still be a pain.
Happy hacking