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

uscan upstream version: padding zero to the left with elegance?



Hi,

I'm having an issue with an upstream where the latest git tag is
v2021.8.23 ; I would have liked them to (also) tag v2021.08.23, but
that won't happen.

So I need some uversionmangle magic.

I know how to get the parts $1=2021, $2=8 and $3=23, but I don't know
how to say $2 ($3 will need a similar adjustment) should be padded with
zeros to the left for a length of two -- it *should* be pretty
straightforward.

I tried looking:
- in the manpage for uscan ;
- in uscan's source code ;
- on codesearch for examples ;
- on internet for perl examples ;
but didn't find anything conclusive for use in a d/watch file.

The exceedingly inelegant but working (as far as I know!) trick I came
up with is:

uversionmangle=s/v?([\d]+)\.([\d]+)\.([\d]+).*/$1.0$2.0$3/;s/([\d]+)\.[
\d]*(\d\d)\.[\d]*(\d\d)/$1.$2.$3/

and I don't like it -- at all!

Does someone have better?

Cheers,

J.Puydt


Reply to: