Update after bug:1515255
[openstack-build/cinder-build.git] / trusty / debian / rules
1 #!/usr/bin/make -f
2
3 include /usr/share/openstack-pkg-tools/pkgos.make
4 export OSLO_PACKAGE_VERSION=$(shell dpkg-parsechangelog | grep Version: | cut -d' ' -f2 | sed -e 's/^[[:digit:]]*://' -e 's/[-].*//' -e 's/~/.0/' | head -n 1)
5
6 %:
7         dh $@ --buildsystem=python_distutils --with python2,systemd,sphinxdoc
8
9 override_dh_auto_test:
10 ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
11         @echo "===> Running tests"
12         set -e ; set -x ; for i in 2.7 ; do \
13                 PYMAJOR=`echo $$i | cut -d'.' -f1` ; \
14                 echo "===> Testing with python$$i (python$$PYMAJOR)" ; \
15                 rm -rf .testrepository ; \
16                 testr-python$$PYMAJOR init ; \
17                 TEMP_REZ=`mktemp -t` ; \
18                 PYTHONPATH=$(CURDIR) PYTHON=python$$i testr-python$$PYMAJOR run --subunit | tee $$TEMP_REZ | subunit2pyunit ; \
19                 cat $$TEMP_REZ | subunit-filter -s --no-passthrough | subunit-stats ; \
20                 rm -f $$TEMP_REZ ; \
21                 testr-python$$PYMAJOR slowest ; \
22         done
23 endif
24
25 override_dh_clean:
26         dh_clean -O--buildsystem=python_distutils
27         rm -f debian/cinder-common.config debian/cinder-common.postinst debian/cinder-api.config debian/cinder-api.postinst debian/cinder-volume.postinst
28         rm -rf debian/*.upstart debian/*.service
29
30 override_dh_install:
31         dh_install --fail-missing -Xbin/cinder-all
32         install -D -m 0440 debian/cinder-common.sudoers $(CURDIR)/debian/cinder-common/etc/sudoers.d/cinder-common
33
34         oslo-config-generator --output-file $(CURDIR)/etc/cinder/cinder.conf.sample \
35                 --wrap-width 140 \
36                 --namespace cinder \
37                 --namespace oslo_concurrency \
38                 --namespace oslo_db \
39                 --namespace oslo_messaging \
40                 --namespace cinder.policy \
41                 --namespace keystonemiddleware.auth_token \
42                 --namespace cinder.openstack.common.eventlet_backdoor \
43                 --namespace cinder.openstack.common.log \
44                 --namespace cinder.openstack.common.periodic_task \
45                 --namespace cinder.openstack.common.policy \
46                 --namespace oslo_db.concurrency
47         install -D -m 0644 $(CURDIR)/etc/cinder/cinder.conf.sample $(CURDIR)/debian/cinder-common/usr/share/cinder-common/cinder.conf
48
49         # Disable https in default setup, as this makes our CI fail
50         sed -i 's/#auth_protocol=https/auth_protocol=http/' $(CURDIR)/debian/cinder-common/usr/share/cinder-common/cinder.conf
51
52         # Default to keystone auth
53         sed -i "s/#auth_strategy=noauth/auth_strategy=keystone/" $(CURDIR)/debian/cinder-common/usr/share/cinder-common/cinder.conf
54
55         # Write only in /var/lib/cinder please
56         sed -i 's|#state_path=$pybasedir|state_path=/var/lib/cinder|' $(CURDIR)/debian/cinder-common/usr/share/cinder-common/cinder.conf
57
58         # Fix the missing sql_connection directive
59         echo "# Connection to db:" >>$(CURDIR)/debian/cinder-common/usr/share/cinder-common/cinder.conf
60         echo "sql_connection = sqlite:////var/lib/cinder/cinderdb" >>$(CURDIR)/debian/cinder-common/usr/share/cinder-common/cinder.conf
61
62         install -D -m 0644 $(CURDIR)/etc/cinder/logging_sample.conf $(CURDIR)/debian/cinder-common/usr/share/cinder-common/logging.conf
63
64 override_dh_fixperms:
65         dh_fixperms -Xcinder_tgt.conf
66         chmod 0440 $(CURDIR)/debian/cinder-common/etc/sudoers.d/cinder-common
67
68 override_dh_auto_build:
69         dh_auto_build -O--buildsystem=python_distutils
70
71         /usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func cinder-common.config
72         /usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func cinder-common.postinst
73         /usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func cinder-api.config
74         /usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func cinder-api.postinst
75         /usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func cinder-volume.postinst
76
77 override_dh_sphinxdoc:
78 ifeq (,$(findstring nodocs, $(DEB_BUILD_OPTIONS)))
79         python setup.py build_sphinx
80         cp -rf doc/build/html $(CURDIR)/debian/cinder-doc/usr/share/doc/cinder-doc
81         dh_sphinxdoc -O--buildsystem=python_distutils
82 endif