#!/usr/bin/make -f
# export DH_VERBOSE = 1

export OSLO_PACKAGE_VERSION=$(shell dpkg-parsechangelog | sed -n -e 's/^Version: //p' | sed -e 's/^[[:digit:]]*://' -e 's/[-~+].*//')

%:
	dh $@ --with python2 --buildsystem=pybuild

override_dh_auto_test:
ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
	ostestr
endif

override_dh_auto_clean:
	dh_auto_clean -O--buildsystem=pybuild
	rm -rf .testrepository

BRANCH = master
DATE=$(shell date +%Y%m%d%H%M)
get-orig-snapshot:
	rm -Rf nova-lxd-upstream
	git clone https://github.com/lxc/nova-lxd nova-lxd-upstream
	cd nova-lxd-upstream && \
		export COMMIT=`git rev-parse --short HEAD` && \
		export UPSTREAM_VERSION=`grep version setup.cfg | cut -d ' ' -f 3` && \
		git archive --format tgz --prefix=nova-lxd-$$UPSTREAM_VERSION~git$(DATE)/ \
			-o ../../nova-lxd_$$UPSTREAM_VERSION~git$(DATE).$$COMMIT.orig.tar.gz $(BRANCH)
	rm -Rf nova-lxd-upstream
