File: update_version

package info (click to toggle)
espresso 5.1%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 146,004 kB
  • ctags: 17,245
  • sloc: f90: 253,041; sh: 51,271; ansic: 27,494; tcl: 15,570; xml: 14,508; makefile: 2,958; perl: 2,035; fortran: 1,924; python: 337; cpp: 200; awk: 57
file content (35 lines) | stat: -rwxr-xr-x 839 bytes parent folder | download | duplicates (2)
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
#!/bin/sh

# check if svn info available (do not write anything)
svn info 2> /dev/null > /dev/null

if [ $? = 0 ] ; then 
# svn info available: get svn revision
   svn_rev=$(svnversion -n)
else
# svn info available: revert to no info
   svn_rev=unknown
fi

# write svn into file version_tmp.f90
cat version.f90.in | sed 's/unknown/'$svn_rev'/' > version.f90.tmp

# check if a previous version.f90 file exists
if test -f version.f90 ; then

# version.f90 existing: check if new and previous files differ
   diff -wib version.f90.tmp version.f90  2> /dev/null > /dev/null

   if [ $? = 1 ] ; then 
# they differ: update file version.f90
      mv version.f90.tmp version.f90
   fi
# do not update if files are the same (prevents useless recompilation)

else

# file version.f90 not existing: create one
   mv version.f90.tmp version.f90

fi