Remove tests stuff
[openstack-build/neutron-build.git] / trusty / debian / rules
index 748eaad56f19aeb7dadeee14f866506128ea2d19..2daf47adb4b7a351343f9f4cbbb59141da4e4dd7 100755 (executable)
 #!/usr/bin/make -f
 
-# Uncomment this to turn on verbose mode.
-#export DH_VERBOSE=1
+include /usr/share/openstack-pkg-tools/pkgos.make
+export OSLO_PACKAGE_VERSION=$(shell dpkg-parsechangelog | grep Version: | cut -d' ' -f2 | sed -e 's/^[[:digit:]]*://' -e 's/[-].*//' -e 's/~/.0/' | head -n 1)
+
+PYTHONS:=$(shell pyversions -vr)
 
 %:
-       dh $@  --with python2
+       dh $@ --buildsystem=python_distutils --with python2,systemd,sphinxdoc
+
+override_dh_auto_install:
+       echo "Do nothing"
 
 override_dh_install:
-       dh_install --fail-missing -X/usr/etc -X/usr/bin/neutron-hyperv-agent
+       rm -rf $(CURDIR)/debian/tmp
+       python2.7 setup.py install --install-layout=deb --root=$(CURDIR)/debian/tmp
+       cp -auxf neutron $(CURDIR)/debian/tmp/usr/lib/python2.7/dist-packages
+       rm -rf $(CURDIR)/debian/tmp/usr/etc
+
+       # dhcp_agent.ini
+       mkdir -p $(CURDIR)/debian/neutron-dhcp-agent/etc/neutron
+       PYTHONPATH=$(CURDIR)/debian/tmp/usr/lib/python2.7/dist-packages oslo-config-generator --output-file $(CURDIR)/debian/neutron-dhcp-agent/etc/neutron/dhcp_agent.ini \
+               --wrap-width 140 \
+               --namespace neutron.base.agent \
+               --namespace neutron.dhcp.agent \
+               --namespace oslo.log
+
+       # l3_agent.ini
+       mkdir -p $(CURDIR)/debian/neutron-l3-agent/etc/neutron
+       PYTHONPATH=$(CURDIR)/debian/tmp/usr/lib/python2.7/dist-packages oslo-config-generator --output-file $(CURDIR)/debian/neutron-l3-agent/etc/neutron/l3_agent.ini \
+               --wrap-width 140 \
+               --namespace neutron.base.agent \
+               --namespace neutron.l3.agent \
+               --namespace oslo.log
+
+       # linuxbridge_agent.ini
+       mkdir -p $(CURDIR)/debian/neutron-linuxbridge-agent/etc/neutron/plugins/ml2
+       PYTHONPATH=$(CURDIR)/debian/tmp/usr/lib/python2.7/dist-packages oslo-config-generator --output-file $(CURDIR)/debian/neutron-linuxbridge-agent/etc/neutron/plugins/ml2/linuxbridge_agent.ini \
+               --wrap-width 140 \
+               --namespace neutron.ml2.linuxbridge.agent \
+               --namespace oslo.log
+
+       # metadata_agent.ini
+       mkdir -p $(CURDIR)/debian/neutron-metadata-agent/usr/share/neutron-metadata-agent
+       PYTHONPATH=$(CURDIR)/debian/tmp/usr/lib/python2.7/dist-packages oslo-config-generator --output-file $(CURDIR)/debian/neutron-metadata-agent/usr/share/neutron-metadata-agent/metadata_agent.ini \
+               --wrap-width 140 \
+               --namespace neutron.metadata.agent \
+               --namespace oslo.log
+
+       # metering_agent.ini
+       mkdir -p $(CURDIR)/debian/neutron-metering-agent/etc/neutron
+       PYTHONPATH=$(CURDIR)/debian/tmp oslo-config-generator --output-file $(CURDIR)/debian/neutron-metering-agent/etc/neutron/metering_agent.ini \
+               --wrap-width 140 \
+               --namespace neutron.metering.agent \
+               --namespace oslo.log
+
+       # ml2_conf.ini
+       mkdir -p $(CURDIR)/debian/neutron-common/etc/neutron/plugins/ml2
+       PYTHONPATH=$(CURDIR)/debian/tmp/usr/lib/python2.7/dist-packages oslo-config-generator --output-file $(CURDIR)/debian/neutron-common/etc/neutron/plugins/ml2/ml2_conf.ini \
+               --wrap-width 140 \
+               --namespace neutron.ml2 \
+               --namespace oslo.log
+
+       # ml2_conf_sriov.ini
+       PYTHONPATH=$(CURDIR)/debian/tmp/usr/lib/python2.7/dist-packages oslo-config-generator --output-file $(CURDIR)/debian/neutron-common/etc/neutron/plugins/ml2/ml2_conf_sriov.ini \
+               --wrap-width 140 \
+               --namespace neutron.ml2.sriov \
+               --namespace oslo.log
 
