This is the mail archive of the cygwin-apps mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: upset, genini: different version ordering


On Jul 23 19:08, Achim Gratz wrote:
> Corinna Vinschen writes:
> >> Thanks, that confirms my suspicions.  Could you tell me what Normalize
> >> uses as the two inputs and how it returns the result?
> >
> > I'm not really sure.  It seems the input is a filename and something
> > optional called a "prematch".
> 
> Is that optional paremeter ever used?

Yes.  In the function itself prematch is generated from some regex if
it's not given as parameter.  There are three places calling Normalize,
two of them with a 2nd parameter.

On closer inspection it seems there's already some provisioning for
different versioning schemes.  At one point the second parameter
is constructed from an entry in setup.hint called "verpat" and a keyword
"verpat" is recognized for that.  If "verpat: ,,," is not given for a package,
the pattern used as 2nd parameter is set to the package name, a dash,
followed by any character string, followed by ".tar", followed by an
arbitrary string.

Paramter 1 can be a path, not only a filename, btw.

Uh oh.  There's also a snippet of code at the end of Normalize which
"normalizes" the file suffix.  All .tar* variants are "normalized" into
.tar.gz, presumably for sorting purposes.

> > The return value is apparently a pair, normalized version and version.
> 
> OK, so it would seem that the sort routine will use the first for
> ordering and the second for any literal use of the version string.

Maybe.  Actually, I was wrong.  Normalize can return a single value
*or* an array with three values.  It seems only the three-value array
return variant is used.  The places from where Normalize is called
cuts out the values of interest.

I'm really sorry, but AFAICS the code should be able to win the
obfuscated perl contest hands down.  No noticable commenting either.

We could really need help from somebody knowing perl well enough
to understand and describe code :}


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

Attachment: pgpMwWTTprA8j.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]