summaryrefslogtreecommitdiff
path: root/dist/s_version
blob: a09aebd282ac80dacf342a5d9e9953324ba79eb9 (plain)
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
#!/bin/sh

# Propagate version changes to the necessary files.
. ../RELEASE_INFO

m4dir=../build_posix/aclocal
rpmspec=./package/wiredtiger.spec
tmp_file=__tmp

force=no
while :
	do case "$1" in
	-f)	# Force versions to be updated
		force=yes
		shift;;
	*)
		break;;
	esac
done

# If the version hasn't changed and we're not forcing the issue, we're done.
if test "$force" = no -a \
    -f $m4dir/version.m4 -a \
    -f $m4dir/version-set.m4 ; then
	eval `grep '^VERSION_[A-Z]*=' $m4dir/version-set.m4`
	if test x${WIREDTIGER_VERSION_MAJOR} = x${VERSION_MAJOR} -a \
		x${WIREDTIGER_VERSION_MINOR} = x${VERSION_MINOR} -a \
		x${WIREDTIGER_VERSION_PATCH} = x${VERSION_PATCH} ; then
		exit 0
	fi
fi

dotted_version=${WIREDTIGER_VERSION_MAJOR}.${WIREDTIGER_VERSION_MINOR}.${WIREDTIGER_VERSION_PATCH}
echo "Building $m4dir/version.m4"
cat <<EOF > $m4dir/version.m4
dnl WiredTiger product version for AC_INIT.  Maintained by dist/s_version
${dotted_version}
EOF

echo "Building $m4dir/version-set.m4"
cat <<EOF > $m4dir/version-set.m4
dnl build by dist/s_version

VERSION_MAJOR=${WIREDTIGER_VERSION_MAJOR}
VERSION_MINOR=${WIREDTIGER_VERSION_MINOR}
VERSION_PATCH=${WIREDTIGER_VERSION_PATCH}
VERSION_STRING='"${WIREDTIGER_VERSION_STRING}"'

AC_SUBST(VERSION_MAJOR)
AC_SUBST(VERSION_MINOR)
AC_SUBST(VERSION_PATCH)
AC_SUBST(VERSION_STRING)

VERSION_NOPATCH=${WIREDTIGER_VERSION_MAJOR}.${WIREDTIGER_VERSION_MINOR}
AC_SUBST(VERSION_NOPATCH)
EOF

echo "Building $rpmspec"
sed -e "s/Version:	.*/Version:	${dotted_version}/" $rpmspec	\
        > $tmp_file && mv $tmp_file $rpmspec