-override_dh_installinit:
-       dh_installinit
-       dh_installinit -pneutron-plugin-openvswitch-agent --no-start --name=neutron-ovs-cleanup
+       # neutron.conf
+       mkdir -p $(CURDIR)/debian/neutron-common/usr/share/neutron-common
+       PYTHONPATH=$(CURDIR)/debian/tmp/usr/lib/python2.7/dist-packages oslo-config-generator --output-file $(CURDIR)/debian/neutron-common/usr/share/neutron-common/neutron.conf \
+               --wrap-width 140 \
+               --namespace neutron \
+               --namespace neutron.agent \
+               --namespace neutron.db \
+               --namespace neutron.extensions \
+               --namespace neutron.qos \
+               --namespace nova.auth \
+               --namespace oslo.log \
+               --namespace oslo.db \
+               --namespace oslo.policy \
+               --namespace oslo.concurrency \
+               --namespace oslo.messaging \
+               --namespace oslo.middleware.cors \
+               --namespace oslo.service.sslutils \
+               --namespace oslo.service.wsgi \
+               --namespace keystonemiddleware.auth_token
+
+
+       # openvswitch_agent.ini
+       mkdir -p $(CURDIR)/debian/neutron-common/usr/share/neutron-common
+       PYTHONPATH=$(CURDIR)/debian/tmp/usr/lib/python2.7/dist-packages oslo-config-generator --output-file $(CURDIR)/debian/neutron-common/usr/share/neutron-common/openvswitch_agent.ini \
+               --wrap-width 140 \
+               --namespace neutron.ml2.ovs.agent \
+               --namespace oslo.log
+
+       # sriov_agent.ini
+       mkdir -p $(CURDIR)/debian/neutron-common/etc/neutron/plugins/ml2
+       PYTHONPATH=$(CURDIR)/debian/tmp/usr/lib/python2.7/dist-packages oslo-config-generator --output-file $(CURDIR)/debian/neutron-common/etc/neutron/plugins/ml2/sriov_agent.ini \
+               --wrap-width 140 \
+               --namespace neutron.ml2.sriov.agent \
+               --namespace oslo.log
+
+       dh_install --fail-missing -X/usr/etc
 
 override_dh_auto_clean:
+       dh_auto_clean
+       find . -type f -name "*.pyc" | xargs rm -fr
+       rm -rf build neutron.egg-info
+       rm -f debian/neutron-common.config \
+               debian/neutron-common.postinst \
+               debian/neutron-server.config \
+               debian/neutron-server.postinst \
+               debian/neutron-dhcp-agent.postinst \
+               debian/neutron-metadata-agent.config \
+               debian/neutron-metadata-agent.postinst
+       rm -f debian/*.init debian/*.service debian/*.upstart
+
+override_dh_clean:
        dh_clean
+       find . -type f -name "*.pyc" -delete
 
 override_dh_auto_test:
-ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
-       # Unpatch quantum configuration to fixup tests which conflict
-       # with a core_plugin being set.
-       patch -p1 -R < debian/patches/fix-neutron-configuration.patch
-       # Set a reasonable level of concurrency
-       ./run_tests.sh -N -P --concurrency=4
-       # Patch configuration file after testing
-       patch -p1 < debian/patches/fix-neutron-configuration.patch
+ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
+       PYTHONPATH=build/* ./run_tests.sh -N -P
 endif
 
+override_dh_auto_build:
+       dh_auto_build -O--buildsystem=python_distutils
+
+       /usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func neutron-common.config
+       /usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func neutron-common.postinst
+       /usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func neutron-server.config
+       /usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func neutron-server.postinst
+       /usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func neutron-dhcp-agent.postinst
+       /usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func neutron-metadata-agent.postinst
+       /usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func neutron-metadata-agent.config
+
+override_dh_sphinxdoc:
+ifeq (,$(findstring nodocs, $(DEB_BUILD_OPTIONS)))
+       python setup.py build_sphinx
+       cp -rf doc/build/html $(CURDIR)/debian/neutron-doc/usr/share/doc/neutron-doc
+       dh_sphinxdoc -O--buildsystem=python_distutils
+endif