New version templates for buildbot.

--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402534
This commit is contained in:
David Anderson 2008-09-14 05:13:21 +00:00
parent 71e89f75ae
commit 946e4ab58a
31 changed files with 278 additions and 221 deletions

View File

@ -284,6 +284,7 @@ void RootConsoleMenu::OnRootConsoleCommand(const char *cmdname, const CCommand &
ConsolePrint(" JIT Version: %s, %s", g_pVM->GetVMName(), g_pVM->GetVersionString());
ConsolePrint(" JIT Settings: %s", g_pVM->GetCPUOptimizations());
ConsolePrint(" Compiled on: %s %s", __DATE__, __TIME__);
ConsolePrint(" Build ID: %s", SM_BUILD_UNIQUEID);
ConsolePrint(" http://www.sourcemod.net/");
}
}

View File

@ -40,7 +40,9 @@
* @file Contains SourceMod version information.
*/
#define SVN_FULL_VERSION "1.0.3-svn"
#define SVN_FILE_VERSION 1,0,3,2239
#define SM_BUILD_STRING ""
#define SM_BUILD_UNIQUEID "2533" SM_BUILD_STRING
#define SVN_FULL_VERSION "1.0.4" SM_BUILD_STRING
#define SVN_FILE_VERSION 1,0,4,0
#endif //_INCLUDE_SOURCEMOD_VERSION_H_

View File

@ -40,7 +40,9 @@
* @file Contains SourceMod version information.
*/
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$-svn"
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,$GLOBAL_BUILD$
#define SM_BUILD_STRING "$BUILD_STRING$"
#define SM_BUILD_UNIQUEID "$BUILD_ID$" SM_BUILD_STRING
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$" SM_BUILD_STRING
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,0
#endif //_INCLUDE_SOURCEMOD_VERSION_H_

View File

@ -36,7 +36,9 @@
#ifndef _INCLUDE_BINTOOLS_VERSION_H_
#define _INCLUDE_BINTOOLS_VERSION_H_
#define SVN_FULL_VERSION "1.0.3-svn"
#define SVN_FILE_VERSION 1,0,3,2239
#define SM_BUILD_STRING ""
#define SM_BUILD_UNIQUEID "2533" SM_BUILD_STRING
#define SVN_FULL_VERSION "1.0.4" SM_BUILD_STRING
#define SVN_FILE_VERSION 1,0,4,0
#endif //_INCLUDE_BINTOOLS_VERSION_H_

View File

@ -36,7 +36,9 @@
#ifndef _INCLUDE_BINTOOLS_VERSION_H_
#define _INCLUDE_BINTOOLS_VERSION_H_
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$-svn"
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,$GLOBAL_BUILD$
#define SM_BUILD_STRING "$BUILD_STRING$"
#define SM_BUILD_UNIQUEID "$BUILD_ID$" SM_BUILD_STRING
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$" SM_BUILD_STRING
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,0
#endif //_INCLUDE_BINTOOLS_VERSION_H_

View File

@ -36,7 +36,9 @@
#ifndef _INCLUDE_SDKTOOLS_VERSION_H_
#define _INCLUDE_SDKTOOLS_VERSION_H_
#define SVN_FULL_VERSION "1.0.3-svn"
#define SVN_FILE_VERSION 1,0,3,2239
#define SM_BUILD_STRING ""
#define SM_BUILD_UNIQUEID "2533" SM_BUILD_STRING
#define SVN_FULL_VERSION "1.0.4" SM_BUILD_STRING
#define SVN_FILE_VERSION 1,0,4,0
#endif //_INCLUDE_SDKTOOLS_VERSION_H_

View File

@ -36,7 +36,9 @@
#ifndef _INCLUDE_SDKTOOLS_VERSION_H_
#define _INCLUDE_SDKTOOLS_VERSION_H_
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$-svn"
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,$GLOBAL_BUILD$
#define SM_BUILD_STRING "$BUILD_STRING$"
#define SM_BUILD_UNIQUEID "$BUILD_ID$" SM_BUILD_STRING
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$" SM_BUILD_STRING
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,0
#endif //_INCLUDE_SDKTOOLS_VERSION_H_

View File

