On Jan 2, 2009, at 4:46 AM, Ralf S. Engelschall wrote:
On Thu, Jan 01, 2009, Jeff Johnson wrote:On Jan 1, 2009, at 1:04 PM, Ralf S. Engelschall wrote:A little help vetting the RE's please ;-) My eyes are already tiredfrom writing the toy script, RE's are more effective than XML at eyegouging.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 ^(?:([^:-]+):)?([^:-]+)(?:-([^:-]+))?(?::([^:-] +))?$A little more help please. I'm using POSIX extended RE's.Oh, sorry. I silemtly assumed PCRE! But ok, a non-PCRE version is also possible: we just have to replace the non-capturing parenthesis (?:..) with regular ones and then just ignore them in the selection phase:
Hmmm, the PCRE posix emulation seems to *ahem* extend POSIX syntax slightly then. I do have an assertion in place on the parsed results using RRPMMIRE_REGEX
with the original pattern and tested with rpm -Va --nofiles But perhaps I screwed the assertion (or mire.c needs fixing) somehow. It may be time to commit to PCRE as mandatory when building rpm, and use PCRE patterns consistently. There's a few compatibility issues on older linux distros, not hard to fix. There's also the pattern for extracting href's from HTML that you kindly gave me a year ago to. Both the html and now the EVRD parsers are rather too important to be lost if/when rpm is built without PCRE.
# STEP 1: Match the string and capture regex parts # 2 3 5 7 # 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 2357 237_ 23__ 2___ _23_ __5_# STEP 3: Configure the comparison order of the <E,V,R,D> tuple elements%evr_tuple_order EVRD
Thanks! I will add both to macros.in for now (and to help me read PCRE patterns).
73 de Jeff
This should do the trick with regular POSIX regular expressions, too. Ralf S. Engelschall r...@engelschall.com www.engelschall.com ______________________________________________________________________ RPM Package Manager http://rpm5.org Developer Communication List rpm-devel@rpm5.org
smime.p7s
Description: S/MIME cryptographic signature