changed generation of git-revision.h which allows to keep it up-to-date. Aditionally git-branch info has been added.

This commit is contained in:
suter_a 2017-02-22 09:42:07 +01:00
parent cc1679144c
commit fca13283e1
16 changed files with 73 additions and 28 deletions

View File

@ -2,7 +2,7 @@
BUILT_SOURCES = git-revision.h
git-revision.h : Makefile
echo \#define GIT_REVISION \"`git log -n 1 --pretty=format:"%ad - %h"`\" > include/git-revision.h
sh git_revision.sh ./include git-revision.h
if PNEXUS_ENABLED
PNEXUSDIRS = external/nexus

View File

@ -198,9 +198,9 @@ int main(int argc, char *argv[])
any2many_syntax();
else if (strstr(argv[1], "--v")) {
#ifdef HAVE_CONFIG_H
cout << endl << "any2many version: " << PACKAGE_VERSION << ", git-rev: " << GIT_REVISION << endl << endl;
cout << endl << "any2many version: " << PACKAGE_VERSION << ", git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << endl << endl;
#else
cout << endl << "any2many git-rev: " << GIT_REVISION << endl << endl;
cout << endl << "any2many git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << endl << endl;
#endif
} else {
any2many_syntax();

View File

@ -762,9 +762,9 @@ int main(int argc, char *argv[])
return 0;
} else if (!strcmp(argv[i], "--version") || !strcmp(argv[i], "-v")) {
#ifdef HAVE_CONFIG_H
cout << endl << "dump_header: version " << PACKAGE_VERSION << ", git-rev: " << GIT_REVISION << endl << endl;
cout << endl << "dump_header version: " << PACKAGE_VERSION << ", git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << endl << endl;
#else
cout << endl << "dump_header: git-rev: " << GIT_REVISION << endl << endl;
cout << endl << "dump_header git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << endl << endl;
#endif
return 0;
} else if (!strcmp(argv[i], "-rn") || !strcmp(argv[i], "--runNo")) {

28
src/git_revision.sh Executable file
View File

@ -0,0 +1,28 @@
#!/bin/bash
echo "Generating header for git hash" $1 $2
GIT_HEADER="$1/$2"
if [ -z "$2" ]; then
GIT_HEADER="$1/git-revision.h"
fi
GIT_BRANCH=`git rev-parse --abbrev-ref HEAD`
GIT_VERSION=`git log -n 1 --pretty=format:"%ad - %h"`
if grep --quiet "$GIT_VERSION" $GIT_HEADER; then
echo "No need to generate new $GIT_HEADER - git hash is unchanged"
exit 0;
fi
echo "git branch is : " $GIT_BRANCH
echo "git version is : " $GIT_VERSION
echo "#ifndef GIT_VERSION_H" > $GIT_HEADER
echo "#define GIT_VERSION_H" >> $GIT_HEADER
echo "" >> $GIT_HEADER
echo "#define GIT_BRANCH \"$GIT_BRANCH\"" >> $GIT_HEADER
echo "#define GIT_CURRENT_SHA1 \"$GIT_VERSION\"" >> $GIT_HEADER
echo "" >> $GIT_HEADER
echo "#endif //GIT_VERSION_H" >> $GIT_HEADER
echo "file is generated into" $GIT_HEADER

View File

@ -516,9 +516,9 @@ int main(int argc, char *argv[])
return 0;
} else if (!strcmp(argv[1], "--version")) {
#ifdef HAVE_CONFIG_H
cout << endl << "msr2data version: " << PACKAGE_VERSION << ", git-rev: " << GIT_REVISION << endl << endl;
cout << endl << "msr2data version: " << PACKAGE_VERSION << ", git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << endl << endl;
#else
cout << endl << "msr2data git-rev: " << GIT_REVISION << endl << endl;
cout << endl << "msr2data git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << endl << endl;
#endif
return 0;
} else {

View File

@ -298,9 +298,9 @@ Int_t musrFT_parse_options(Int_t argc, Char_t *argv[], musrFT_startup_param &sta
tstr = argv[i];
if (tstr.BeginsWith("--version")) {
#ifdef HAVE_CONFIG_H
cout << endl << "musrFT version: " << PACKAGE_VERSION << ", git-rev: " << GIT_REVISION << endl << endl;
cout << endl << "musrFT version: " << PACKAGE_VERSION << ", git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << endl << endl;
#else
cout << endl << "musrFT git-rev: " << GIT_REVISION << endl << endl;
cout << endl << "musrFT git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << endl << endl;
#endif
return 1;
} else if (tstr.BeginsWith("--help")) {

View File

@ -575,9 +575,9 @@ int main(int argc, char *argv[])
} else if (argc==2) {
if (!strcmp(argv[1], "--version")) {
#ifdef HAVE_CONFIG_H
cout << endl << "musrRootValidation version: " << PACKAGE_VERSION << ", git-rev: " << GIT_REVISION << endl << endl;
cout << endl << "musrRootValidation version: " << PACKAGE_VERSION << ", git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << endl << endl;
#else
cout << endl << "musrRootValidation git-rev: " << GIT_REVISION << endl << endl;
cout << endl << "musrRootValidation git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << endl << endl;
#endif
return 0;
} else {

View File

@ -53,7 +53,7 @@ int main( int argc, char ** argv )
cout << endl << endl;
return 0;
} else if (!strcmp(argv[1], "--version") || !strcmp(argv[1], "-v")) {
cout << endl << "musredit git-rev: " << GIT_REVISION;
cout << endl << "musredit git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1;
cout << endl << endl;
return 0;
}

View File

@ -38,7 +38,8 @@ PMusrEditAbout::PMusrEditAbout(QWidget *parent, Qt::WindowFlags f) : QDialog(par
{
setupUi(this);
fGitRev_label->setText(QString("git: %1").arg(GIT_REVISION));
fGitBranch_label->setText(QString("git-branch: %1").arg(GIT_BRANCH));
fGitRev_label->setText(QString("git-rev: %1").arg(GIT_CURRENT_SHA1));
setModal(true);
}

View File

@ -72,7 +72,6 @@ using namespace std;
#include "PDumpOutputHandler.h"
#include "PPrefsDialog.h"
#include "PGetMusrFTOptionsDialog.h"
//#include "PGetDefaultDialog.h"
#include "PMusrEditAbout.h"
#include "PMsr2DataDialog.h"

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>395</width>
<height>187</height>
<height>202</height>
</rect>
</property>
<property name="windowTitle">
@ -20,10 +20,10 @@
<widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>12</x>
<y>12</y>
<x>13</x>
<y>13</y>
<width>371</width>
<height>161</height>
<height>181</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
@ -46,6 +46,23 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="fGitBranch_label">
<property name="font">
<font>
<weight>75</weight>
<italic>true</italic>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600; font-style:italic;&quot;&gt;git-branch: &lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="fGitRev_label">
<property name="font">
@ -56,7 +73,7 @@ p, li { white-space: pre-wrap; }
</font>
</property>
<property name="text">
<string>git:</string>
<string>git-rev:</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>

View File

@ -53,7 +53,7 @@ int main( int argc, char ** argv )
cout << endl << endl;
return 0;
} else if (!strcmp(argv[1], "--version") || !strcmp(argv[1], "-v")) {
cout << endl << "musredit git-rev: " << GIT_REVISION;
cout << endl << "musredit git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1;
cout << endl << endl;
return 0;
}

View File

@ -457,9 +457,9 @@ int main(int argc, char *argv[])
if (argc == 2) {
if (!strcmp(argv[1], "--version")) {
#ifdef HAVE_CONFIG_H
cout << endl << "musrfit version: " << PACKAGE_VERSION << ", git-rev: " << GIT_REVISION << endl << endl;
cout << endl << "musrfit version: " << PACKAGE_VERSION << ", git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << endl << endl;
#else
cout << endl << "musrfit git-rev: " << GIT_REVISION << endl << endl;
cout << endl << "musrfit git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << endl << endl;
#endif
return PMUSR_SUCCESS;
}

View File

@ -232,9 +232,9 @@ Int_t main(Int_t argc, Char_t *argv[])
for (int i=1; i<argc; i++) {
if (!strcmp(argv[i], "--version")) {
#ifdef HAVE_CONFIG_H
cout << endl << ">> musrt0 version: " << PACKAGE_VERSION << ", git-rev: " << GIT_REVISION << endl << endl;
cout << endl << "musrt0 version: " << PACKAGE_VERSION << ", git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << endl << endl;
#else
cout << endl << ">> musrt0 git-rev: " << GIT_REVISION << endl << endl;
cout << endl << "musrt0 git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << endl << endl;
#endif
return PMUSR_SUCCESS;
} else if (!strcmp(argv[i], "--help")) {

View File

@ -127,9 +127,9 @@ int main(int argc, char *argv[])
}
} else if (!strcmp(argv[i], "--version")) {
#ifdef HAVE_CONFIG_H
cout << endl << "musrview version: " << PACKAGE_VERSION << ", git-rev: " << GIT_REVISION << endl << endl;
cout << endl << "musrview version: " << PACKAGE_VERSION << ", git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << endl << endl;
#else
cout << endl << "musrview git-rev: " << GIT_REVISION << endl << endl;
cout << endl << "musrview git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << endl << endl;
#endif
return PMUSR_SUCCESS;
} else if (!strcmp(argv[i], "--help")) {

View File

@ -62,9 +62,9 @@ int main(int argc, char *argv[])
if (!strcmp(argv[1], "--version")) {
#ifdef HAVE_CONFIG_H
cout << endl << "write_musrRoot_runHeader version: " << PACKAGE_VERSION << ", git-rev: " << GIT_REVISION << endl << endl;
cout << endl << "write_musrRoot_runHeader version: " << PACKAGE_VERSION << ", git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << endl << endl;
#else
cout << endl << "write_musrRoot_runHeader git-rev: " << GIT_REVISION << endl << endl;
cout << endl << "write_musrRoot_runHeader git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << endl << endl;
#endif
return 0;
}