Skip to content
Snippets Groups Projects
Commit 70760d90 authored by Emanuele Aina's avatar Emanuele Aina
Browse files

pkg-pull-updates: Fix package name quoting

When querying madison, the package name needs to be quoted or special
characters may cause issues. For instance, the `+` in the `gtk+3.0`
package needs to be escaped, or madison returns no matches:

    $ curl 'https://qa.debian.org/madison.php?package=gtk+3.0&yaml=on&s=jessie'
    --- {}
    $ curl 'https://qa.debian.org/madison.php?package=gtk%2B3.0&yaml=on&s=jessie

'
    ---
    gtk+3.0:
      3.14.5-1+deb8u1:
        jessie:
          - source

Signed-off-by: Emanuele Aina's avatarEmanuele Aina <emanuele.aina@collabora.com>
parent 59c61833
No related branches found
No related tags found
2 merge requests!160pkg-pull-updates: Fix package name quoting,!93WIP: documentation-builder: Rebase on Apertis instead of Debian Buster
Pipeline #181197 passed
......@@ -15,6 +15,7 @@ import shlex
import subprocess
import sys
import tempfile
import urllib.parse
import urllib.request
import yaml
......@@ -101,8 +102,12 @@ def get_remote_version(suite, package):
>>> get_remote_version('jessie', 'dash')
fetch https://qa.debian.org/madison.php?package=dash&yaml=on&s=jessie
Version('0.5.7-4')
>>> get_remote_version('jessie', 'gtk+3.0')
fetch https://qa.debian.org/madison.php?package=gtk%2B3.0&yaml=on&s=jessie
Version('3.14.5-1+deb8u1')
"""
url = f'https://qa.debian.org/madison.php?package={package}&yaml=on&s={suite}'
quoted_package = urllib.parse.quote(package)
url = f'https://qa.debian.org/madison.php?package={quoted_package}&yaml=on&s={suite}'
print('fetch', url)
with urllib.request.urlopen(url) as response:
data = yaml.safe_load(response.read().decode('utf-8'))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment