libCom: Changes to epicsVersion.h generation

Use DEV instead of CVS in names.
Lower-case the -rc<n> status strings.
Rename CVS_DATE to COMMIT_DATE.
No Bazaar equivalent to the CVS tag $Name$ exists.
Modernize and "use strict" in the Perl code.
This commit is contained in:
Andrew Johnson
2010-10-05 13:33:35 -05:00
parent 64771c1708
commit 5d17059cb1
2 changed files with 62 additions and 45 deletions

View File

@@ -1,5 +1,5 @@
#*************************************************************************
# Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
# Copyright (c) 2010 UChicago Argonne LLC, as Operator of Argonne
# National Laboratory.
# Copyright (c) 2002 The Regents of the University of California, as
# Operator of Los Alamos National Laboratory.
@@ -7,7 +7,7 @@
# in the file LICENSE that is included with this distribution.
#*************************************************************************
#
# $Id$
# $Revision-Id$
#
# EPICS Version information
#
@@ -32,15 +32,15 @@ EPICS_MODIFICATION = 11
# Not included if zero
EPICS_PATCH_LEVEL = 0
# This will end in -CVS between official releases
EPICS_CVS_SNAPSHOT=-CVS
#EPICS_CVS_SNAPSHOT=-pre1
#EPICS_CVS_SNAPSHOT=-pre1-CVS
#EPICS_CVS_SNAPSHOT=-RC1
#EPICS_CVS_SNAPSHOT=-RC1-CVS
#EPICS_CVS_SNAPSHOT=-RC2
#EPICS_CVS_SNAPSHOT=-RC2-CVS
#EPICS_CVS_SNAPSHOT=
# This will end in -DEV between official releases
EPICS_DEV_SNAPSHOT=-DEV
#EPICS_DEV_SNAPSHOT=-pre1
#EPICS_DEV_SNAPSHOT=-pre1-DEV
#EPICS_DEV_SNAPSHOT=-rc1
#EPICS_DEV_SNAPSHOT=-rc1-DEV
#EPICS_DEV_SNAPSHOT=-rc2
#EPICS_DEV_SNAPSHOT=-rc2-DEV
#EPICS_DEV_SNAPSHOT=
# No changes should be needed below here
@@ -53,8 +53,12 @@ ifneq ($(strip $(EPICS_SITE_VERSION)),)
endif
EPICS_SHORT_VERSION=$(EPICS_VERSION).$(EPICS_REVISION).$(EPICS_MODIFICATION)$(EPICS_PATCH_VSTRING)
EPICS_VERSION_NUMBER=$(EPICS_SHORT_VERSION)$(EPICS_CVS_SNAPSHOT)$(EPICS_SITE_VSTRING)
EPICS_VERSION_NUMBER=$(EPICS_SHORT_VERSION)$(EPICS_DEV_SNAPSHOT)$(EPICS_SITE_VSTRING)
EPICS_VERSION_STRING="EPICS Version $(EPICS_VERSION_NUMBER)"
CVS_DATE="\$$Date$$"
CVS_TAG="\$$Name$$"
COMMIT_DATE="\$$Date$$"
# Provide these in case anyone is still using the old names
EPICS_CVS_SNAPSHOT=$(EPICS_DEV_SNAPSHOT)
CVS_DATE=$(COMMIT_DATE)
CVS_TAG="-no-tags-"

View File

