#!/bin/sh
VERSION_SRC=`grep ^VERSION= update-apt-xapian-index | sed -re 's/^.+"([^"]+)".*/\1/'`
VERSION_DEB=`head -n 1 debian/changelog | sed -re 's/[^(]+\(([^)]+)\).+/\1/'`
VERSION="$VERSION_SRC"

if [ "$VERSION_SRC" != "$VERSION_DEB" ]
then
	echo "Version mismatch between source ($VERSION_SRC) and debian/changelog ($VERSION_DEB)" >&2
	exit 1
fi

echo "$VERSION"
exit 0
