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

Re: Strange problem with uscan



On Sat, Dec 26, 2020 at 09:50:39AM +0100, Mechtilde Stehmann wrote:
> sometimes uscan is unable to download upstream sources and failed:
> This happens only when I have name and version number like
> jackson-core-2.12.0

Hmm, it looks to me like it would fail always?

> What is wrong here?
> This is my watch file:
> 
> version=4
> opts=\
> uversionmangle=s/-alpha/~alpha/;s/-Beta/~beta/;s/-rc/~rc/;s/PRE/~pre/,\
> filenamemangle=s/.+\/v?(\d\S+)\.*/$1/ \
> https://github.com/FasterXML/jackson-core/releases .*jackson-core-
> v?(\d\S+)\.tar\.gz

There seems to be bug in your "filenamemangle" regex.

And if that "filenamemangle" doesn't match, uscan(1) documentation
says the uscan will take alternate route, which is probably not what you want. 
So you must make sure this regex always matches and produces wanted filename.


You can test your filenamemangle with:
echo '$URLPART' | perl -pe '$REGEX'

eg.

% echo '/FasterXML/jackson-core/archive/jackson-core-2.12.0.tar.gz' | perl -pe 's/.+\/v?(\d\S+)\.*/$1/'
/FasterXML/jackson-core/archive/jackson-core-2.12.0.tar.gz

which returns wrong result -- you want it to return JUST filename without any path
components (ie. just "jackson-core-2.12.0.tar.gz" in this case)

Note that "\.*" is especially wrong in your regex, as it means 
"0 or more of LITERAL dot (".") characters, like "" or "." or ".......", 
but nothing else. If you wanted to match 0 or more of ANY characters
(as I guess was intention), it would be just ".*" (without "\").

For latest file released this looks like working regex:
echo    /FasterXML/jackson-core/archive/jackson-core-2.12.0.tar.gz | perl -pe 's/.+\/(jackson-core-\d\S+).*/$1/'
jackson-core-2.12.0.tar.gz

So you can start with that and improve.  Just make sure it always
matches all your possible URLs and produces (just a) correct
filename.

Hope this helps,
Matija

-- 
Opinions above are GNU-copylefted.


Reply to: