Fixed create dirs before calling oslo-config-generator
[openstack-build/neutron-build.git] / 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 PYTHONS:=$(shell pyversions -vr)
7
8 %:
9         dh $@ --buildsystem=python_distutils --with python2,systemd
10
11 override_dh_auto_install:
12         python2.7 setup.py install --install-layout=deb --root=$(CURDIR)/debian/tmp
13         cp -auxf neutron $(CURDIR)/debian/tmp/usr/lib/python2.7/dist-packages
14         rm -rf $(CURDIR)/debian/tmp/usr/etc
15
16 override_dh_install:
17         dh_install --fail-missing -X/usr/etc -X/usr/bin
18
19         mkdir -p $(CURDIR)/debian/neutron-dhcp-agent/etc/neutron
20         oslo-config-generator --output-file $(CURDIR)/debian/neutron-dhcp-agent/etc/neutron/dhcp_agent.ini \
21                 --wrap-width 140 \
22                 --namespace neutron.base.agent \
23                 --namespace neutron.dhcp.agent \
24                 --namespace oslo.log
25         mkdir -p $(CURDIR)/debian/neutron-l3-agent/etc/neutron
26         oslo-config-generator --output-file $(CURDIR)/debian/neutron-l3-agent/etc/neutron/l3_agent.ini \
27                 --wrap-width 140 \
28                 --namespace neutron.base.agent \
29                 --namespace neutron.l3.agent \
30                 --namespace oslo.log
31         mkdir -p $(CURDIR)/debian/neutron-linuxbridge-agent/etc/neutron/plugins/ml2
32         oslo-config-generator --output-file $(CURDIR)/debian/neutron-linuxbridge-agent/etc/neutron/plugins/ml2/linuxbridge_agent.ini \
33                 --wrap-width 140 \
34                 --namespace neutron.ml2.linuxbridge.agent \
35                 --namespace oslo.log
36         mkdir -p $(CURDIR)/debian/neutron-metadata-agent/usr/share/neutron-metadata-agent
37         oslo-config-generator --output-file $(CURDIR)/debian/neutron-metadata-agent/usr/share/neutron-metadata-agent/metadata_agent.ini \
38                 --wrap-width 140 \
39                 --namespace neutron.metadata.agent \
40                 --namespace oslo.log
41         sed -i -e 's|^# nova_metadata_ip = 127.0.0.1|nova_metadata_ip = 127.0.0.1|'     $(CURDIR)/debian/neutron-metadata-agent/usr/share/neutron-metadata-agent/metadata_agent.ini
42         mkdir -p $(CURDIR)/debian/neutron-metering-agent/etc/neutron
43         oslo-config-generator --output-file $(CURDIR)/debian/neutron-metering-agent/etc/neutron/metering_agent.ini \
44                 --wrap-width 140 \
45                 --namespace neutron.metering.agent \
46                 --namespace oslo.log
47         mkdir -p $(CURDIR)/debian/neutron-common/etc/neutron/plugins/ml2
48         oslo-config-generator --output-file $(CURDIR)/debian/neutron-common/etc/neutron/plugins/ml2/ml2_conf.ini \
49                 --wrap-width 140 \
50                 --namespace neutron.ml2 \
51                 --namespace oslo.log
52         oslo-config-generator --output-file $(CURDIR)/debian/neutron-common/etc/neutron/plugins/ml2/ml2_conf_sriov.ini \
53                 --wrap-width 140 \
54                 --namespace neutron.ml2.sriov \
55                 --namespace oslo.log
56         mkdir -p $(CURDIR)/debian/neutron-common/usr/share/neutron-common
57         oslo-config-generator --output-file $(CURDIR)/debian/neutron-common/usr/share/neutron-common/neutron.conf \
58                 --wrap-width 140 \
59                 --namespace neutron \
60                 --namespace neutron.agent \
61                 --namespace neutron.db \
62                 --namespace neutron.extensions \
63                 --namespace neutron.qos \
64                 --namespace nova.auth \
65                 --namespace oslo.log \
66                 --namespace oslo.db \
67                 --namespace oslo.policy \
68                 --namespace oslo.concurrency \
69                 --namespace oslo.messaging \
70                 --namespace oslo.middleware.cors \
71                 --namespace oslo.service.sslutils \
72                 --namespace oslo.service.wsgi \
73                 --namespace keystonemiddleware.auth_token
74         mkdir -p $(CURDIR)/debian/neutron-common/usr/share/neutron-common
75         oslo-config-generator --output-file $(CURDIR)/debian/neutron-common/usr/share/neutron-common/openvswitch_agent.ini \
76                 --wrap-width 140 \
77                 --namespace neutron.ml2.ovs.agent \
78                 --namespace oslo.log
79         mkdir -p $(CURDIR)/debian/neutron-common/etc/neutron/plugins/ml2
80         oslo-config-generator --output-file $(CURDIR)/debian/neutron-common/etc/neutron/plugins/ml2/sriov_agent.ini \
81                 --wrap-width 140 \
82                 --namespace neutron.ml2.sriov.agent \
83                 --namespace oslo.log
84         
85 override_dh_auto_clean:
86         dh_auto_clean
87         find . -type f -name "*.pyc" | xargs rm -fr
88         rm -rf build neutron.egg-info
89         rm -f debian/neutron-common.config \
90                 debian/neutron-common.postinst \
91                 debian/neutron-server.config \
92                 debian/neutron-server.postinst \
93                 debian/neutron-dhcp-agent.postinst \
94                 debian/neutron-metadata-agent.config \
95                 debian/neutron-metadata-agent.postinst
96         rm -f debian/*.init debian/*.service debian/*.upstart
97
98 override_dh_clean:
99         dh_clean
100         find . -type f -name "*.pyc" -delete
101
102 override_dh_auto_test:
103 ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
104         PYTHONPATH=build/* ./run_tests.sh -N -P || true
105 endif
106
107 override_dh_auto_build:
108         dh_auto_build -O--buildsystem=python_distutils
109
110         /usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func neutron-common.config
111         /usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func neutron-common.postinst
112         /usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func neutron-server.config
113         /usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func neutron-server.postinst
114         /usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func neutron-dhcp-agent.postinst
115         /usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func neutron-metadata-agent.postinst
116         /usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func neutron-metadata-agent.config