1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
#!/usr/bin/make -f
include /usr/share/openstack-pkg-tools/pkgos.make
%:
dh $@ --buildsystem=python_distutils --with python3,sphinxdoc,systemd
override_dh_auto_clean:
find . -iname '*.pyc' -delete
rm -f debian/cloudkitty-common.config debian/cloudkitty-common.postinst
rm -f debian/cloudkitty-api.config debian/cloudkitty-api.postinst debian/cloudkitty-common.postrm
rm -f debian/*.init debian/*.upstart debian/*.service debian/*.templates
rm -rf build
override_dh_auto_build:
/usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func cloudkitty-common.config
/usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func cloudkitty-common.postinst
/usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func cloudkitty-api.config
/usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func cloudkitty-api.postinst
/usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_postrm cloudkitty-common.postrm
pkgos-merge-templates cloudkitty-api cloudkitty endpoint
pkgos-merge-templates cloudkitty-common cloudkitty db rabbit ksat
override_dh_auto_install:
echo "Do nothing..."
override_dh_auto_test:
echo "Do nothing..."
override_dh_install:
for i in $(PYTHON3S) ; do \
python$$i setup.py install --install-layout=deb --root $(CURDIR)/debian/tmp ; \
done
# Patch to find metrics.yml from curdir instead of /etc
# This is needed for both tests and generating cloudkitty.conf
patch -p1 <$(CURDIR)/debian/cloudkitty.collector.__init__.py.patch
cp cloudkitty/collector/__init__.py $(CURDIR)/debian/tmp/usr/lib/python3/dist-packages/cloudkitty/collector
ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
pkgos-dh_auto_test --no-py2 'cloudkitty\.tests(?!(.*collectors\.test_prometheus.*|.*storage\.v1\.test_hybrid_storage.*))'
endif
mkdir -p $(CURDIR)/debian/cloudkitty-common/usr/share/cloudkitty-common
PYTHONPATH=$(CURDIR)/debian/tmp/usr/lib/python3/dist-packages python3-oslo-config-generator \
--output-file $(CURDIR)/debian/cloudkitty-common/usr/share/cloudkitty-common/cloudkitty.conf \
--namespace cloudkitty.common.config \
--namespace oslo.concurrency \
--namespace oslo.db \
--namespace oslo.log \
--namespace oslo.messaging \
--namespace oslo.middleware.http_proxy_to_wsgi \
--namespace oslo.middleware.cors \
--namespace oslo.policy \
--namespace keystonemiddleware.auth_token
pkgos-readd-keystone-authtoken-missing-options $(CURDIR)/debian/cloudkitty-common/usr/share/cloudkitty-common/cloudkitty.conf keystone_authtoken cloudkitty
# Unpatch for production
patch -p1 -R <$(CURDIR)/debian/cloudkitty.collector.__init__.py.patch
cp cloudkitty/utils.py $(CURDIR)/debian/tmp/usr/lib/python3/dist-packages/cloudkitty
# Set everything to use [keystone_authtoken] by default, otherwise it points to a non-working config
pkgos-fix-config-default $(CURDIR)/debian/cloudkitty-common/usr/share/cloudkitty-common/cloudkitty.conf ceilometer_collector auth_section keystone_authtoken
pkgos-fix-config-default $(CURDIR)/debian/cloudkitty-common/usr/share/cloudkitty-common/cloudkitty.conf gnocchi_collector auth_section keystone_authtoken
pkgos-fix-config-default $(CURDIR)/debian/cloudkitty-common/usr/share/cloudkitty-common/cloudkitty.conf keystone_fetcher auth_section keystone_authtoken
# Set correct value for metrics.yml after we've patched it:
pkgos-fix-config-default $(CURDIR)/debian/cloudkitty-common/usr/share/cloudkitty-common/cloudkitty.conf collect metrics_conf /etc/cloudkitty/metrics.yml
# Set the lock_path
pkgos-fix-config-default $(CURDIR)/debian/cloudkitty-common/usr/share/cloudkitty-common/cloudkitty.conf oslo_concurrency lock_path /var/lock/cloudkitty
# Fixed default backend
pkgos-fix-config-default $(CURDIR)/debian/cloudkitty-common/usr/share/cloudkitty-common/cloudkitty.conf tenant_fetcher backend keystone
PYTHONPATH=$(CURDIR)/debian/tmp/usr/lib/python3/dist-packages python3-oslopolicy-sample-generator \
--output-file $(CURDIR)/debian/cloudkitty-common/usr/share/cloudkitty-common/policy.json \
--format json \
--namespace cloudkitty
for i in api_paste.ini metrics.yml ; do \
install -D -m 0664 etc/cloudkitty/$$i $(CURDIR)/debian/cloudkitty-common/usr/share/cloudkitty-common/$$i ; \
done
dh_install
dh_missing --fail-missing
# Generate all config files
override_dh_sphinxdoc:
ifeq (,$(findstring nodocs, $(DEB_BUILD_OPTIONS)))
# Warning: building doc fails.
PYTHON=python3 python3 -m sphinx $(SPHINXOPTS) -b html doc/source $(CURDIR)/debian/cloudkitty-doc/usr/share/doc/cloudkitty-doc/html || true
rm -rf $(CURDIR)/debian/cloudkitty-doc/usr/share/doc/cloudkitty-doc/html/.doctrees
touch $(CURDIR)/debian/cloudkitty-doc/usr/share/doc/cloudkitty-doc/html/_static/toggle.js
dh_sphinxdoc -O--buildsystem=python_distutils
endif
override_dh_installman:
ifeq (,$(findstring nodocs, $(DEB_BUILD_OPTIONS)))
echo "No man pages for now"
# sphinx-build $(SPHINXOPTS) -b man doc/source doc/build/man
# dh_installman -O--buildsystem=python_distutils
endif
override_dh_python3:
dh_python3 --shebang=/usr/bin/python3
|