#!/bin/sh
VERSION_SRC=`grep ^VERSION cfget | cut -d\" -f2`
VERSION_SETUPPY=`grep version= setup.py | cut -d\' -f2`
VERSION_DEB=`head -n 1 debian/changelog  | sed -re 's/.+\(([^-]+).+/\1/'`
VERSION_DEBFULL=`head -n 1 debian/changelog  | sed -re 's/.+\((.+)\).+/\1/'`
VERSION="$VERSION_SRC"

if [ "$VERSION_SRC" != "$VERSION_SETUPPY" ]
then
	echo "Version mismatch between cfget ($VERSION_SRC) and setup.py ($VERSION_SETUPPY)" >&2
	exit 1
fi

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



echo "$VERSION"
exit 0
