#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

DEBVERS ?= $(shell dpkg-parsechangelog | sed -n -e 's/^Version: //p')
VERSION ?= $(shell echo '$(DEBVERS)' | sed -e 's/^[[:digit:]]*://' -e 's/[-].*//' -e 's/[+].*//' -e 's/~git.*//g' -e 's/~/./g')
export PBR_VERSION=$(VERSION)

include /usr/share/openstack-pkg-tools/pkgos.make

%:
	dh $@  --with python3,apache2 --buildsystem=pybuild

ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
override_dh_auto_test:
	pkgos-dh_auto_test --no-py2
endif

override_dh_auto_install:
	pkgos-dh_auto_install --no-py2
	rm -rf $(CURDIR)/debian/python*-cinder/usr/etc

override_dh_install:
	dh_install -Xbin/cinder-all -Xusr/bin/cinder-api
	dh_missing --fail-missing -Xbin/cinder-all -Xusr/bin/cinder-api

override_dh_fixperms:
	dh_fixperms -Xcinder_tgt.conf

override_dh_clean:
	# temporary workaround for d2to1 wonkyness
	dh_clean -Xsetup.cfg
	rm -f debian/*.init debian/*.service debian/*.upstart

override_dh_auto_clean:
	dh_auto_clean
	rm -rf .eggs .testrepository

override_dh_python3:
	dh_python3 --shebang=/usr/bin/python3