@ -36,7 +36,9 @@
#ifndef _INCLUDE_GEOIP_VERSION_H_
#define _INCLUDE_GEOIP_VERSION_H_
#define SVN_FULL_VERSION "1.0.3-svn"
#define SVN_FILE_VERSION 1,0,3,2239
#define SM_BUILD_STRING ""
#define SM_BUILD_UNIQUEID "2533" SM_BUILD_STRING
#define SVN_FULL_VERSION "1.0.4" SM_BUILD_STRING
#define SVN_FILE_VERSION 1,0,4,0
#endif //_INCLUDE_GEOIP_VERSION_H_

View File

@ -36,7 +36,9 @@
#ifndef _INCLUDE_GEOIP_VERSION_H_
#define _INCLUDE_GEOIP_VERSION_H_
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$-svn"
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,$GLOBAL_BUILD$
#define SM_BUILD_STRING "$BUILD_STRING$"
#define SM_BUILD_UNIQUEID "$BUILD_ID$" SM_BUILD_STRING
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$" SM_BUILD_STRING
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,0
#endif //_INCLUDE_GEOIP_VERSION_H_

View File

@ -36,7 +36,9 @@
#ifndef _INCLUDE_MYSQLEXT_VERSION_H_
#define _INCLUDE_MYSQLEXT_VERSION_H_
#define SVN_FULL_VERSION "1.0.3-svn"
#define SVN_FILE_VERSION 1,0,3,2239
#define SM_BUILD_STRING ""
#define SM_BUILD_UNIQUEID "2533" SM_BUILD_STRING
#define SVN_FULL_VERSION "1.0.4" SM_BUILD_STRING
#define SVN_FILE_VERSION 1,0,4,0
#endif //_INCLUDE_MYSQLEXT_VERSION_H_

View File

@ -36,7 +36,9 @@
#ifndef _INCLUDE_MYSQLEXT_VERSION_H_
#define _INCLUDE_MYSQLEXT_VERSION_H_
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$-svn"
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,$GLOBAL_BUILD$
#define SM_BUILD_STRING "$BUILD_STRING$"
#define SM_BUILD_UNIQUEID "$BUILD_ID$" SM_BUILD_STRING
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$" SM_BUILD_STRING
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,0
#endif //_INCLUDE_MYSQLEXT_VERSION_H_

View File

@ -36,7 +36,9 @@
#ifndef _INCLUDE_REGEXEXT_VERSION_H_
#define _INCLUDE_REGEXEXT_VERSION_H_
#define SVN_FULL_VERSION "1.0.3-svn"
#define SVN_FILE_VERSION 1,0,3,2239
#define SM_BUILD_STRING ""
#define SM_BUILD_UNIQUEID "2533" SM_BUILD_STRING
#define SVN_FULL_VERSION "1.0.4" SM_BUILD_STRING
#define SVN_FILE_VERSION 1,0,4,0
#endif //_INCLUDE_REGEXEXT_VERSION_H_

View File

@ -36,7 +36,9 @@
#ifndef _INCLUDE_REGEXEXT_VERSION_H_
#define _INCLUDE_REGEXEXT_VERSION_H_
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$-svn"
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,$GLOBAL_BUILD$
#define SM_BUILD_STRING "$BUILD_STRING$"
#define SM_BUILD_UNIQUEID "$BUILD_ID$" SM_BUILD_STRING
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$" SM_BUILD_STRING
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,0
#endif //_INCLUDE_REGEXEXT_VERSION_H_

View File

@ -36,7 +36,9 @@
#ifndef _INCLUDE_SDKTOOLS_VERSION_H_
#define _INCLUDE_SDKTOOLS_VERSION_H_
#define SVN_FULL_VERSION "1.0.3-svn"
#define SVN_FILE_VERSION 1,0,3,2239
#define SM_BUILD_STRING ""
#define SM_BUILD_UNIQUEID "2533" SM_BUILD_STRING
#define SVN_FULL_VERSION "1.0.4" SM_BUILD_STRING
#define SVN_FILE_VERSION 1,0,4,0
#endif //_INCLUDE_SDKTOOLS_VERSION_H_

View File

