Source: python-rapidjson
Version: 1.4-3
Severity: normal

Dear Maintainer,

The current d/watch file cannot detect recent releases.

Please replace a '_' with a '-' in the watch file.

The GitHub repos at https://github.com/python-rapidjson/python-rapidjson
seems to depends on a git submodule which might not play well with debian 
tooling.

I'm a bit puzzled why UDD only gives me this result now
in my query hereunder, but it got fixed eventualy at last.

Greetings

Alexandre



https://pypi.debian.net/python-rapidjson
...
. python-rapidjson-1.15.tar.gz
. python-rapidjson-1.16.tar.gz
. python-rapidjson-1.17.tar.gz
. python-rapidjson-1.18.tar.gz
. python-rapidjson-1.19.tar.gz
. python_rapidjson-1.20.tar.gz
. python_rapidjson-1.21.tar.gz
. python_rapidjson-1.22.tar.gz
. python_rapidjson-1.23.tar.gz



$ cat pypi-bad.py
#!/usr/bin/python3

# https://udd.debian.org/schema/udd.html

# https://regex101.com/

import re

from looseversion import LooseVersion2 as V
import requests
import psycopg

RE = re.compile(r'(https?://pypi\.debian\.net/.*)/(.*)\-')

conn = 
psycopg.connect("postgresql://udd-mirror:[email protected]/udd")
cursor = conn.cursor()
cursor.execute("""
    SELECT DISTINCT source, version, watch_file
    FROM upstream
    WHERE watch_file LIKE '%://pypi.debian.net/%'
    AND status = 'error'
""")

count = 0
for row in cursor.fetchall():
    source_, version_, watch_ = row
    source = source_.decode('ascii', 'ignore')
    version = version_.decode('ascii', 'ignore')
    watch = watch_.decode('ascii', 'ignore')
    current = V(version)
    if not current:
        print('cannot parse %s' % version)
        continue
    watch = watch.replace('@PACKAGE@', source)
    watch = watch.replace('@ANY_VERSION@', '-any_version')
    match = RE.search(watch)
    if not match:
        continue
    base = match[1]
    archive = match[2]

    transform = archive.replace('-', '_').lower()
    if transform == archive:
        continue

    count += 1
    print(base, version, archive)
    r = requests.get(base)
    for line in r.text.splitlines():
        if transform in line:
            #print(line)
            new_v = line.split('>')[1].split('<')[0]
            if '-' not in new_v:
                print('cannot parse %s' % version)
                continue
            next_v = new_v.split('-')[1]
            if next_v.endswith('.tar.gz'):
                next_v = next_v[:len(next_v)-len('.tar.gz')]
            if next_v.endswith('.tgz'):
                next_v = next_v[:len(next_v)-len('.tgz')]
            next_version = V(next_v)
            if not next_version:
                print('cannot parse %s' % next_version)
            elif next_version > current:
                print(source, version, base, new_v, archive)

print(count)

Reply via email to