On Friday 3 August 2007 16:48, Bluefuture wrote:
> This is actually the convertion function with regular expression:
>
> function vers_conv($debvers) {
> preg_match("/(.+:)?([^-]+)(ds|dsfg|debian)/",$debvers,$matches);
I would change "dsfg" to "dfsg" :-)
But for the rest... I've just reimplemented the function. The epoch- and
Debian version parts are actually quite easy: just find the first ":" from
the start or the first "-" from the end, and trim that off. I've therefore
chosen to keep that outside of the regexes but just do that by string
matching.
Then I close off with the regex for dfsg-like strings, which is therefore less
complex.
// Try to extract just the upstream version from the full version number.
function vers_conv($debvers) {
// Strip off the epoch
$pos = strpos($debvers, ':');
if ( $pos !== FALSE) {
$debvers = substr($debvers, $pos+1);
}
// strip off the Debian revision (look from the back of the string)
$pos = strrpos($debvers, '-');
if ( $pos !== FALSE) {
$debvers = substr($debvers, 0, $pos);
}
// strip off repacking indicators
$debvers = preg_replace("/[.+]?(ds|dfsg|debian)(.*)/i", "", $debvers);
return $debvers;
}
I hope this helps. If you have a source control repository of dehs I can
probably supply it as a patch against that.
Thijs
Attachment:
pgpbYeXTR9JBY.pgp
Description: PGP signature