#!/usr/bin/make -f

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

export OSLO_PACKAGE_VERSION=$(VERSION)

%:
	dh $@  --with python2

ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
override_dh_auto_test:
	PYTHONPATH=$(CURDIR) bash run_tests.sh -N -P || true
endif

override_dh_clean:
	dh_clean
	rm -f debian/cinder-common.config debian/cinder-common.postinst debian/cinder-api.config debian/cinder-api.postinst debian/cinder-volume.postinst
	rm -rf setuptools_git-*-py*.egg/

override_dh_install:
	dh_install --fail-missing -Xbin/cinder-all
	install -D -m 0440 debian/cinder-common.sudoers $(CURDIR)/debian/cinder-common/etc/sudoers.d/cinder-common

override_dh_fixperms:
	dh_fixperms -Xcinder_tgt.conf
	chmod 0440 $(CURDIR)/debian/cinder-common/etc/sudoers.d/cinder-common

override_dh_auto_build:
	dh_auto_build

	/usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func cinder-common.config
	/usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func cinder-common.postinst
	/usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func cinder-api.config
	/usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func cinder-api.postinst
	/usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func cinder-volume.postinst
