#!/bin/sh -e
UPSTREAM_VERSION="$(sed -n -e 's/__version__ *= *"\([0-9.]*\)"/\1/p' src/imediff/__init__.py)"
DEB_VERSION="$(dpkg-parsechangelog -S version | sed -e 's/-.[^-]*$//')"
echo "I: $UPSTREAM_VERSION -- upstream version in src/imediff/__init__.py"
echo "I: $DEB_VERSION -- debian version in debian/changelog"
if [ "$UPSTREAM_VERSION" = "$DEB_VERSION" ]; then
	echo "I: VERSION MATCHED -- GOOD"
else
	echo "E: VERSION NON-MATCH -- BAD"
  echo "E:  >>> Fix debian/changelog file with 'dch'"
	exit 1
fi
