File: nrnversion.sh

package info (click to toggle)
neuron 8.2.6-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 34,760 kB
  • sloc: cpp: 149,571; python: 58,465; ansic: 50,329; sh: 3,510; xml: 213; pascal: 51; makefile: 35; sed: 5
file content (49 lines) | stat: -rwxr-xr-x 1,287 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env bash
# extract commit version info from src/nrnoc/nrnversion.h
# and PACKAGE_VERSION from configure.ac

if test "$NSRC" = "" ; then
	NSRC=$HOME/neuron/nrn
fi

if test -f $NSRC/src/nrnoc/nrnversion.h ; then
	VERHFILE=`cat $NSRC/src/nrnoc/nrnversion.h`
elif test -d $NSRC/.git ; then
	VERHFILE=`sh $NSRC/git2nrnversion_h.sh`
fi

GIT=GIT

global=`echo "$VERHFILE" | sed -n '/GIT_CHANGESET/s/.*"\(.*\)".*/\1/p'`

type=`echo "$VERHFILE" | sed -n /${GIT}'_BRANCH/s/.*\(".*"\).*/\1/p' | sed '
s/"Release.*"/rel/
s/"\(.*\)"/\1/
'`
describe=`echo "$VERHFILE" | sed -n /${GIT}'_DESCRIBE/s/.*"\(.*\)".*/\1/p'`
base=`echo $global | sed 's/\+//'`
commit=$global
date=`echo "$VERHFILE" | sed -n /${GIT}'_DATE/s/.*"\(.*\)".*/\1/p'`
micro=`echo $describe | sed -n 's/[0-9]*\.[0-9]*\.\([0-9]*\).*/\1/p'`
nano=''
if echo $describe | grep -q '\-' ; then
  nano=`echo $describe | sed -n 's/[^-]*\-\([0-9]*\).*/\1/p'`
fi 
microdotnano=$micro
if test "$nano" != "" ; then
  microdotnano=$micro.$nano
fi

case $1 in
	"type") echo $type ;;
	"commit") echo ${type}-${commit} ;;
	"describe") echo $describe ;;
	"base") echo $base ;;
	"global") echo $global ;;
	"date") echo $date ;;
	"micro") echo $micro ;;
	"nano") echo $nano ;;
	"microdotnano") echo $microdotnano ;;
	*) echo $describe ;;
esac