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 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
|
#!/usr/bin/make -f
include /usr/share/openstack-pkg-tools/pkgos.make
%:
dh $@ --buildsystem=pybuild --with python3,sphinxdoc
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 *.egg-info $(CURDIR)/debian/po
find . -iname '*.pyc' -delete
for i in $$(find . -type d -iname __pycache__) ; do rm -rf $$i ; done
cp $(CURDIR)/debian/cloudkitty.conf.sample doc/source/_static/cloudkitty.conf.sample
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)))
# Blacklist:
# Test looks broken, and anyways, the use of uwsgi in Debian makes it so
# we can always reload policy without restarting uwsgi since it forks.
# PolicyFileTestCase\.test_modified_policy_reloads
pkgos-dh_auto_test --no-py2 'cloudkitty\.tests\.(?!(.*collectors\.test_prometheus.*|.*storage\.v1\.test_hybrid_storage.*|.*test_hacking\.HackingTestCase\.test_logging_with_tuple_argument.*|.*storage\.v1\.test_storage\.StorageTotalTest\.test_get_total_without_filter_but_timestamp.*|test_policy\.PolicyFileTestCase\.test_modified_policy_reloads))'
endif
mkdir -p $(CURDIR)/debian/cloudkitty-common/usr/share/cloudkitty-common
PYTHONPATH=$(CURDIR)/debian/tmp/usr/lib/python3/dist-packages 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/collector/__init__.py $(CURDIR)/debian/tmp/usr/lib/python3/dist-packages/cloudkitty/collector
# 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 fetcher backend keystone
# Fixed using /etc/cloudkitty/policy.d
pkgos-fix-config-default $(CURDIR)/debian/cloudkitty-common/usr/share/cloudkitty-common/cloudkitty.conf oslo_policy policy_dirs /etc/cloudkitty/policy.d
mkdir -p $(CURDIR)/debian/cloudkitty-common/etc/cloudkitty/policy.d
PYTHONPATH=$(CURDIR)/debian/tmp/usr/lib/python3/dist-packages oslopolicy-sample-generator \
--output-file $(CURDIR)/debian/cloudkitty-common/etc/cloudkitty/policy.d/00_default_policy.yaml \
--format yaml \
--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.
set -e ; set -x ; if ! PYTHON=python3 python3 -m sphinx $(SPHINXOPTS) -b html doc/source $(CURDIR)/debian/cloudkitty-doc/usr/share/doc/cloudkitty-doc/html ; then \
cat /tmp/sphinx-err*.log ; \
exit 1 ; \
fi
rm -rf $(CURDIR)/debian/cloudkitty-doc/usr/share/doc/cloudkitty-doc/html/.doctrees
if [ -e $(CURDIR)/debian/cloudkitty-doc/usr/share/doc/cloudkitty-doc/html/_static ] ; then \
touch $(CURDIR)/debian/cloudkitty-doc/usr/share/doc/cloudkitty-doc/html/_static/toggle.js ; \
fi
dh_sphinxdoc
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
endif
override_dh_python3:
dh_python3 --shebang=/usr/bin/python3
|