Marius Mauch wrote: > On Sun, 21 Oct 2007 23:13:58 +0100 > Steve Long <[EMAIL PROTECTED]> wrote: >> Well the line from portage_versions.py is: >> ver_regexp = re.compile("^(cvs\\.)?(\\d+)((\\.\\d+)*)([a-z]?)((_(pre| >> p|beta >> alpha|rc)\\d*)*)(-r(\\d+))?$") >> - which means that a version begins with either a digit or cvs >> followed by digit. > > Not precisely: a digit, or "cvs" followed by a dot and a digit (you got > it right in the following, but not in the code posted earlier) > Bleh, thanks: code review FTW! Sleep-loss er FTL :p >> We represented this in bash (for verCompare) as: >> ver='^(cvs\.)?([0-9]+)((\.[0-9]+)*)([a-z]?)((_(pre|p|beta|alpha|rc) >> [0-9]*)* (-r([0-9]+))?$' >> >> I think we can use: >> CPV='^(.*-.*)/(.*)-(cvs\.)?([0-9]+)((\.[0-9]+)*)([a-z]?)((_(pre|p|beta >> alpha|rc)[0-9]*)*)(-r([0-9.]+))?$' > > Well, categories don't necessarily have to contain a dash (though all > official ones do currently). > Ah OK, excellent! ^(([[:alpha:]]+-[[:alpha:]]+)|virtual)/.. and ^([[:alpha:]]+(-[[:alpha:]]+)?)/.. (if other single-terms are to be allowed) - would add one to every subsequent term index (for the general case, not when globbing the tree.)
If we can correctly reduce this to a single regex match, it'll make my life a lot easier :) (For update there's no need to check the category exists, since the strings are taken from portage output, but such a check could be performed after the match.) -- [EMAIL PROTECTED] mailing list