From b10f3e2dca1df539350ca3a77092d64fe44ceb25 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sat, 22 Sep 2007 16:19:19 -0700 Subject: [PATCH] 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. --- version.pl | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/version.pl b/version.pl index d8fdad4..21ba866 100755 --- a/version.pl +++ b/version.pl @@ -35,18 +35,23 @@ $line = ; 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' ) { -- 2.7.4