File: newversion

package info (click to toggle)
swi-prolog 5.10.1-1%2Bsqueeze1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 76,436 kB
  • ctags: 45,143
  • sloc: ansic: 290,417; perl: 215,108; sh: 5,411; java: 5,136; makefile: 5,021; cpp: 2,168; yacc: 843; xml: 77; sed: 12
file content (51 lines) | stat: -rwxr-xr-x 1,184 bytes parent folder | download
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
50
51
#!/bin/bash
# Automate the release process.
# Author: Jan wielemaker
#
# Usage: first update VERSION, then run this script.

function confirm ()
{ while true; do
    echo -n "$1 "
    read answer
    case "$answer" in
          y*)   return 0
                ;;
          n*)   return 1
                ;;
          *)
                echo "Please answer yes or no"
                ;;
    esac
  done
}

version=`cat VERSION`
versiondate=`date +"%B %Y"`

major=`echo $version | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\1/'`
minor=`echo $version | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2/'`
patch=`echo $version | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\3/'`

numversion=$(($major * 10000 + $minor * 100 + $patch))

tmp=.tmp$$

f=src/SWI-Prolog.h
sed "s/^#define PLVERSION.*/#define PLVERSION $numversion/" $f > $tmp
if cmp $f $tmp; then
    rm -f $tmp
else
    cat $tmp > $f
    rm $tmp
    cp -p $f include/SWI-Prolog.h
    echo "Updated #define PLVERSION in $f and include/SWI-Prolog.h"
fi

rm -f $tmp

gittag="V${major}.${minor}.${patch}"

if confirm "Tag the GIT repository with $gittag? "; then
    git tag -f -m "Release tag for ${major}.${minor}.${patch}" $gittag
fi