RPM Community Forums

Mailing List Message of <rpm-devel>

Re: Generalizing EVR comparison precedence, preliminaries

From: Ralf S. Engelschall <rse+rpm-devel@rpm5.org>
Date: Thu 01 Jan 2009 - 19:04:40 CET
Message-ID: <20090101180440.GA13013@engelschall.com>
On Thu, Jan 01, 2009, Jeff Johnson wrote:

>> On Thu, Jan 01, 2009, Jeff Johnson wrote:
>>> [...]
>>> However a framework that permits extending the {E,V,R} triple as a
>>> tuple, and permuting the precedence order of the tuple members (in
>>> case left-to-right implicit precedence ordering is unsatisfying) is
>>> feasible within RPM.
>>> [...]
>> I fully second this approach!
>> For instance for OpenPKG I usually need to ignore "E" (as it is not
>> used) and compare "R" _before_ "V" -- as the "R" in OpenPKG follows
>> a strict and consistent scheme while the "V" is mostly arbitrary and
>> build/install decisions hence usually depend on "R" only. If something
>> like this permutation and filtering could be achieved via some little
>> macro settings this would be great ;-)
> A little help vetting the RE's please ;-) My eyes are already tired
> from writing the toy script, RE's are more effective than XML at eye
> gouging.

I propose the following three entries in "macros"...

    # STEP 1: Match the string and capture regex parts
    #                      1          2           3             4
    #                      X     ":"  X        "-"X          ":"X
    %evr_tuple_match  ^(?:([^:-]+):)?([^:-]+)(?:-([^:-]+))?(?::([^:-]+))?$

    # STEP 2: Assemble <E,V,R,D> tuple from regex parts
    # <E,V,R,D>       case 1:  case 2:  case 3:  case 4:  case 5:  case 6:
    #                 X:X-X:X  X:X-X    X:X      X:       X-X      X
    %evr_tuple_select 1234     123_     12__     1___     _12_     __2_

    # STEP 3: Configure the comparison order of the <E,V,R,D> tuple elements
    %evr_tuple_order  EVRD

...plus the corresponding C code which takes "%evr_tuple_match",
compiles it, matches it against the string, uses the "%evr_tuple_select"
alternatives (first one which results in no undefined captured regex
parts wins and stop the tuple selection) to create the tuple and then
"%evr_tuple_order" is used to configure the order on how the tuple
elements are compared.

                                       Ralf S. Engelschall
Received on Thu Jan 1 19:04:56 2009
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.