From fde7ddf832219a0f6ac95cee58bb65f8c6b5fdf4 Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Wed, 28 Jun 2017 11:00:21 +0200 Subject: [PATCH] added updateversion into makefile while compiling --- .../mythenDetectorServer/Makefile | 6 ++- .../mythenDetectorServer/Makefile.dum | 6 ++- .../mythenDetectorServer/updateGitVersion.sh | 37 +++++++++++++++++++ 3 files changed, 47 insertions(+), 2 deletions(-) create mode 100755 slsDetectorSoftware/mythenDetectorServer/updateGitVersion.sh diff --git a/slsDetectorSoftware/mythenDetectorServer/Makefile b/slsDetectorSoftware/mythenDetectorServer/Makefile index 99c2e4354..a4eed6cdc 100755 --- a/slsDetectorSoftware/mythenDetectorServer/Makefile +++ b/slsDetectorSoftware/mythenDetectorServer/Makefile @@ -22,7 +22,7 @@ CFLAGS+= -Wall -DC_ONLY -DMCB_FUNCS -DDACS_INT $(VFLAGS) LDLIBS+= -lm mythen: clean $(PROGS) -all: $(PROGS) +all: updateVersion $(PROGS) boot: $(OBJS) @@ -39,3 +39,7 @@ clean: depend: makedepend -Y -- $(CFLAGS) -- $(SRCS) 2>/dev/null + +updateVersion: + ./updateGitVersion.sh + \ No newline at end of file diff --git a/slsDetectorSoftware/mythenDetectorServer/Makefile.dum b/slsDetectorSoftware/mythenDetectorServer/Makefile.dum index 59a15e28e..bd74d1e2e 100644 --- a/slsDetectorSoftware/mythenDetectorServer/Makefile.dum +++ b/slsDetectorSoftware/mythenDetectorServer/Makefile.dum @@ -18,7 +18,7 @@ CFLAGS+= -Wall -DC_ONLY -DVERBOSE LDLIBS+= -lm -all: $(PROGS) +all: updateVersion $(PROGS) boot: $(OBJS) @@ -35,3 +35,7 @@ clean: depend: makedepend -Y -- $(CFLAGS) -- $(SRCS) 2>/dev/null + +updateVersion: + ./updateGitVersion.sh + \ No newline at end of file diff --git a/slsDetectorSoftware/mythenDetectorServer/updateGitVersion.sh b/slsDetectorSoftware/mythenDetectorServer/updateGitVersion.sh new file mode 100755 index 000000000..3fd1bdb1c --- /dev/null +++ b/slsDetectorSoftware/mythenDetectorServer/updateGitVersion.sh @@ -0,0 +1,37 @@ +SERVER=mythenDetectorServer +TMPFILE=gitInfoMythenTmp.h +INCLFILE=gitInfoMythen.h + +WD=slsDetectorSoftware/$SERVER + +GITREPO1='git remote -v' +GITREPO2=" | grep \"fetch\" | cut -d' ' -f1" +BRANCH1='git branch -v' +BRANCH2=" | grep '*' | cut -d' ' -f2" +REPUID1='git log --pretty=format:"%H" -1' +AUTH1_1='git log --pretty=format:"%cn" -1' +AUTH1_2=" | cut -d' ' -f1" +AUTH2_1='git log --pretty=format:"%cn" -1' +AUTH2_2=" | cut -d' ' -f2" +FOLDERREV1='git log --oneline . ' #used for all the individual server folders +FOLDERREV2=" | wc -l" #used for all the individual server folders +REV1='git log --oneline ' +REV2=" | wc -l" +RDATE1='git log --pretty=format:"%ci" -1' + +GITREPO=`eval $GITREPO1 $GITREPO2` +BRANCH=`eval $BRANCH1 $BRANCH2` +REPUID=`eval $REPUID1` +AUTH1=`eval $AUTH1_1 $AUTH1_2` +AUTH2=`eval $AUTH2_1 $AUTH2_2` +REV=`eval $REV1 $REV2` +FOLDERREV=`eval $FOLDERREV1 $FOLDERREV2` +RDATE=`eval $RDATE1` +echo Path: slsDetectorsPackage/$WD $'\n'URL: ${GITREPO}/$SERVER $'\n'Repository Root: ${GITREPO} $'\n'Repsitory UUID: ${REPUID} $'\n'Revision: ${FOLDERREV} $'\n'Branch: ${BRANCH} $'\n'Last Changed Author: ${AUTH1}_${AUTH2} $'\n'Last Changed Rev: ${REV} $'\n'Last Changed Date: ${RDATE} > gitInfo.txt +cd ../../ +./genVersionHeader.sh $WD/gitInfo.txt $WD/$TMPFILE $WD/$INCLFILE +echo "Revision Updated" +cd $WD + + +