Started script to describe version.

This commit is contained in:
Cas Cremers 2012-05-02 17:15:50 +02:00
parent 163a915a6d
commit b26482feca
5 changed files with 63 additions and 20 deletions

View File

@ -7,6 +7,9 @@ echo " module load cmake"
echo " module load gcc"
echo
# Store version number in version.h
./describe-version.py
# Default flags
CMFLAGS="-D CMAKE_BUILD_TYPE:STRING=Release"

View File

@ -1,5 +1,8 @@
#!/bin/sh
# Store version number in version.h
./describe-version.py
# Default flags
CMFLAGS="-D CMAKE_BUILD_TYPE:STRING=Debug"

View File

@ -1,5 +1,9 @@
#!/bin/sh
# Store version number in version.h
./describe-version.py
# Different choice if on Darwin
PLATFORM=`uname`
echo $PLATFORM
if [ "$PLATFORM" = "Darwin" ]
@ -8,6 +12,7 @@ then
else
if [ "$PLATFORM" = "Linux" ]
then
# Build both versions
./subbuild-unix-both.sh
else
echo "I don't know platform $PLATFORM, so I won't do anything"

52
src/describe-version.py Executable file
View File

@ -0,0 +1,52 @@
#!/usr/bin/env python
"""
Scyther : An automatic verifier for security protocols.
Copyright (C) 2007-2012 Cas Cremers
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
"""
def writeTag(tag=None):
"""
Write tag file
"""
if tag == None:
tag = "unknown"
fp = open('version.h','w')
s = "#define TAGVERSION \"%s\"\n" % tag
fp.write(s)
fp.close()
def getDescription():
"""
If possible, use Git to extract a description of the current commit
"""
try:
import sys
import subprocess
res = subprocess.check_output(["git","describe","--tags","--dirty"]+sys.argv[1:])
except:
res = None
return res.strip()
if __name__ == '__main__':
tag = getDescription()
writeTag(tag)
print tag

View File

@ -1,20 +0,0 @@
/*
* Scyther : An automatic verifier for security protocols.
* Copyright (C) 2007-2012 Cas Cremers
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#define TAGVERSION "unknown"