Allgemein

Sergio Cipriano: Query Debian changelogs by keyword with the FTP-Master API

Sergio Cipriano: Query Debian changelogs by keyword with the FTP-Master API

Query
Debian changelogs by keyword with the FTP-Master API

In my post about tracking my
Debian uploads
, I used the ProjectB database directly
to retrieve how many uploads I had so far.

I was pleasantly surprised to receive a message from Joerg Jaspert,
who introduced me to the Debian
Archive Kit web API
(dak), also known as the FTP-Master API.

Joerg gave the idea of integrating the query I had written into the
dak API, so that anyone could obtain the same results without needing to
use the mirror host, with a simple http request.

I liked the idea and I decided to work on it. The endpoint is already
available and you can try by yourself by doing something like this:

$ curl https://api.ftp-master.debian.org/changelogs?search_term=almeida+cipriano

⚠️ WARNING: Check v2: https://people.debian.org/~gladk/blog/posts/202601_ftp-master-changelog-v2/

The query provides a way to search through the changelogs of all
Debian packages currently published. The source code is available at Salsa.

I’m already using it to track my uploads, I made this
page
that updates every day. If you want to setup something similar,
you can use my script
and just change the search_term to the name you use in your
changelog entries.

I’m running it using a systemd timer. Here’s what I’ve got:

# .config/systemd/user/track-uploads.service
[Unit]
Description=Track my uploads using the dak API
StopWhenUnneeded=yes

[Service]
Type=oneshot
WorkingDirectory=/home/cipriano/public_html/uploads
ExecStart=/usr/bin/python3 generate.py
# .config/systemd/user/track-uploads.timer
[Unit]
Description=Run track-uploads script daily

[Timer]
OnCalendar=daily
Persistent=true

[Install]
WantedBy=timers.target

After placing every file in the right place you just need to run:

$ systemctl --user daemon-reload
$ systemctl --user enable --now track-uploads.timer
$ systemctl --user start track-uploads.service # generates the html now

If you want to get a bit fancier, I’m also using an Ansible playbook
for that. The source code is available on my GitLab
repository.

If you want to learn more about dak, there is a web docs
available.

I’d like to thank Joerg once again for suggesting the idea and for
reviewing and merging the change so quickly.