@@ -1,60 +1,73 @@
#!/usr/bin/perl
#*************************************************************************
# Copyright (c) 2002 The University of Chicago, as Operator of Argonne
# Copyright (c) 2010 UChicago Argonne LLC, as Operator of Argonne
# National Laboratory.
# Copyright (c) 2002 The Regents of the University of California, as
# Operator of Los Alamos National Laboratory.
# EPICS BASE Versions 3.13.7
# and higher are distributed subject to a Software License Agreement found
# EPICS BASE is distributed subject to a Software License Agreement found
# in file LICENSE that is included with this distribution.
#*************************************************************************
($infile, $outdir, $site_ver) = @ARGV;
use strict;
my ($ver, $rev, $mod, $patch, $snapshot, $commit_date);
my ($infile, $outdir, $site_ver) = @ARGV;
die "Usage: perl makeEpicsVersion.pl CONFIG_BASE_VERSION outdir siteversion"
unless ($infile && $outdir);
print "Building epicsVersion.h from $infile\n";
open VARS, $infile or die "Can't open $infile: $!\n";
open my $VARS, '<', $infile
or die "Can't open $infile: $!\n";
while (<VARS>)
{
chomp;
next if m/^#/; # Skip comments
if (m/^EPICS_VERSION\s*=\s*(\d+)/) { $ver = $1; }
if (m/^EPICS_REVISION\s*=\s*(\d+)/) { $rev = $1; }
if (m/^EPICS_MODIFICATION\s*=\s*([0-9a-z]+)/) { $mod = $1; }
if (m/^EPICS_PATCH_LEVEL\s*=\s*(\d+)/) { $patch = $1; }
if (m/^EPICS_CVS_SNAPSHOT\s*=\s*([CVS-]+)/) { $snapshot = $1; }
if (m/^CVS_DATE\s*=\s*"\\(.*)"/) { $cvs_date = $1; }
if (m/^CVS_TAG\s*=\s*"\\(.*)"/) { $cvs_tag = $1; }
while (<$VARS>) {
chomp;
next if m/^\s*#/; # Skip comments
if (m/^EPICS_VERSION\s*=\s*(\d+)/) { $ver = $1; }
if (m/^EPICS_REVISION\s*=\s*(\d+)/) { $rev = $1; }
if (m/^EPICS_MODIFICATION\s*=\s*([0-9a-z]+)/) { $mod = $1; }
if (m/^EPICS_PATCH_LEVEL\s*=\s*(\d+)/) { $patch = $1; }
if (m/^EPICS_DEV_SNAPSHOT\s*=\s*([DEV-]+)/) { $snapshot = $1; }
if (m/^COMMIT_DATE\s*=\s*"\\(.*)"/) { $commit_date = $1; }
}
close $VARS;
$ver_str = "$ver.$rev.$mod";
map {
die "Variable missing from $infile" unless defined $_;
} $ver, $rev, $mod, $patch, $snapshot, $commit_date;
my $ver_str = "$ver.$rev.$mod";
$ver_str .= ".$patch" if $patch > 0;
$ver_str .= $snapshot if $snapshot ne '';
$ver_str .= "-$site_ver" if $site_ver;
print "Found EPICS Version $ver_str\n";
$epicsVersion="$outdir/epicsVersion.h";
my $epicsVersion="$outdir/epicsVersion.h";
mkdir ($outdir, 0777) unless -d $outdir;
open OUT, "> $epicsVersion" or die "Cannot create $epicsVersion: $!\n";
open my $OUT, '>', $epicsVersion
or die "Cannot create $epicsVersion: $!\n";
print OUT "#define EPICS_VERSION $ver\n";
print OUT "#define EPICS_REVISION $rev\n";
print OUT "#define EPICS_MODIFICATION $mod\n";
print OUT "#define EPICS_PATCH_LEVEL $patch\n";
print OUT "#define EPICS_CVS_SNAPSHOT \"$snapshot\"\n";
print OUT "#define EPICS_SITE_VERSION \"$site_ver\"\n";
print OUT "#define EPICS_VERSION_STRING \"EPICS $ver_str\"\n";
print OUT "#define epicsReleaseVersion \"EPICS R$ver_str $cvs_tag $cvs_date\"\n";
print OUT "\n";
print OUT "/* EPICS_UPDATE_LEVEL is deprecated, use EPICS_PATCH_LEVEL instead */\n";
print OUT "#define EPICS_UPDATE_LEVEL $patch\n";
print $OUT <<"END_OUTPUT";
/* Generated epicsVersion.h */
close OUT;
#define EPICS_VERSION $ver
#define EPICS_REVISION $rev
#define EPICS_MODIFICATION $mod
#define EPICS_PATCH_LEVEL $patch
#define EPICS_DEV_SNAPSHOT "$snapshot"
#define EPICS_SITE_VERSION "$site_ver"
#define EPICS_VERSION_STRING "EPICS $ver_str"
#define epicsReleaseVersion "EPICS R$ver_str $commit_date"
/* The following names are deprecated, use the equivalent name above */
#define EPICS_UPDATE_LEVEL EPICS_PATCH_LEVEL
#define EPICS_CVS_SNAPSHOT EPICS_DEV_SNAPSHOT
END_OUTPUT
close $OUT;