@ -36,7 +36,9 @@
#ifndef _INCLUDE_SDKTOOLS_VERSION_H_
#define _INCLUDE_SDKTOOLS_VERSION_H_
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$-svn"
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,$GLOBAL_BUILD$
#define SM_BUILD_STRING "$BUILD_STRING$"
#define SM_BUILD_UNIQUEID "$BUILD_ID$" SM_BUILD_STRING
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$" SM_BUILD_STRING
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,0
#endif //_INCLUDE_SDKTOOLS_VERSION_H_

View File

@ -36,7 +36,9 @@
#ifndef _INCLUDE_SQLITEEXT_VERSION_H_
#define _INCLUDE_SQLITEEXT_VERSION_H_
#define SVN_FULL_VERSION "1.0.3-svn"
#define SVN_FILE_VERSION 1,0,3,2239
#define SM_BUILD_STRING ""
#define SM_BUILD_UNIQUEID "2533" SM_BUILD_STRING
#define SVN_FULL_VERSION "1.0.4" SM_BUILD_STRING
#define SVN_FILE_VERSION 1,0,4,0
#endif //_INCLUDE_SQLITEEXT_VERSION_H_

View File

@ -36,7 +36,9 @@
#ifndef _INCLUDE_SQLITEEXT_VERSION_H_
#define _INCLUDE_SQLITEEXT_VERSION_H_
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$-svn"
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,$GLOBAL_BUILD$
#define SM_BUILD_STRING "$BUILD_STRING$"
#define SM_BUILD_UNIQUEID "$BUILD_ID$" SM_BUILD_STRING
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$" SM_BUILD_STRING
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,0
#endif //_INCLUDE_SQLITEEXT_VERSION_H_

View File

@ -36,7 +36,9 @@
#ifndef _INCLUDE_SDKTOOLS_VERSION_H_
#define _INCLUDE_SDKTOOLS_VERSION_H_
#define SVN_FULL_VERSION "1.0.3-svn"
#define SVN_FILE_VERSION 1,0,3,2239
#define SM_BUILD_STRING ""
#define SM_BUILD_UNIQUEID "2533" SM_BUILD_STRING
#define SVN_FULL_VERSION "1.0.4" SM_BUILD_STRING
#define SVN_FILE_VERSION 1,0,4,0
#endif //_INCLUDE_SDKTOOLS_VERSION_H_

View File

@ -36,7 +36,9 @@
#ifndef _INCLUDE_SDKTOOLS_VERSION_H_
#define _INCLUDE_SDKTOOLS_VERSION_H_
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$-svn"
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,$GLOBAL_BUILD$
#define SM_BUILD_STRING "$BUILD_STRING$"
#define SM_BUILD_UNIQUEID "$BUILD_ID$" SM_BUILD_STRING
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$" SM_BUILD_STRING
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,0
#endif //_INCLUDE_SDKTOOLS_VERSION_H_

View File

@ -36,7 +36,9 @@
#ifndef _INCLUDE_SQLITEEXT_VERSION_H_
#define _INCLUDE_SQLITEEXT_VERSION_H_
#define SVN_FULL_VERSION "1.0.3-svn"
#define SVN_FILE_VERSION 1,0,3,2239
#define SM_BUILD_STRING ""
#define SM_BUILD_UNIQUEID "2533" SM_BUILD_STRING
#define SVN_FULL_VERSION "1.0.4" SM_BUILD_STRING
#define SVN_FILE_VERSION 1,0,4,0
#endif //_INCLUDE_SQLITEEXT_VERSION_H_

View File

@ -36,7 +36,9 @@
#ifndef _INCLUDE_SQLITEEXT_VERSION_H_
#define _INCLUDE_SQLITEEXT_VERSION_H_
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$-svn"
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,$GLOBAL_BUILD$
#define SM_BUILD_STRING "$BUILD_STRING$"
#define SM_BUILD_UNIQUEID "$BUILD_ID$" SM_BUILD_STRING
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$" SM_BUILD_STRING
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,0
#endif //_INCLUDE_SQLITEEXT_VERSION_H_

View File

@ -40,7 +40,9 @@
* @file Contains SourceMod version information.
*/
#define SVN_FULL_VERSION "1.0.3.2239"
#define SVN_FILE_VERSION 1,0,3,2239
#define SM_BUILD_STRING ""
#define SM_BUILD_UNIQUEID "2533" SM_BUILD_STRING
#define SVN_FULL_VERSION "1.0.4" SM_BUILD_STRING
#define SVN_FILE_VERSION 1,0,4,0
#endif //_INCLUDE_SOURCEMOD_VERSION_H_

