version.pl: support version numbers of the form X.Y[.Z]rcW

Support version numbers of the form X.Y[.Z]rcW where X, Y, Z and W are
numbers.  For the numeric macros, drop them down to a lower level, so
2.0rc1 is treated as version 1.99.99.91.
This commit is contained in:
H. Peter Anvin 2007-09-22 16:19:19 -07:00
parent af31d43368
commit b10f3e2dca

View File

@ -35,18 +35,23 @@ $line = <STDIN>;
chomp $line;
undef $man, $min, $smin, $plvl, $tail;
$is_rc = 0;
if ( $line =~ /^([0-9]+)\.([0-9]+)/ ) {
if ( $line =~ /^([0-9]+)\.([0-9]+)(.*)$/ ) {
$maj = $1;
$min = $2;
$tail = $';
if ( $tail =~ /^\.([0-9]+)/ ) {
$tail = $3;
if ( $tail =~ /^\.([0-9]+)(.*)$/ ) {
$smin = $1;
$tail = $';
$tail = $2;
}
if ( $tail =~ /^(pl|\.)([0-9]+)/ ) {
if ( $tail =~ /^(pl|\.)([0-9]+)(.*)$/ ) {
$plvl = $2;
$tail = $';
$tail = $3;
} elsif ( $tail =~ /^rc([0-9]+)(.*)$/ ) {
$is_rc = 1;
$plvl = $1;
$tail = $2;
}
} else {
die "$0: Invalid input format\n";
@ -55,6 +60,21 @@ if ( $line =~ /^([0-9]+)\.([0-9]+)/ ) {
$nmaj = $maj+0; $nmin = $min+0;
$nsmin = $smin+0; $nplvl = $plvl+0;
if ($is_rc) {
$nplvl += 90;
if ($nsmin > 0) {
$nsmin--;
} else {
$nsmin = 99;
if ($nmin > 0) {
$nmin--;
} else {
$nmin = 99;
$nmaj--;
}
}
}
$nasm_id = ($nmaj << 24)+($nmin << 16)+($nsmin << 8)+$nplvl;
if ( $what eq 'h' ) {