#!/usr/bin/make -f

%:
	dh $@

PKD      = $(abspath $(dir $(MAKEFILE_LIST)))
PKG      = $(word 2,$(shell dpkg-parsechangelog -l$(PKD)/changelog | grep ^Source))
UVER     = $(shell dpkg-parsechangelog -l$(PKD)/changelog | perl -ne 'print $$1 if m{^Version:\s+(?:\d+:)?(\d.*)(?:\-\d+.*)};')
REALUVER = $(shell echo $(UVER) | sed -e s/1.7.1.is.//)

get-orig-source:
# keep this if clause as long 1.6.x of mate-common upstream is packaged
	if [ "$(UVER)" = "1.7.1.is.$(REALUVER)" ]; then \
	    uscan --noconf --force-download --rename --download-version $(REALUVER) --destdir=.. ; \
	    mv -v ../$(PKG)_$(REALUVER).orig.tar.xz ../$(PKG)_$(UVER).orig.tar.xz; \
	else \
	    uscan --noconf --force-download --rename --download-current-version --destdir=.. ; \
	fi
