c922c23c28e68a2ea6e2fbd3e1dd2d8983fd52d6
[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         rm -rf $(CURDIR)/debian/tmp
17         python2.7 setup.py install --install-layout=deb --root $(CURDIR)/debian/tmp
18         dh_install --fail-missing
19
20         # Manage ceilometer.conf
21         mkdir -p $(CURDIR)/debian/ceilometer-common/usr/share/ceilometer-common
22         PYTHONPATH=$(CURDIR)/debian/tmp/usr/lib/python2.7/dist-packages oslo-config-generator \
23                 --output-file $(CURDIR)/debian/ceilometer-common/usr/share/ceilometer-common/ceilometer.conf \
24                 --wrap-width 140 \
25                 --namespace ceilometer \
26                 --namespace oslo.concurrency \
27                 --namespace oslo.db \
28                 --namespace oslo.log \
29                 --namespace oslo.messaging \
30                 --namespace oslo.middleware.cors \
31                 --namespace oslo.policy \
32                 --namespace oslo.service.service \
33                 --namespace keystonemiddleware.auth_token
34         sed -i 's|[# \t]*auth_protocol[\t ]*=.*|auth_protocol=http|' $(CURDIR)/debian/ceilometer-common/usr/share/ceilometer-common/ceilometer.conf
35         chmod 0644 $(CURDIR)/debian/ceilometer-common/usr/share/ceilometer-common/ceilometer.conf
36         sed -i 's|#connection[ \t]*=.*|connection=mongodb://localhost:27017/ceilometer|' $(CURDIR)/debian/ceilometer-common/usr/share/ceilometer-common/ceilometer.conf
37
38 override_dh_auto_build:
39         dh_auto_build
40         /usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func ceilometer-common.config
41         /usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func ceilometer-common.postinst
42         /usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func ceilometer-api.config
43         /usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func ceilometer-api.postinst
44
45 override_dh_auto_clean:
46         dh_auto_clean
47         rm -rf .testrepository
48         find . -iname '*.pyc' -delete
49         rm -f debian/*.init debian/*.service debian/*.upstart
50
51 override_dh_auto_test:
52 ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
53         rm -rf .testrepository
54         testr init
55         set -e ; \
56                 TEMP_REZ=`mktemp -t` ; \
57                 bash -x ./setup-test-env-mongodb.sh testr run --subunit 'tests\.(?!(.*test_bin.*|.*functional.*|.*gabbi\.test_gabbi_prefix.*|.*meter\.test_notifications\.TestMeterProcessing\.test_fallback_meter_path.*))' | tee $$TEMP_REZ | subunit2pyunit ; \
58                 cat $$TEMP_REZ | subunit-filter -s --no-passthrough | subunit-stats ; \
59                 rm -f $$TEMP_REZ ;
60         testr slowest
61 endif
62
63 override_dh_sphinxdoc:
64 ifeq (,$(findstring nodocs, $(DEB_BUILD_OPTIONS)))
65         PYTHONPATH=. sphinx-build -b html doc/source $(CURDIR)/debian/ceilometer-doc/usr/share/doc/ceilometer-doc/html
66         mkdir -p $(CURDIR)/debian/ceilometer-doc/usr/share/doc/ceilometer-doc/html/_static
67         touch $(CURDIR)/debian/ceilometer-doc/usr/share/doc/ceilometer-doc/html/_static/toggle.js
68         dh_sphinxdoc -O--buildsystem=python_distutils
69 endif