Please extend the rmadison parser so it can add &f=json to the URL it fetches.
This avoids people post-processing text to get json out.
01:08 <REDACTED1> TIL (from twb's comment earlier) "rmadison -u ubuntu" to find out package versions from ubuntu
01:09 <REDACTED2> It's super slow. :-/
01:11 <REDACTED3> And the output format differs
01:11 <REDACTED1> REDACTED2: indeed
01:12 <REDACTED3> so better not shell-parse that
01:13 <REDACTED1> the output here only seems to differ by a leading space in front of the package name
01:14 <REDACTED3> yes
01:19 <REDACTED1> rmadison $pkg | sed 's/ \+/ /g' | jc --csv goes a long way to parsing the output though :)
01:19 <REDACTED3> TIL: jc
01:20 <REDACTED2> TIL there's no python-is-python2 in Ubuntu 22.04.
01:27 <REDACTED2> For me, "jc --csv" produces garbage on rmadison output.
01:30 <REDACTED2> Like... it assumes that the first line is a header, and uses "6" (?!) as the column separator.
01:30 <REDACTED1> oh hmm here (sid) it recognized the | as the separating character. but I saw after posting that command that one would need to add a columns title line with echo for the json objects to make sense
01:31 <REDACTED1> anyway .. like you were saying, it's not super trivial to parse.
02:18 <twb> REDACTED1: I think this is probably easier: https://api.ftp-master.debian.org/madison?package=mg&f=json
02:19 <twb> The args rmadison passes are all single-letter codes, file:///usr/bin/rmadison#lines=197-209
Example output:
$ curl -s 'https://api.ftp-master.debian.org/madison?package=mg&f=json&a=source&s=testing' | jq .
[
{
"mg": {
"testing": {
"20210609-1": {
"component": "main",
"architectures": [
"source"
],
"source": "mg",
"source_version": "20210609-1"
}
}
}
}
]
Note that this does NOT work for Ubuntu.
$ curl https://people.canonical.com/~ubuntu-archive/madison.cgi?package=mg\&f=json
<title>dak ls aka madison</title>
⋮
<h2>dak ls mg</h2>
mg | 20110905-1.1 | trusty/universe | source, amd64, arm64, armhf, i386, powerpc, ppc64el
mg | 20160118-2 | xenial/universe | source, amd64, arm64, armhf, i386, powerpc, ppc64el, s390x
mg | 20171014-1 | bionic/universe | source, amd64, arm64, armhf, i386, ppc64el, s390x
mg | 20180927-1 | focal/universe | source, amd64, arm64, armhf, ppc64el, riscv64, s390x
mg | 20200723-1 | impish/universe | source, amd64, arm64, armhf, ppc64el, riscv64, s390x
mg | 20200723-1 | jammy/universe | source, amd64, arm64, armhf, ppc64el, riscv64, s390x
mg | 20210609-1 | kinetic/universe | source, amd64, arm64, armhf, ppc64el, riscv64, s390x
⋮
Usage: dak ls [OPTION] PACKAGE[...]
Display information about PACKAGE(s).
-a, --architecture=ARCH only show info for ARCH(s)
-c, --component=COMPONENT only show info for COMPONENT(s)
-h, --help show this help and exit
-r, --regex treat PACKAGE as a regex <i>[not supported in madison.cgi]</i>
-s, --suite=SUITE only show info for this suite
-S, --source-and-binary show info for the binary children of source pkgs
ARCH, COMPONENT and SUITE can be comma (or space) separated lists, e.g.
--architecture=m68k,i386
⋮
--- /etc/devscripts.conf ---
Empty.
--- ~/.devscripts ---
BTS_CACHE=no
DEBCHANGE_RELEASE_HEURISTIC=changelog
DEB_BUILD_HARDENING=1
DEB_BUILD_OPTIONS=parallel=$(getconf _NPROCESSORS_ONLN || echo 1)