View File

@ -40,7 +40,9 @@
* @file Contains SourceMod version information.
*/
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$.$GLOBAL_BUILD$"
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,$GLOBAL_BUILD$
#define SM_BUILD_STRING "$BUILD_STRING$"
#define SM_BUILD_UNIQUEID "$BUILD_ID$" SM_BUILD_STRING
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$" SM_BUILD_STRING
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,0
#endif //_INCLUDE_SOURCEMOD_VERSION_H_

View File

@ -37,6 +37,6 @@
#define SOURCEMOD_V_MAJOR 1 /**< SourceMod Major version */
#define SOURCEMOD_V_MINOR 0 /**< SourceMod Minor version */
#define SOURCEMOD_V_RELEASE 3 /**< SourceMod Release version */
#define SOURCEMOD_V_RELEASE 4 /**< SourceMod Release version */
#define SOURCEMOD_VERSION "1.0.3-svn" /**< SourceMod version string (major.minor.release.build) */
#define SOURCEMOD_VERSION "1.0.4" /**< SourceMod version string (major.minor.release.build) */

View File

@ -39,4 +39,4 @@
#define SOURCEMOD_V_MINOR $PMINOR$ /**< SourceMod Minor version */
#define SOURCEMOD_V_RELEASE $PREVISION$ /**< SourceMod Release version */
#define SOURCEMOD_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$-svn" /**< SourceMod version string (major.minor.release.build) */
#define SOURCEMOD_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$$BUILD_STRING$" /**< SourceMod version string (major.minor.release.build) */

View File

@ -19,7 +19,9 @@
* @file Contains SourceMod version information.
*/
#define SVN_FULL_VERSION "1.0.3-svn"
#define SVN_FILE_VERSION 1,0,3,2232
#define SM_BUILD_STRING ""
#define SM_BUILD_UNIQUEID "2533" SM_BUILD_STRING
#define SVN_FULL_VERSION "1.0.4" SM_BUILD_STRING
#define SVN_FILE_VERSION 1,0,4,0
#endif //_INCLUDE_SOURCEMOD_VERSION_H_

View File

@ -19,7 +19,9 @@
* @file Contains SourceMod version information.
*/
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$-svn"
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,$LOCAL_BUILD$
#define SM_BUILD_STRING "$BUILD_STRING$"
#define SM_BUILD_UNIQUEID "$BUILD_ID$" SM_BUILD_STRING
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$" SM_BUILD_STRING
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,0
#endif //_INCLUDE_SOURCEMOD_VERSION_H_

View File

@ -16,7 +16,9 @@
#ifndef _INCLUDE_JIT_VERSION_H_
#define _INCLUDE_JIT_VERSION_H_
#define SVN_FULL_VERSION "1.0.3-svn"
#define SVN_FILE_VERSION 1,0,3,2232
#define SM_BUILD_STRING ""
#define SM_BUILD_UNIQUEID "2533" SM_BUILD_STRING
#define SVN_FULL_VERSION "1.0.4" SM_BUILD_STRING
#define SVN_FILE_VERSION 1,0,4,0
#endif //_INCLUDE_JIT_VERSION_H_

View File

@ -16,7 +16,9 @@
#ifndef _INCLUDE_JIT_VERSION_H_
#define _INCLUDE_JIT_VERSION_H_
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$-svn"
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,$LOCAL_BUILD$
#define SM_BUILD_STRING "$BUILD_STRING$"
#define SM_BUILD_UNIQUEID "$BUILD_ID$" SM_BUILD_STRING
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$" SM_BUILD_STRING
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,0
#endif //_INCLUDE_JIT_VERSION_H_

View File

@ -57,4 +57,4 @@ if ($^O eq "linux")
Build::Command("flip -u tools/versionchanger.pl");
Build::Command("chmod +x tools/versionchanger.pl");
}
Build::Command(Build::PathFormat('tools/versionchanger.pl'));
Build::Command(Build::PathFormat('tools/versionchanger.pl') . ' --buildstring="-dev"');

View File

