mirror of
https://github.com/alliedmodders/metamod-source.git
synced 2024-12-01 13:24:25 +01:00
Redid versioning for Mercurial.
--HG-- rename : core-legacy/svn_version.h => core-legacy/version.h rename : core-legacy/svn_version.tpl => core-legacy/version.tpl
This commit is contained in:
parent
3fceddfdd3
commit
fe68f19d79
@ -105,7 +105,7 @@ void SMConVarAccessor::Unregister(ConCommandBase *pCommand)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ConVar metamod_version("metamod_version", SOURCEMM_VERSION, FCVAR_SPONLY | FCVAR_NOTIFY, "Metamod:Source Version");
|
ConVar metamod_version("metamod_version", SVN_FULL_VERSION, FCVAR_SPONLY | FCVAR_NOTIFY, "Metamod:Source Version");
|
||||||
#ifdef OS_WIN32
|
#ifdef OS_WIN32
|
||||||
ConVar mm_pluginsfile("mm_pluginsfile", "addons\\metamod\\metaplugins.ini", FCVAR_SPONLY, "Metamod:Source Plugins File");
|
ConVar mm_pluginsfile("mm_pluginsfile", "addons\\metamod\\metaplugins.ini", FCVAR_SPONLY, "Metamod:Source Plugins File");
|
||||||
ConVar mm_basedir("mm_basedir", "addons\\metamod", FCVAR_SPONLY, "Metamod:Source base folder");
|
ConVar mm_basedir("mm_basedir", "addons\\metamod", FCVAR_SPONLY, "Metamod:Source base folder");
|
||||||
@ -140,7 +140,8 @@ CON_COMMAND(meta, "Metamod:Source Menu")
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
} else if (strcmp(command, "version") == 0) {
|
} else if (strcmp(command, "version") == 0) {
|
||||||
CONMSG("Metamod:Source version %s\n", SOURCEMM_VERSION);
|
CONMSG("Metamod:Source version %s\n", SVN_FULL_VERSION);
|
||||||
|
CONMSG("Build ID: %s\n", MMS_BUILD_UNIQUEID);
|
||||||
if (g_bIsBridgedAsVsp)
|
if (g_bIsBridgedAsVsp)
|
||||||
{
|
{
|
||||||
CONMSG("Loaded As: Valve Server Plugin\n");
|
CONMSG("Loaded As: Valve Server Plugin\n");
|
||||||
@ -658,7 +659,7 @@ void ClientCommand_handler(edict_t *client)
|
|||||||
|
|
||||||
RETURN_META(MRES_SUPERCEDE);
|
RETURN_META(MRES_SUPERCEDE);
|
||||||
} else if(strcmp(subcmd, "version") == 0) {
|
} else if(strcmp(subcmd, "version") == 0) {
|
||||||
CLIENT_CONMSG(client, "Metamod:Source version %s\n", SOURCEMM_VERSION);
|
CLIENT_CONMSG(client, "Metamod:Source version %s\n", SVN_FULL_VERSION);
|
||||||
CLIENT_CONMSG(client, "Compiled on: %s\n", SOURCEMM_DATE);
|
CLIENT_CONMSG(client, "Compiled on: %s\n", SOURCEMM_DATE);
|
||||||
CLIENT_CONMSG(client, "Plugin interface version: %d:%d\n", PLAPI_VERSION, PLAPI_MIN_VERSION);
|
CLIENT_CONMSG(client, "Plugin interface version: %d:%d\n", PLAPI_VERSION, PLAPI_MIN_VERSION);
|
||||||
CLIENT_CONMSG(client, "SourceHook version: %d:%d\n", g_SourceHook.GetIfaceVersion(), g_SourceHook.GetImplVersion());
|
CLIENT_CONMSG(client, "SourceHook version: %d:%d\n", g_SourceHook.GetIfaceVersion(), g_SourceHook.GetImplVersion());
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#include "CPlugin.h"
|
#include "CPlugin.h"
|
||||||
#include "oslink.h"
|
#include "oslink.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "svn_version.h"
|
#include "version.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Versioning
|
* Versioning
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
/** This file is autogenerated by build scripts */
|
|
||||||
|
|
||||||
#ifndef _INCLUDE_SVN_VERSION_H_
|
|
||||||
#define _INCLUDE_SVN_VERSION_H_
|
|
||||||
|
|
||||||
#define SVN_PRODUCT_VERSION "1.7.0"
|
|
||||||
|
|
||||||
#define SVN_REVISION 705
|
|
||||||
#define SVN_REVISION_STRING "705"
|
|
||||||
#define SVN_FILE_VERSION 1,7,0,705
|
|
||||||
#define SVN_FILE_VERSION_STRING "1.7.0.705"
|
|
||||||
|
|
||||||
#endif //_INCLUDE_SVN_VERSION_H_
|
|
@ -1,13 +0,0 @@
|
|||||||
/** This file is autogenerated by build scripts */
|
|
||||||
|
|
||||||
#ifndef _INCLUDE_SVN_VERSION_H_
|
|
||||||
#define _INCLUDE_SVN_VERSION_H_
|
|
||||||
|
|
||||||
#define SVN_PRODUCT_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$"
|
|
||||||
|
|
||||||
#define SVN_REVISION $GLOBAL_BUILD$
|
|
||||||
#define SVN_REVISION_STRING "$GLOBAL_BUILD$"
|
|
||||||
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,$GLOBAL_BUILD$
|
|
||||||
#define SVN_FILE_VERSION_STRING "$PMAJOR$.$PMINOR$.$PREVISION$.$GLOBAL_BUILD$"
|
|
||||||
|
|
||||||
#endif //_INCLUDE_SVN_VERSION_H_
|
|
12
core-legacy/version.h
Normal file
12
core-legacy/version.h
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
/** This file is autogenerated by build scripts */
|
||||||
|
|
||||||
|
#ifndef _INCLUDE_SVN_VERSION_H_
|
||||||
|
#define _INCLUDE_SVN_VERSION_H_
|
||||||
|
|
||||||
|
#define MMS_BUILD_STRING "-dev"
|
||||||
|
#define MMS_BUILD_UNIQUEID "556:b37a142ba881" MMS_BUILD_STRING
|
||||||
|
#define SVN_FULL_VERSION "1.7.0" MMS_BUILD_STRING
|
||||||
|
#define SVN_FILE_VERSION 1,7,0,0
|
||||||
|
|
||||||
|
#endif //_INCLUDE_SVN_VERSION_H_
|
||||||
|
|
12
core-legacy/version.tpl
Normal file
12
core-legacy/version.tpl
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
/** This file is autogenerated by build scripts */
|
||||||
|
|
||||||
|
#ifndef _INCLUDE_SVN_VERSION_H_
|
||||||
|
#define _INCLUDE_SVN_VERSION_H_
|
||||||
|
|
||||||
|
#define MMS_BUILD_STRING "$BUILD_STRING$"
|
||||||
|
#define MMS_BUILD_UNIQUEID "$BUILD_ID$" MMS_BUILD_STRING
|
||||||
|
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$" MMS_BUILD_STRING
|
||||||
|
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,0
|
||||||
|
|
||||||
|
#endif //_INCLUDE_SVN_VERSION_H_
|
||||||
|
|
@ -67,7 +67,7 @@ class VspBridge : public IVspBridge
|
|||||||
|
|
||||||
virtual const char *GetDescription()
|
virtual const char *GetDescription()
|
||||||
{
|
{
|
||||||
return "Metamod:Source " SOURCEMM_VERSION;
|
return "Metamod:Source " SVN_FULL_VERSION;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ void VSPListener::GameFrame(bool simulating)
|
|||||||
|
|
||||||
const char *VSPListener::GetPluginDescription()
|
const char *VSPListener::GetPluginDescription()
|
||||||
{
|
{
|
||||||
return "Metamod:Source Interface v" SOURCEMM_VERSION;
|
return "Metamod:Source Interface " SVN_FULL_VERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VSPListener::IsLoaded()
|
bool VSPListener::IsLoaded()
|
||||||
|
@ -763,11 +763,11 @@ mm_StartupMetamod(bool is_vsp_load)
|
|||||||
UTIL_Format(buffer,
|
UTIL_Format(buffer,
|
||||||
sizeof(buffer),
|
sizeof(buffer),
|
||||||
"%s%s",
|
"%s%s",
|
||||||
SOURCEMM_VERSION,
|
SVN_FULL_VERSION,
|
||||||
is_vsp_load ? "V" : "");
|
is_vsp_load ? "V" : "");
|
||||||
|
|
||||||
metamod_version = provider->CreateConVar("metamod_version",
|
metamod_version = provider->CreateConVar("metamod_version",
|
||||||
SOURCEMM_VERSION,
|
SVN_FULL_VERSION,
|
||||||
"Metamod:Source Version",
|
"Metamod:Source Version",
|
||||||
ConVarFlag_Notify|ConVarFlag_SpOnly);
|
ConVarFlag_Notify|ConVarFlag_SpOnly);
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
#include <sourcehook/sourcehook.h>
|
#include <sourcehook/sourcehook.h>
|
||||||
#include <ISmmPlugin.h>
|
#include <ISmmPlugin.h>
|
||||||
#include "metamod_provider.h"
|
#include "metamod_provider.h"
|
||||||
#include "svn_version.h"
|
#include "version.h"
|
||||||
|
|
||||||
using namespace SourceMM;
|
using namespace SourceMM;
|
||||||
|
|
||||||
|
@ -70,7 +70,8 @@ bool Command_Meta(IMetamodSourceCommandInfo *info)
|
|||||||
}
|
}
|
||||||
else if (strcmp(command, "version") == 0)
|
else if (strcmp(command, "version") == 0)
|
||||||
{
|
{
|
||||||
CONMSG("Metamod:Source version %s\n", SOURCEMM_VERSION);
|
CONMSG("Metamod:Source version %s\n", SVN_FULL_VERSION);
|
||||||
|
CONMSG("Build ID: %s\n", MMS_BUILD_UNIQUEID);
|
||||||
|
|
||||||
if (g_Metamod.IsLoadedAsGameDLL())
|
if (g_Metamod.IsLoadedAsGameDLL())
|
||||||
{
|
{
|
||||||
@ -687,7 +688,7 @@ bool Command_ClientMeta(edict_t *client, IMetamodSourceCommandInfo *info)
|
|||||||
}
|
}
|
||||||
else if(strcmp(subcmd, "version") == 0)
|
else if(strcmp(subcmd, "version") == 0)
|
||||||
{
|
{
|
||||||
CLIENT_CONMSG(client, "Metamod:Source version %s\n", SOURCEMM_VERSION);
|
CLIENT_CONMSG(client, "Metamod:Source version %s\n", SVN_FULL_VERSION);
|
||||||
CLIENT_CONMSG(client, "Compiled on: %s\n", SOURCEMM_DATE);
|
CLIENT_CONMSG(client, "Compiled on: %s\n", SOURCEMM_DATE);
|
||||||
CLIENT_CONMSG(client, "Plugin interface version: %d:%d\n", METAMOD_PLAPI_VERSION, PLAPI_MIN_VERSION);
|
CLIENT_CONMSG(client, "Plugin interface version: %d:%d\n", METAMOD_PLAPI_VERSION, PLAPI_MIN_VERSION);
|
||||||
CLIENT_CONMSG(client, "SourceHook version: %d:%d\n", g_SHPtr->GetIfaceVersion(), g_SHPtr->GetImplVersion());
|
CLIENT_CONMSG(client, "SourceHook version: %d:%d\n", g_SHPtr->GetIfaceVersion(), g_SHPtr->GetImplVersion());
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
#include <eiface.h>
|
#include <eiface.h>
|
||||||
#include "iplayerinfo.h"
|
#include "iplayerinfo.h"
|
||||||
#include "vsp_listener.h"
|
#include "vsp_listener.h"
|
||||||
#include "svn_version.h"
|
#include "version.h"
|
||||||
#include "provider_ep2.h"
|
#include "provider_ep2.h"
|
||||||
|
|
||||||
using namespace SourceMM;
|
using namespace SourceMM;
|
||||||
@ -80,7 +80,7 @@ void VSPListener::GameFrame(bool simulating)
|
|||||||
|
|
||||||
const char *VSPListener::GetPluginDescription()
|
const char *VSPListener::GetPluginDescription()
|
||||||
{
|
{
|
||||||
return "Metamod:Source Interface v" SVN_FILE_VERSION_STRING;
|
return "Metamod:Source Interface " SVN_FULL_VERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VSPListener::IsLoaded()
|
bool VSPListener::IsLoaded()
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
/** This file is autogenerated by build scripts */
|
|
||||||
|
|
||||||
#ifndef _INCLUDE_SVN_VERSION_H_
|
|
||||||
#define _INCLUDE_SVN_VERSION_H_
|
|
||||||
|
|
||||||
#define SVN_PRODUCT_VERSION "1.7.0"
|
|
||||||
|
|
||||||
#define SVN_REVISION 703
|
|
||||||
#define SVN_REVISION_STRING "703"
|
|
||||||
#define SVN_FILE_VERSION 1,7,0,703
|
|
||||||
#define SVN_FILE_VERSION_STRING "1.7.0.703"
|
|
||||||
|
|
||||||
#endif //_INCLUDE_SVN_VERSION_H_
|
|
@ -1,13 +0,0 @@
|
|||||||
/** This file is autogenerated by build scripts */
|
|
||||||
|
|
||||||
#ifndef _INCLUDE_SVN_VERSION_H_
|
|
||||||
#define _INCLUDE_SVN_VERSION_H_
|
|
||||||
|
|
||||||
#define SVN_PRODUCT_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$"
|
|
||||||
|
|
||||||
#define SVN_REVISION $GLOBAL_BUILD$
|
|
||||||
#define SVN_REVISION_STRING "$GLOBAL_BUILD$"
|
|
||||||
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,$GLOBAL_BUILD$
|
|
||||||
#define SVN_FILE_VERSION_STRING "$PMAJOR$.$PMINOR$.$PREVISION$.$GLOBAL_BUILD$"
|
|
||||||
|
|
||||||
#endif //_INCLUDE_SVN_VERSION_H_
|
|
12
core/version.h
Normal file
12
core/version.h
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
/** This file is autogenerated by build scripts */
|
||||||
|
|
||||||
|
#ifndef _INCLUDE_SVN_VERSION_H_
|
||||||
|
#define _INCLUDE_SVN_VERSION_H_
|
||||||
|
|
||||||
|
#define MMS_BUILD_STRING "-dev"
|
||||||
|
#define MMS_BUILD_UNIQUEID "556:b37a142ba881" MMS_BUILD_STRING
|
||||||
|
#define SVN_FULL_VERSION "1.7.0" MMS_BUILD_STRING
|
||||||
|
#define SVN_FILE_VERSION 1,7,0,0
|
||||||
|
|
||||||
|
#endif //_INCLUDE_SVN_VERSION_H_
|
||||||
|
|
12
core/version.tpl
Normal file
12
core/version.tpl
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
/** This file is autogenerated by build scripts */
|
||||||
|
|
||||||
|
#ifndef _INCLUDE_SVN_VERSION_H_
|
||||||
|
#define _INCLUDE_SVN_VERSION_H_
|
||||||
|
|
||||||
|
#define MMS_BUILD_STRING "$BUILD_STRING$"
|
||||||
|
#define MMS_BUILD_UNIQUEID "$BUILD_ID$" MMS_BUILD_STRING
|
||||||
|
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$" MMS_BUILD_STRING
|
||||||
|
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,0
|
||||||
|
|
||||||
|
#endif //_INCLUDE_SVN_VERSION_H_
|
||||||
|
|
@ -96,7 +96,7 @@ public:
|
|||||||
|
|
||||||
virtual const char *GetDescription()
|
virtual const char *GetDescription()
|
||||||
{
|
{
|
||||||
return "Metamod:Source " SOURCEMM_VERSION;
|
return "Metamod:Source " SVN_FULL_VERSION;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,9 +1,15 @@
|
|||||||
[PRODUCT]
|
[PRODUCT]
|
||||||
major = 1
|
major = 1
|
||||||
minor = 7
|
minor = 7
|
||||||
revision = 0
|
revision = 0
|
||||||
|
|
||||||
[sourcemm]
|
[core]
|
||||||
folder = sourcemm
|
folder = core
|
||||||
in = svn_version.tpl
|
in = version.tpl
|
||||||
out = svn_version.h
|
out = version.h
|
||||||
|
|
||||||
|
[core-legacy]
|
||||||
|
folder = core-legacy
|
||||||
|
in = version.tpl
|
||||||
|
out = version.h
|
||||||
|
|
||||||
|
24
support/buildbot/bootstrap.pl
Executable file
24
support/buildbot/bootstrap.pl
Executable file
@ -0,0 +1,24 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use Cwd;
|
||||||
|
use File::Basename;
|
||||||
|
|
||||||
|
my ($myself, $path) = fileparse($0);
|
||||||
|
chdir($path);
|
||||||
|
|
||||||
|
require 'helpers.pm';
|
||||||
|
|
||||||
|
#Go to main source dir
|
||||||
|
chdir(Build::PathFormat('../..'));
|
||||||
|
|
||||||
|
#Do the annoying revision bumping.
|
||||||
|
#Linux needs some help here.
|
||||||
|
if ($^O eq "linux")
|
||||||
|
{
|
||||||
|
Build::Command("flip -u modules.versions");
|
||||||
|
Build::Command("flip -u support/versionchanger.pl");
|
||||||
|
Build::Command("chmod +x support/versionchanger.pl");
|
||||||
|
}
|
||||||
|
Build::Command(Build::PathFormat('support/versionchanger.pl') . '--buildstring="-dev"');
|
||||||
|
|
145
support/buildbot/helpers.pm
Normal file
145
support/buildbot/helpers.pm
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use Cwd;
|
||||||
|
|
||||||
|
package Build;
|
||||||
|
|
||||||
|
our $SVN = "/usr/bin/svn";
|
||||||
|
our $SVN_USER = 'dvander';
|
||||||
|
our $SVN_ARGS = '';
|
||||||
|
|
||||||
|
sub HgRevNum
|
||||||
|
{
|
||||||
|
my ($path) = (@_);
|
||||||
|
my ($cd, $text, $rev);
|
||||||
|
|
||||||
|
$cd = Cwd::cwd();
|
||||||
|
chdir($path);
|
||||||
|
$text = `hg identify -n`;
|
||||||
|
chdir($cd);
|
||||||
|
|
||||||
|
chomp $text;
|
||||||
|
if ($text =~ /^(\d+)/)
|
||||||
|
{
|
||||||
|
return $1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub SvnRevNum
|
||||||
|
{
|
||||||
|
my ($str)=(@_);
|
||||||
|
|
||||||
|
my $data = Command('svnversion -c ' . $str);
|
||||||
|
if ($data =~ /(\d+):(\d+)/)
|
||||||
|
{
|
||||||
|
return $2;
|
||||||
|
} elsif ($data =~ /(\d+)/) {
|
||||||
|
return $1;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub ProductVersion
|
||||||
|
{
|
||||||
|
my ($file) = (@_);
|
||||||
|
my ($version);
|
||||||
|
open(FILE, $file) or die "Could not open $file: $!\n";
|
||||||
|
$version = <FILE>;
|
||||||
|
close(FILE);
|
||||||
|
chomp $version;
|
||||||
|
return $version;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub Delete
|
||||||
|
{
|
||||||
|
my ($str)=(@_);
|
||||||
|
if ($^O =~ /MSWin/)
|
||||||
|
{
|
||||||
|
Command("del /S /F /Q \"$str\"");
|
||||||
|
Command("rmdir /S /Q \"$str\"");
|
||||||
|
} else {
|
||||||
|
Command("rm -rf $str");
|
||||||
|
}
|
||||||
|
return !(-e $str);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub Copy
|
||||||
|
{
|
||||||
|
my ($src,$dest)=(@_);
|
||||||
|
if ($^O =~ /MSWin/)
|
||||||
|
{
|
||||||
|
Command("copy \"$src\" \"$dest\" /y");
|
||||||
|
} else {
|
||||||
|
Command("cp \"$src\" \"$dest\"");
|
||||||
|
}
|
||||||
|
return (-e $dest);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub Move
|
||||||
|
{
|
||||||
|
my ($src,$dest)=(@_);
|
||||||
|
if ($^O =~ /MSWin/)
|
||||||
|
{
|
||||||
|
Command("move \"$src\" \"$dest\"");
|
||||||
|
} else {
|
||||||
|
Command("mv \"$src\" \"$dest\"");
|
||||||
|
}
|
||||||
|
return (-e $dest);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub Command
|
||||||
|
{
|
||||||
|
my($cmd)=(@_);
|
||||||
|
print "$cmd\n";
|
||||||
|
return `$cmd`;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub PathFormat
|
||||||
|
{
|
||||||
|
my ($str)=(@_);
|
||||||
|
if ($^O =~ /MSWin/)
|
||||||
|
{
|
||||||
|
$str =~ s#/#\\#g;
|
||||||
|
} else {
|
||||||
|
$str =~ s#\\#/#g;
|
||||||
|
}
|
||||||
|
return $str;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub SVN_Remove
|
||||||
|
{
|
||||||
|
my ($file)=(@_);
|
||||||
|
my ($path, $name);
|
||||||
|
if ($^O =~ /MSWin/)
|
||||||
|
{
|
||||||
|
($path, $name) = ($file =~ /(.+)\/([^\/]+)$/);
|
||||||
|
} else {
|
||||||
|
($path, $name) = ($file =~ /(.+)\\([^\\]+)$/);
|
||||||
|
}
|
||||||
|
my $dir = Cwd::cwd();
|
||||||
|
chdir($path);
|
||||||
|
Command($SVN . ' ' . $SVN_ARGS . ' delete ' . $name);
|
||||||
|
chdir($dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub SVN_Add
|
||||||
|
{
|
||||||
|
my ($file)=(@_);
|
||||||
|
my ($path, $name);
|
||||||
|
if ($^O =~ /MSWin/)
|
||||||
|
{
|
||||||
|
($path, $name) = ($file =~ /(.+)\/([^\/]+)$/);
|
||||||
|
} else {
|
||||||
|
($path, $name) = ($file =~ /(.+)\\([^\\]+)$/);
|
||||||
|
}
|
||||||
|
my $dir = Cwd::cwd();
|
||||||
|
chdir($path);
|
||||||
|
Command($SVN . ' ' . $SVN_ARGS . ' add ' . $name);
|
||||||
|
chdir($dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
140
support/versionchanger.pl
Executable file
140
support/versionchanger.pl
Executable file
@ -0,0 +1,140 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
|
||||||
|
our %arguments =
|
||||||
|
(
|
||||||
|
'config' => 'modules.versions',
|
||||||
|
'major' => '1',
|
||||||
|
'minor' => '0',
|
||||||
|
'revision' => '0',
|
||||||
|
'build' => undef,
|
||||||
|
'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'};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#Get the global SVN revision if we have none
|
||||||
|
my $rev;
|
||||||
|
if ($arguments{'build'} == undef)
|
||||||
|
{
|
||||||
|
my ($text);
|
||||||
|
$text = `hg identif -n -i`;
|
||||||
|
chomp $text;
|
||||||
|
$text =~ s/\+//g;
|
||||||
|
my ($id,$num) = split(/ /, $text);
|
||||||
|
$rev = "$num:$id";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$rev = int($arguments{'build'});
|
||||||
|
}
|
||||||
|
|
||||||
|
my $major = $arguments{'major'};
|
||||||
|
my $minor = $arguments{'minor'};
|
||||||
|
my $revision = $arguments{'revision'};
|
||||||
|
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";
|
||||||
|
}
|
||||||
|
#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/\$BUILD_ID\$/$rev/g;
|
||||||
|
s/\$BUILD_STRING\$/$buildstr/g;
|
||||||
|
print OUTFILE $_;
|
||||||
|
}
|
||||||
|
close(OUTFILE);
|
||||||
|
close(INFILE);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user