Marius Mauch wrote: > But like name_splitted.cpp is buggy as it assumes that a dash followed > by a digit starts the version part. See > echo ${PORTDIR}/*-*/* | tr ' ' '\n' | grep '\-[[:digit:]]' > for some names that break the assumption. > Whoops :S Guess I need to change that then :) > And no clue what that cvs stuff is supposed to do, as there are no > packages using that naming pattern, and the (unused) cvs versioning > extension in portage-2.1 also uses a different pattern. > 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. 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]+))?$' For inter-rev compatibility, we changed the last term to: (-r([0-9.]+))? (we check that there's only one . later.) [We should also use [[:digit:]] instead of [0-9] for i18n.]
I think we can use: CPV='^(.*-.*)/(.*)-(cvs\.)?([0-9]+)((\.[0-9]+)*)([a-z]?)((_(pre|p|beta alpha|rc)[0-9]*)*)(-r([0-9.]+))?$' - as a regex to check against. If it doesn't match, it isn't a valid cpv (I think.) I've tested it on the whole (non-overlay) tree with the following script: http://dev.gentooexperimental.org/~igli/src/verCheck md5: 53ef36ffd9388308ff02306f301382c1 It's called with ./verCheck to check the whole tree, or with an optional [cat-search] parameter, eg ./verCheck media-fonts or ./verCheck 'media-*' Adding -v as the first parameter means it will output version info for all ebuilds it finds, otherwise it will only output for packages with the tricky pattern -[0-9] Any ebuilds that don't match, get output to stderr. I didn't find any, and for all the ones it found with -N in the package name, it seemed to get the correct version numbers, afaict: $ ./verCheck app-dicts: canna-2ch 20030827 media-fonts: font-adobe-100dpi 1.0.0 font-adobe-75dpi 1.0.0 font-adobe-utopia-100dpi 1.0.1 font-adobe-utopia-75dpi 1.0.1 font-bh-100dpi 1.0.0 font-bh-75dpi 1.0.0 font-bh-lucidatypewriter-100dpi 1.0.0 font-bh-lucidatypewriter-75dpi 1.0.0 font-bitstream-100dpi 1.0.0 font-bitstream-75dpi 1.0.0 net-dialup: intel-536ep 4.71 net-misc: cisco-vpnclient-3des 4.6.02.0030 4.6.03.01901 4.7.00.0640 4.7.00.06401 4.8.00.0490 nxclient-2xterminalserver 1.5.0 nxserver-2xterminalserver 1.5.0 (No, UberLord: it /won't/ work in sh ;p) -- [EMAIL PROTECTED] mailing list