@ -1,165 +1,169 @@
#!/usr/bin/perl
our %arguments =
(
'config' => 'modules.versions',
'major' => '1',
'minor' => '0',
'revision' => '0',
'build' => undef,
'svnrev' => 'global',
'path' => '',
);
my $arg;
foreach $arg (@ARGV)
{
$arg =~ s/--//;
@arg = split(/=/, $arg);
$arguments{$arg[0]} = $arg[1];
}
#Set up path info
if ($arguments{'path'} ne "")
{
if (!(-d $arguments{'path'}))
{
die "Unable to find path: " . $arguments{'path'} ."\n";
}
chdir($arguments{'path'});
}
if (!open(CONFIG, $arguments{'config'}))
{
die "Unable to open config file for reading: " . $arguments{'config'} . "\n";
}
our %modules;
my $cur_module = undef;
my $line;
while (<CONFIG>)
{
chomp;
$line = $_;
if ($line =~ /^\[([^\]]+)\]$/)
{
$cur_module = $1;
next;
}
if (!$cur_module)
{
next;
}
if ($line =~ /^([^=]+) = (.+)$/)
{
$modules{$cur_module}{$1} = $2;
}
}
close(CONFIG);
#Copy global configuration options...
if (exists($modules{'PRODUCT'}))
{
if (exists($modules{'PRODUCT'}{'major'}))
{
$arguments{'major'} = $modules{'PRODUCT'}{'major'};
}
if (exists($modules{'PRODUCT'}{'minor'}))
{
$arguments{'minor'} = $modules{'PRODUCT'}{'minor'};
}
if (exists($modules{'PRODUCT'}{'revision'}))
{
$arguments{'revision'} = $modules{'PRODUCT'}{'revision'};
}
if (exists($modules{'PRODUCT'}{'svnrev'}))
{
$arguments{'svnrev'} = $modules{'PRODUCT'}{'svnrev'};
}
}
#Get the global SVN revision if we have none
my $rev;
if ($arguments{'build'} == undef)
{
$rev = GetRevision(undef);
} else {
$rev = int($arguments{'build'});
}
my $major = $arguments{'major'};
my $minor = $arguments{'minor'};
my $revision = $arguments{'revision'};
my $svnrev = $arguments{'svnrev'};
#Go through everything now
my $mod_i;
while ( ($cur_module, $mod_i) = each(%modules) )
{
#Skip the magic one
if ($cur_module eq "PRODUCT")
{
next;
}
#Prepare path
my %mod = %{$mod_i};
my $infile = $mod{'in'};
my $outfile = $mod{'out'};
if ($mod{'folder'})
{
if (!(-d $mod{'folder'}))
{
die "Folder " . $mod{'folder'} . " not found.\n";
}
$infile = $mod{'folder'} . '/' . $infile;
$outfile = $mod{'folder'} . '/' . $outfile;
}
if (!(-f $infile))
{
die "File $infile is not a file.\n";
}
my $global_rev = $rev;
my $local_rev = GetRevision($mod{'folder'});
if ($arguments{'svnrev'} eq 'local')
{
$global_rev = $local_rev;
}
#Start rewriting
open(INFILE, $infile) or die "Could not open file for reading: $infile\n";
open(OUTFILE, '>'.$outfile) or die "Could not open file for writing: $outfile\n";
while (<INFILE>)
{
s/\$PMAJOR\$/$major/g;
s/\$PMINOR\$/$minor/g;
s/\$PREVISION\$/$revision/g;
s/\$GLOBAL_BUILD\$/$rev/g;
s/\$LOCAL_BUILD\$/$local_rev/g;
print OUTFILE $_;
}
close(OUTFILE);
close(INFILE);
}
sub GetRevision
{
my ($path)=(@_);
my $rev;
if (!$path)
{
$rev = `svnversion --committed`;
} else {
$rev = `svnversion --committed $path`;
}
if ($rev =~ /exported/)
{
die "Path specified is not a working copy\n";
} elsif ($rev =~ /(\d+):(\d+)/) {
$rev = int($2);
} elsif ($rev =~ /(\d+)/) {
$rev = int($1);
} else {
die "Unknown svnversion response: $rev\n";
}
return $rev;
}
#!/usr/bin/perl
our %arguments =
(
'config' => 'modules.versions',
'major' => '1',
'minor' => '0',
'revision' => '0',
'build' => undef,
'svnrev' => 'global',
'path' => '',
'buildstring' => '',
);
my $arg;
foreach $arg (@ARGV)
{
$arg =~ s/--//;
@arg = split(/=/, $arg);
$arguments{$arg[0]} = $arg[1];
}
#Set up path info
if ($arguments{'path'} ne "")
{
if (!(-d $arguments{'path'}))
{
die "Unable to find path: " . $arguments{'path'} ."\n";
}
chdir($arguments{'path'});
}
if (!open(CONFIG, $arguments{'config'}))
{
die "Unable to open config file for reading: " . $arguments{'config'} . "\n";
}
our %modules;
my $cur_module = undef;
my $line;
while (<CONFIG>)
{
chomp;
$line = $_;
if ($line =~ /^\[([^\]]+)\]$/)
{
$cur_module = $1;
next;
}
if (!$cur_module)
{
next;
}
if ($line =~ /^([^=]+) = (.+)$/)
{
$modules{$cur_module}{$1} = $2;
}
}
close(CONFIG);
#Copy global configuration options...
if (exists($modules{'PRODUCT'}))
{
if (exists($modules{'PRODUCT'}{'major'}))
{
$arguments{'major'} = $modules{'PRODUCT'}{'major'};
}
if (exists($modules{'PRODUCT'}{'minor'}))
{
$arguments{'minor'} = $modules{'PRODUCT'}{'minor'};
}
if (exists($modules{'PRODUCT'}{'revision'}))
{
$arguments{'revision'} = $modules{'PRODUCT'}{'revision'};
}
if (exists($modules{'PRODUCT'}{'svnrev'}))
{
$arguments{'svnrev'} = $modules{'PRODUCT'}{'svnrev'};
}
}
#Get the global SVN revision if we have none
my $rev;
if ($arguments{'build'} == undef)
{
$rev = GetRevision(undef);
} else {
$rev = int($arguments{'build'});
}
my $major = $arguments{'major'};
my $minor = $arguments{'minor'};
my $revision = $arguments{'revision'};
my $svnrev = $arguments{'svnrev'};
my $buildstr = $arguments{'buildstring'};
#Go through everything now
my $mod_i;
while ( ($cur_module, $mod_i) = each(%modules) )
{
#Skip the magic one
if ($cur_module eq "PRODUCT")
{
next;
}
#Prepare path
my %mod = %{$mod_i};
my $infile = $mod{'in'};
my $outfile = $mod{'out'};
if ($mod{'folder'})
{
if (!(-d $mod{'folder'}))
{
die "Folder " . $mod{'folder'} . " not found.\n";
}
$infile = $mod{'folder'} . '/' . $infile;
$outfile = $mod{'folder'} . '/' . $outfile;
}
if (!(-f $infile))
{
die "File $infile is not a file.\n";
}
my $global_rev = $rev;
my $local_rev = GetRevision($mod{'folder'});
if ($arguments{'svnrev'} eq 'local')
{
$global_rev = $local_rev;
}
#Start rewriting
open(INFILE, $infile) or die "Could not open file for reading: $infile\n";
open(OUTFILE, '>'.$outfile) or die "Could not open file for writing: $outfile\n";
while (<INFILE>)
{
s/\$PMAJOR\$/$major/g;
s/\$PMINOR\$/$minor/g;
s/\$PREVISION\$/$revision/g;
s/\$GLOBAL_BUILD\$/$rev/g;
s/\$LOCAL_BUILD\$/$local_rev/g;
s/\$BUILD_ID\$/$rev/g;
s/\$BUILD_STRING\$/$buildstr/g;
print OUTFILE $_;
}
close(OUTFILE);
close(INFILE);
}
sub GetRevision
{
my ($path)=(@_);
my $rev;
if (!$path)
{
$rev = `svnversion --committed`;
} else {
$rev = `svnversion --committed $path`;
}
if ($rev =~ /exported/)
{
die "Path specified is not a working copy\n";
} elsif ($rev =~ /(\d+):(\d+)/) {
$rev = int($2);
} elsif ($rev =~ /(\d+)/) {
$rev = int($1);
} else {
die "Unknown svnversion response: $rev\n";
}
return $rev;
}