From f29b128afdb80ec8f2718c1897e754c6a531bc37 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Tue, 21 May 2002 02:28:51 +0000 Subject: [PATCH] Accept X.YYplZ as a valid version number (equivalent to X.YY.0.Z) and generate Serial: tags in the RPM spec file to help clue RPM in. --- Makefile.in | 4 +++- nasm.spec.in | 1 + version.pl | 39 +++++++++++++++++++++------------------ 3 files changed, 25 insertions(+), 19 deletions(-) diff --git a/Makefile.in b/Makefile.in index e2408456..4fd20f60 100644 --- a/Makefile.in +++ b/Makefile.in @@ -172,4 +172,6 @@ tar: dist tar cvjf ../nasm-`cat version`-`date +%Y%m%d`.tar.bz2 ../`./nasm-dir` nasm.spec: nasm.spec.in version - sed -e s/@@VERSION@@/`cat version`/g < nasm.spec.in > nasm.spec + sed -e s/@@VERSION@@/`cat $(srcdir)/version`/g \ + -e s/@@ID@@/`$(PERL) $(srcdir)/version.pl < $(srcdir)/version`/g \ + < nasm.spec.in > nasm.spec diff --git a/nasm.spec.in b/nasm.spec.in index d0fe6ec9..1cbe193b 100644 --- a/nasm.spec.in +++ b/nasm.spec.in @@ -1,6 +1,7 @@ Summary: The Netwide Assembler, a portable x86 assembler with Intel-like syntax Name: nasm Version: @@VERSION@@ +Serial: @@ID@@ Release: 1 Copyright: LGPL Group: Development/Languages diff --git a/version.pl b/version.pl index bf8a9165..0f9ea750 100755 --- a/version.pl +++ b/version.pl @@ -7,7 +7,7 @@ # # The NASM version number is assumed to consist of: # -# .[.[.]] +# .[.][pl]] # # ... where is not necessarily numeric. # @@ -35,28 +35,27 @@ $line = ; chomp $line; -if ( $line =~ /^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/ ) { - $maj = $1; $nmaj = $maj+0; - $min = $2; $nmin = $min+0; - $smin = $3; $nsmin = $smin+0; - $plvl = $4; $nplvl = $plvl+0; - $tail = $'; -} elsif ( $line =~ /^([0-9]+)\.([0-9]+)\.([0-9]+)/ ) { - $maj = $1; $nmaj = $maj+0; - $min = $2; $nmin = $min+0; - $smin = $3; $nsmin = $smin+0; - $plvl = ''; $nplvl = 0; - $tail = $'; -} elsif ( $line =~ /^([0-9]+)\.([0-9]+)/ ) { - $maj = $1; $nmaj = $maj+0; - $min = $2; $nmin = $min+0; - $smin = ''; $nsmin = 0; - $plvl = ''; $nplvl = 0; +undef $man, $min, $smin, $plvl, $tail; + +if ( $line =~ /^([0-9]+)\.([0-9]+)/ ) { + $maj = $1; + $min = $2; $tail = $'; + if ( $tail =~ /^\.([0-9]+)/ ) { + $smin = $1; + $tail = $'; + } + if ( $tail =~ /^(pl|\.)([0-9]+)/ ) { + $plvl = $2; + $tail = $'; + } } else { die "$0: Invalid input format\n"; } +$nmaj = $maj+0; $nmin = $min+0; +$nsmin = $smin+0; $nplvl = $plvl+0; + $nasm_id = ($nmaj << 24)+($nmin << 16)+($nsmin << 8)+$nplvl; if ( $what eq 'h' ) { @@ -76,6 +75,10 @@ if ( $what eq 'h' ) { printf "%%define __NASM_PATCHLEVEL__ %d\n", $nplvl; printf "%%define __NASM_VERSION_ID__ 0%08Xh\n", $nasm_id; printf "%%define __NASM_VER__ \"%s\"\n", $line; +} elsif ( $what eq 'id' ) { + print $nasm_id, "\n"; # Print ID in decimal +} elsif ( $what eq 'xid' ) { + printf "0x%08x\n", $nasm_id; # Print ID in hexadecimal } else { die "$0: Unknown output: $what\n"; }