File: newversion

package info (click to toggle)
swi-prolog 9.0.4%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 82,408 kB
  • sloc: ansic: 387,503; perl: 359,326; cpp: 6,613; lisp: 6,247; java: 5,540; sh: 3,147; javascript: 2,668; python: 1,900; ruby: 1,594; yacc: 845; makefile: 428; xml: 317; sed: 12; sql: 6
file content (99 lines) | stat: -rwxr-xr-x 2,253 bytes parent folder | download | duplicates (4)
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/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"`

vpat='\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)\(-\([a-z0-9]*\)\)\{0,1\}'

major=$(echo $version | sed "s/$vpat/\1/")
minor=$(echo $version | sed "s/$vpat/\2/")
patch=$(echo $version | sed "s/$vpat/\3/")
 vtag=$(echo $version | sed "s/$vpat/\5/")

# echo "major=$major minor=$minor patch=$patch tag=$vtag"
# exit 0

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

tmp=.tmp$$

f=src/SWI-Prolog.h
sed -e "s/^#define PLVERSION\>.*/#define PLVERSION $numversion/" \
    -e "s/^#define PLVERSION_TAG.*/#define PLVERSION_TAG "'"'"$vtag"'"/' \
	$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

month=`LANG=POSIX date "+%B"`
year=`date "+%Y"`
f=man/main.doc
sed -e "s@{\\\\vmajor}{[0-9]*}@{\\\\vmajor}{$major}@" \
    -e "s@{\\\\vminor}{[0-9]*}@{\\\\vminor}{$minor}@" \
    -e "s@{\\\\vpatch}{[0-9]*}@{\\\\vpatch}{$patch}@" \
    -e "s@{\\\\vtag}{[a-z0-9]*}@{\\\\vtag}{$vtag}@" \
    -e "s@{\\\\vmonth}{[A-Za-z]*}@{\\\\vmonth}{$month}@" \
    -e "s@{\\\\vyear}{[0-9]*}@{\\\\vyear}{$year}@" \
	$f > $tmp
if cmp $f $tmp; then
    rm -f $tmp
else
    cat $tmp > $f
    rm $tmp
    echo "Updated $f"
fi

vlong=${major}.${minor}.${patch}
if [ ! -z "$vtag" ]; then
  vlong="$vlong-$vtag"
fi

if [ ! -z "$(git diff --stat)" ]; then
  if confirm "Commit final changes? "; then
    git commit -a -m "Preparing version ${vlong}"
  fi
fi

gittag="V${vlong}"

if confirm "Tag the GIT repository with $gittag? "; then
  git tag -s -f -m "Release tag for ${vlong}" $gittag
fi


if confirm "Tag all packages with $gittag? "; then
    tmp=/tmp/msg$$
    echo "Release tag for ${vlong}" > $tmp

    git submodule foreach git tag -s -f -F $tmp  $gittag

    rm -f $tmp
fi