8f70cd7577029e4c42240790d5eb5d722771e48a
[openstack-build/ceilometer-build.git] / trusty / debian / rules
1 #!/usr/bin/make -f
2
3 export HOME="$(CURDIR)/debian/test"
4 include /usr/share/openstack-pkg-tools/pkgos.make
5 export OSLO_PACKAGE_VERSION=$(shell dpkg-parsechangelog | grep Version: | cut -d' ' -f2 | sed -e 's/^[[:digit:]]*://' -e 's/[-].*//' -e 's/~/.0/' | head -n 1)
6
7 %:
8         dh $@  --with python2,systemd,sphinxdoc
9
10 override_dh_clean:
11         dh_clean
12         rm -rf .testrepository
13         rm -f debian/ceilometer-common.config debian/ceilometer-common.postinst debian/ceilometer-api.config debian/ceilometer-api.postinst
14
15 override_dh_install:
16         dh_install --fail-missing
17
18         # Manage ceilometer.conf
19         mkdir -p $(CURDIR)/debian/ceilometer-common/usr/share/ceilometer-common
20         oslo-config-generator --output-file $(CURDIR)/debian/ceilometer-common/usr/share/ceilometer-common/ceilometer.conf \
21                 --namespace ceilometer \
22                 --namespace oslo.db \
23                 --namespace oslo.messaging \
24                 --namespace oslo.policy \
25                 --namespace keystonemiddleware.auth_token
26         sed -i 's|[# \t]*auth_protocol[\t ]*=.*|auth_protocol=http|' $(CURDIR)/debian/ceilometer-common/usr/share/ceilometer-common/ceilometer.conf
27         chmod 0644 $(CURDIR)/debian/ceilometer-common/usr/share/ceilometer-common/ceilometer.conf
28         sed -i 's|#connection[ \t]*=.*|connection=mongodb://localhost:27017/ceilometer|' $(CURDIR)/debian/ceilometer-common/usr/share/ceilometer-common/ceilometer.conf
29
30 override_dh_auto_build:
31         dh_auto_build
32         /usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func ceilometer-common.config
33         /usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func ceilometer-common.postinst
34         /usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func ceilometer-api.config
35         /usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func ceilometer-api.postinst
36
37 override_dh_auto_clean:
38         dh_auto_clean
39         rm -rf .testrepository
40         find . -iname '*.pyc' -delete
41         rm -f debian/*.init debian/*.service debian/*.upstart
42
43 override_dh_auto_test:
44 ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
45         rm -rf .testrepository
46         testr init
47         set -e ; \
48                 TEMP_REZ=`mktemp -t` ; \
49                 bash -x ./setup-test-env-mongodb.sh testr run --subunit 'tests\.(?!.*test_bin.*)' | tee $$TEMP_REZ | subunit2pyunit ; \
50                 cat $$TEMP_REZ | subunit-filter -s --no-passthrough | subunit-stats ; \
51                 rm -f $$TEMP_REZ ;
52         testr slowest
53 endif
54
55 override_dh_sphinxdoc:
56 ifeq (,$(findstring nodocs, $(DEB_BUILD_OPTIONS)))
57         PYTHONPATH=. sphinx-build -b html doc/source $(CURDIR)/debian/ceilometer-doc/usr/share/doc/ceilometer-doc/html
58         mkdir -p $(CURDIR)/debian/ceilometer-doc/usr/share/doc/ceilometer-doc/html/_static
59         touch $(CURDIR)/debian/ceilometer-doc/usr/share/doc/ceilometer-doc/html/_static/toggle.js
60         dh_sphinxdoc -O--buildsystem=python_distutils
61 endif