[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#638706: qa.debian.org: Does not like \1 backreferences in watch file (breaks download links)



Hi Matthijs.

On 21/08/2011 11:35, Matthijs Kooijman wrote:
> I also noticed that the download links are working for other packages,
> so it must be something related to the rewriting happening in my watch
> file. For the OpenTTD package mentioned above, the watch file contains:
> 
> 	options=downloadurlmangle=s/(.*)\/index.html$/\1\/openttd-\1-source.tar.gz/ \
> 	http://master.binaries.openttd.org/releases/ \
> 	(\d+(?:\.\d+)*)/index.html
> 
> Looking at this file, it seems the "1"'s in the download url come from
> the \1 backreferences in the downloadurlmangle option.
> 
> Thinking about this a bit further, I suspect that this is caused by
> using \1 as a backreference instead of $1 (which is perfectly valid in
> Perl and is understood by uscan, but apparently not by the qa.debian.org
> scripts).

Your interpretation appear to be correct. Anyway, I don't think uscan
actually recognizes the \1 notation: if I use the watch file you posted
in the bug report, uscan says:

> $ uscan --report --dehs
> <dehs>
> <package>openttd</package>
> <debian-uversion>1.1.2</debian-uversion>
> <debian-mangled-uversion>1.1.2</debian-mangled-uversion>
> <upstream-version>1.1.2</upstream-version>
> <upstream-url>1/openttd-1-source.tar.gz</upstream-url>
> <status>up to date</status>
> </dehs>

which is exactly your problem. Also, the scripts behind the QA pages
actually call uscan to do the parsing.

BTW, the debian/watch that is in unstable now uses the $1 notation, so
fixes this problem. Anyway, there is another subtle bug:

> $ uscan --report --dehs
> <dehs>
> <package>openttd</package>
> <debian-uversion>1.1.2</debian-uversion>
> <debian-mangled-uversion>1.1.2</debian-mangled-uversion>
> <upstream-version>1.1.2</upstream-version>
> <upstream-url>http://master.binaries.openttd.org/releases/1.1.2/openttd-http://master.binaries.openttd.org/releases/1.1.2-source.tar.gz</upstream-url>
> <status>up to date</status>
> </dehs>

As you may see, the download URL is incorrect, because the mangling
wrongly matches on the whole URL, not only the version number. The
problem can be fixed with somewhat like this (you can use | instead of /
for separating substitution fields, so you have less escaping work to do):

options=downloadurlmangle=s|([^/]*)/index.html$|$1/openttd-$1-source.tar.gz|
\
http://master.binaries.openttd.org/releases/ \
(\d+(?:\.\d+)*)/index.html

Hope this helps.

> I'm not sure if this is a bug in my watchfile, or that qa.debian.org
> should support this, though. This might be a trival change in the
> qa.debian.org scripts, but I'll probably change my backreferences to use
> $ instead of \ anyway (seems Perl recommends using $1 instead of \1 as
> well).

I don't think this is a bug in QA scripts, because it actually depends
on uscan. You should probably file a whishlist bug against uscan asking
for the \1 notation to be supported or, at least, to have some
documentation somewhere about this decision.

Please, let me know your comments if you have any. Otherwise, I'll close
the report.

Giovanni.
-- 
Giovanni Mascellani <mascellani@poisson.phc.unipi.it>
Pisa, Italy

Web: http://poisson.phc.unipi.it/~mascellani
Jabber: g.mascellani@jabber.org / giovanni@elabor.homelinux.org

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: