Added a documentation package with the sphinx docs.
[openstack-build/ceilometer-build.git] / trusty / debian / rules
index a7c8a708e5c991b7549cca01f5689af7770cc23e..94822756c5c88f21275f6d00faf2bbde67e3b49e 100755 (executable)
@@ -7,7 +7,7 @@ include /usr/share/openstack-pkg-tools/pkgos.make
 export OSLO_PACKAGE_VERSION=$(VERSION)
 
 %:
-       dh $@  --with python2
+       dh $@  --with python2,systemd,sphinxdoc
 
 override_dh_clean:
        dh_clean
@@ -16,11 +16,19 @@ override_dh_clean:
        rm -f debian/ceilometer-common.config debian/ceilometer-common.postinst debian/ceilometer-api.config debian/ceilometer-api.postinst
 
 override_dh_install:
-       dh_install
-       install -D -m 0644 $(CURDIR)/etc/ceilometer/ceilometer.conf.sample      $(CURDIR)/debian/ceilometer-common/usr/share/ceilometer-common/ceilometer.conf
-       install -D -m 0644 $(CURDIR)/etc/ceilometer/policy.json                 $(CURDIR)/debian/ceilometer-common/usr/share/ceilometer-common/policy.json
-       install -D -m 0644 $(CURDIR)/etc/ceilometer/sources.json                $(CURDIR)/debian/ceilometer-common/usr/share/ceilometer-common/sources.json
-       install -D -m 0644 $(CURDIR)/etc/ceilometer/pipeline.yaml               $(CURDIR)/debian/ceilometer-common/usr/share/ceilometer-common/pipeline.yaml
+       dh_install --fail-missing
+
+       # Manage ceilometer.conf
+       mkdir -p $(CURDIR)/debian/ceilometer-common/usr/share/ceilometer-common
+       oslo-config-generator --output-file $(CURDIR)/debian/ceilometer-common/usr/share/ceilometer-common/ceilometer.conf \
+               --namespace ceilometer \
+               --namespace oslo.db \
+               --namespace oslo.messaging \
+               --namespace oslo.policy \
+               --namespace keystonemiddleware.auth_token
+       sed -i 's|[# \t]*auth_protocol[\t ]*=.*|auth_protocol=http|' $(CURDIR)/debian/ceilometer-common/usr/share/ceilometer-common/ceilometer.conf
+       chmod 0644 $(CURDIR)/debian/ceilometer-common/usr/share/ceilometer-common/ceilometer.conf
+       sed -i 's|#connection[ \t]*=.*|connection=mongodb://localhost:27017/ceilometer|' $(CURDIR)/debian/ceilometer-common/usr/share/ceilometer-common/ceilometer.conf
 
 override_dh_auto_build:
        dh_auto_build
@@ -39,7 +47,18 @@ override_dh_auto_test:
 ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
        rm -rf .testrepository
        testr init
-       bash -x ./setup-test-env.sh testr run --subunit 'tests\.(?!.*test_bin.*)' | subunit2pyunit || true
+       set -e ; \
+               TEMP_REZ=`mktemp -t` ; \
+               bash -x ./setup-test-env-mongodb.sh testr run --subunit 'tests\.(?!.*test_bin.*)' | tee $$TEMP_REZ | subunit2pyunit ; \
+               cat $$TEMP_REZ | subunit-filter -s --no-passthrough | subunit-stats ; \
+               rm -f $$TEMP_REZ ;
        testr slowest
-       testr last --subunit | subunit-filter -s --no-passthrough | subunit-stats
+endif
+
+override_dh_sphinxdoc:
+ifeq (,$(findstring nodocs, $(DEB_BUILD_OPTIONS)))
+       PYTHONPATH=. sphinx-build -b html doc/source $(CURDIR)/debian/ceilometer-doc/usr/share/doc/ceilometer-doc/html
+       mkdir -p $(CURDIR)/debian/ceilometer-doc/usr/share/doc/ceilometer-doc/html/_static
+       touch $(CURDIR)/debian/ceilometer-doc/usr/share/doc/ceilometer-doc/html/_static/toggle.js
+       dh_sphinxdoc -O--buildsystem=python_distutils
 endif