Skip to content
Snippets Groups Projects
Commit 90f0d646 authored by Giovanni Bussi's avatar Giovanni Bussi
Browse files

Added proper version info

plumed info --version
returns the branch name (or something such as v2.0 in releases)

plumed info --long-version
returns a longer description (or something such as v2.0.2 in releases)

Also updated the src/release script accordingly
parent 093d0328
No related branches found
No related tags found
No related merge requests found
......@@ -70,6 +70,7 @@ void Info::registerKeywords( Keywords& keys ){
keys.addFlag("--user-doc",false,"print the location of user manual (html)");
keys.addFlag("--developer-doc",false,"print the location of user manual (html)");
keys.addFlag("--version",false,"print the version number");
keys.addFlag("--long-version",false,"print the version number (long version)");
}
Info::Info(const CLToolOptions& co ):
......@@ -85,14 +86,15 @@ int Info::main(FILE* in, FILE*out,Communicator& pc){
bool printuserdoc; parseFlag("--user-doc",printuserdoc);
bool printdeveloperdoc; parseFlag("--developer-doc",printdeveloperdoc);
bool printversion; parseFlag("--version",printversion);
bool printlongversion; parseFlag("--long-version",printlongversion);
if(printroot) fprintf(out,"%s\n",config::getPlumedRoot().c_str());
if(printconfiguration) fprintf(out,"%s",config::getMakefile().c_str());
std::string userdoc=config::getPlumedRoot()+"user-doc/html/index.html";
std::string developerdoc=config::getPlumedRoot()+"developer-doc/html/index.html";
if(printuserdoc) fprintf(out,"%s\n",userdoc.c_str());
if(printdeveloperdoc) fprintf(out,"%s\n",developerdoc.c_str());
std::string versionname="v2.0b1";
if(printversion) fprintf(out,"%s\n",versionname.c_str());
if(printversion) fprintf(out,"%s\n",config::getVersion().c_str());
if(printlongversion) fprintf(out,"%s\n",config::getVersionLong().c_str());
return 0;
}
......
......@@ -2,3 +2,4 @@
/Config.cpp
/ConfigInstall.cpp
/install*
/version.h
......@@ -21,6 +21,7 @@
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
#include "Config.h"
#include "version.h"
#include <cstring>
namespace PLMD{
......@@ -34,6 +35,14 @@ std::string getPlumedRoot(){
return "@PLUMED_ROOT@";
}
std::string getVersion(){
return PLUMED_VERSION_SHORT;
}
std::string getVersionLong(){
return PLUMED_VERSION_LONG;
}
std::string getMakefile(){
static const char conf [] ={
#include "Makefile.conf.xxd"
......
......@@ -33,6 +33,10 @@ std::string getPlumedRoot();
std::string getMakefile();
std::string getVersion();
std::string getVersionLong();
bool hasMatheval();
bool hasDlopen();
......
......@@ -8,6 +8,8 @@ all:
@echo "Updating ConfigInstall.cpp"
@sed "s/@SOEXT@/$(SOEXT)/g" Config.cpp.in | \
../maketools/update-plumedroot.sh ConfigInstall.cpp
@echo "Updating version file"
@ ../maketools/update-version.sh version.h
$(MAKE) do-all
obj: all
......@@ -19,6 +21,8 @@ ConfigInstall.cpp:
@echo "Updating ConfigInstall.cpp"
@sed "s/@SOEXT@/$(SOEXT)/g" Config.cpp.in | \
../maketools/update-plumedroot.sh ConfigInstall.cpp
@echo "Updating version file"
@ ../maketools/update-version.sh version.h
# file to import compilation options inside c++
Config.cpp: Config.cpp.in Config.h
......@@ -28,10 +32,10 @@ Config.cpp: Config.cpp.in Config.h
links:
@echo Nothing to do in $(CURDIR)
Config.o: Config.cpp Makefile.conf.xxd
ConfigInstall.o: ConfigInstall.cpp Makefile.conf.xxd
Config.o: Config.cpp Makefile.conf.xxd version.h
ConfigInstall.o: ConfigInstall.cpp Makefile.conf.xxd version.h
Makefile.conf.xxd: ../../Makefile.conf
cat ../../Makefile.conf | xxd -i > Makefile.conf.xxd
......@@ -45,7 +49,7 @@ compile_options.sh:
.PHONY: clean
clean:
rm -f Config.cpp compile_options.sh Makefile_conf
rm -f Config.cpp compile_options.sh Makefile_conf version.h
rm -fr deps
rm -f Config.cpp ConfigInstall.cpp compile_options.sh install.conf
rm -f $(CLEANLIST)
......
#! /bin/bash
{
echo "#define PLUMED_VERSION_SHORT \"$(
if test -d ../../.git && hash git 2> /dev/null ; then
git rev-parse --abbrev-ref HEAD
elif test -f ../../VERSION ; then
grep SHORT: ../../VERSION | sed 's/SHORT: //'
else
echo "Unknown"
fi
)\""
echo "#define PLUMED_VERSION_LONG \"$(
if test -d ../../.git && hash git 2> /dev/null ; then
git describe --tags
elif test -f ../../VERSION ; then
grep LONG: ../../VERSION | sed 's/LONG: //'
else
echo "Unknown"
fi
)\""
} > $1~
cmp -s $1~ $1 || cp $1~ $1
rm $1~
......@@ -30,6 +30,19 @@ ls src README 1>/dev/null 2>/dev/null || {
exit 1
}
shortversion=$(echo "$version" | sed 's/^\([0-9][0-9]*\).*/\1/' )
echo "Version: 2.$version"
echo "Short version: 2.$shortversion"
VERSION="
LONG: v2.$version
SHORT: v2.$shortversion
"
git archive -o plumed-2.$version.tgz --prefix plumed-2.$version/ v2.$version
tar xzf plumed-2.$version.tgz
echo "$VERSION" > plumed-2.$version/VERSION
tar czf plumed-2.$version.tgz plumed-2.$version
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment