query madison API directly to find source package (Closes: #909753)
The tool used by the JavaScript team to track progress on packaging, js_task_edit1, has trouble dealing with binary packages that have a different name than the source package. For example, in the OpenPGP packaging page2, a bunch of babel packages are marked as missing in Debian even though they are actually present (e.g. babel-code).
This is because of that bit of rmadison code in mapper.py:
madison = _getstatusoutput(
'rmadison -u debian "%s" | tac | grep source' % result['name'])
If you look at the output for babel-core
, you'll see this can't
possibly work:
$ rmadison -u debian node-babel-core
node-babel-core | 6.26.0+dfsg-3 | testing | all
node-babel-core | 6.26.0+dfsg-3 | unstable | all
The "-S" does not help here: it would show binary packages if we somehow magically found the right source package, but not the reverse. There's no way the commandline rmadison tool can give us that information, because that's a limitation of the API.
At least that's what I thought at first. As it turns out, there's an
undocumented python
output format hidden deep in the entrails of
Dak3 which, in turn, actually indicate the source package associated
with any binary package found. This nasty business requires us to do
an actual HTTP query in Python, but rmadison does that anyways, so
doing so is not really slower.
This patch fixes the problem: return the source package instead of the
binary package and things all fall into place. As a bonus, we sort the
version numbers with Python's distutils which should be more reliable
than tac
(if that's even what that thing was doing).
One downside is that this might return testing
instead of
unstable
if both have the same version (because that's the first
match madison returns, and why tac
was used) but I would counter
it's more interesting to find the older suite with the latest version
than the later suite, as that's obviously always unstable
. This
gives more information about the state in Debian (e.g. it might even
be stable
if we're lucky!)