]> git.wh0rd.org - fontconfig.git/blame - new-version.sh
Add more files to .gitignore
[fontconfig.git] / new-version.sh
CommitLineData
fba7c37f
KP
1#!/bin/sh
2
3test=echo
4if git-status > /dev/null; then
5 :
6else
7 echo 'Uncommited changes in repository' 1>&2
8 exit 1
9fi
10
11version="$1"
12case "$version" in
132.[0-9.]*)
14 ;;
15*)
16 echo 'Invalid version number:' "$version" 1>&2
17 exit 1
18 ;;
19esac
20
21eval `echo $version |
22 awk -F. '{ printf ("major=%d\nminor=%d\nrevision=%d\n",
23 $1, $2, $3); }'`
24
25# Update the version numbers
26
27$test sed -i configure.in "/^AM_INIT_AUTOMAKE/s/2\.[0-9.]*/$version/"
28
29$test sed -i fontconfig/fontconfig.h \
30 -e "/^#define FC_MAJOR/s/[0-9]*/$major/" \
31 -e "/^#define FC_MINOR/s/[0-9]*/$minor/" \
32 -e "/^#define FC_REVISION/s/[0-9]*/$revision/"
33
34#
35# Compute pretty form of new version number
36#
37version_note=`echo $version | awk -F. '{
38 if ($3 > 90)
39 printf ("%d.%d.%d (%d.%d RC%d)\n",
40 $1, $2, $3, $1, $2 + 1, $3 - 90);
41 else if ($3 == 0)
42 printf ("%d.%d\n", $1, $2);
43 else
44 printf ("%d.%d.%d\n", $1, $2, $3); }'`
45
46#
47# Find previous version in README
48#
49last_note=`grep '^2\.[0-9.]*' README |
50 head -1 |
51 sed 's/ (2\.[0-9]* RC[0-9]*)//'`
52case $last_note in
532.*.*)
54 last=$last_note
55 ;;
562.*)
57 last="$last_note.0"
58 ;;
59*)
60 echo 'cannot find previous changelog' 1>&2
61 exit 1
62esac
63
64#
65# Format the current date for the README header
66#
67date=`date '+%Y-%m-%d'`
68
69#
70# Update the readme file
71#
72if [ $version != $last ]; then
73 #
74 # header
75 #
76 (sed '/^2\.[0-9.]*$/,$d' README |
77 sed -e "s/Version.*/Version $version_note/" \
78 -e "s/200.*/$date/" | awk '
79 /^[ \t]/ {
80 gsub ("^[ \t]*", "");
81 gsub ("[ \t]*$", "");
82 space=(70 - length) / 2;
83 for (i = 0; i < space; i++)
84 printf (" ");
85 print
86 next
87 }
88 {
89 print
90 }'
91
92 #
93 # changelog
94 #
95
96 echo $version_note
97 echo
98 git-log --pretty=short $last.. | git-shortlog | cat
99
100 #
101 # previous changelogs
102 #
103
104 sed -n '/^2\.[0-9.]*$/,$p' README) > README.tmp ||
105 (echo "README update failed"; exit 1)
106
107 $test mv README.tmp README
108fi
109
110$test git-commit -m"Bump version to $version" \
111 configure.in \
112 fontconfig/fontconfig.h \
113 README
114
115# tag the tree
116$test git-tag -u 096c4dd3 -m"Version $version" $version
117
118# Make distributed change log
119
120$test "git-log --stat $last.. > ChangeLog-$version"
121