File: rules

package info (click to toggle)
murano 1%3A3.0.0-6
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 9,320 kB
  • ctags: 4,297
  • sloc: python: 30,335; sh: 705; makefile: 79; ruby: 16
file content (105 lines) | stat: -rwxr-xr-x 5,133 bytes parent folder | download
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
#!/usr/bin/make -f

PYTHONS:=$(shell pyversions -vr)
PYTHON3S:=$(shell py3versions -vr)


LAST_CHANGE=$(shell dpkg-parsechangelog  | grep Date: | cut -d' ' -f2)
BUILD_DATE=$(shell LC_ALL=C date -u "+%B %d, %Y" -d "$(LAST_CHANGE)")
SPHINXOPTS := -D html_last_updated_fmt="$(BUILD_DATE)"

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/')

%:
	dh $@ --buildsystem=python_distutils --with python2,sphinxdoc,systemd

override_dh_auto_test:
ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
	echo "===> Running tests"
	set -e && for i in 2.7 ; do \
		PYMAJOR=`echo $$i | cut -d'.' -f1` ; \
		echo "===> Testing with python$$i (python$$PYMAJOR)" ; \
		rm -rf .testrepository ; \
		testr-python$$PYMAJOR init ; \
		TEMP_REZ=`mktemp -t` && \
		DISCOVER_DIRECTORY=$(CURDIR)/murano/tests/unit PYTHONPATH=$(CURDIR) PYTHON=python$$i DISCOVER_DIRECTORY=murano/tests/unit testr-python$$PYMAJOR run --subunit --parallel 'tests\.unit\.(?!(.*SysLogHandlersTestCase.*|.*packages\.hot_package\.test_hot_package\.TestHotPackage\.test_heat_files_generated.*))' | tee $$TEMP_REZ | subunit2pyunit ; \
		cat $$TEMP_REZ | subunit-filter -s --no-passthrough | subunit-stats ; \
		rm -f $$TEMP_REZ ; \
		testr-python$$PYMAJOR slowest ; \
	done
endif

override_dh_sphinxdoc:
ifeq (,$(findstring nodocs, $(DEB_BUILD_OPTIONS)))
	PYTHONPATH=. sphinx-build $(SPHINXOPTS) -b html doc/source $(CURDIR)/debian/murano-doc/usr/share/doc/murano-doc/html
	dh_sphinxdoc -O--buildsystem=python_distutils
endif

override_dh_auto_build:
	dh_auto_build
	/usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func murano-api.config
	/usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func murano-api.postinst
	/usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func murano-common.config
	/usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func murano-common.postinst

override_dh_install:
	dh_install -O--buildsystem=python_distutils --fail-missing

	# PBR misses some files, let's force them in
	cp -rf murano/* $(CURDIR)/debian/python-murano/usr/lib/python2.7/dist-packages/murano
	rm $(CURDIR)/debian/python-murano/usr/lib/python2.7/dist-packages/murano/tests/functional/engine/io.murano.apps.test.ApacheHttpServerCustom/LICENSE
	rm $(CURDIR)/debian/python-murano/usr/lib/python2.7/dist-packages/murano/tests/functional/engine/io.murano.apps.test.Lighttpd/LICENSE
	rm $(CURDIR)/debian/python-murano/usr/lib/python2.7/dist-packages/murano/tests/functional/engine/io.murano.apps.test.UpdateExecutor/LICENSE

	# Get the main config file to use decent defaults.
	mkdir -p $(CURDIR)/debian/murano-common/usr/share/murano-common
	oslo-config-generator --output-file $(CURDIR)/debian/murano-common/usr/share/murano-common/murano.conf \
		--wrap-width 140 \
		--namespace keystone_authtoken \
		--namespace murano \
		--namespace oslo.db \
		--namespace oslo.log \
		--namespace oslo.messaging \
		--namespace oslo.middleware.cors \
		--namespace oslo.policy \
		--namespace oslo.service.service

	sed -i 's/^[ \t#]*auth_protocol[ \t]*=[ \t].*/auth_protocol = http/' $(CURDIR)/debian/murano-common/usr/share/murano-common/murano.conf
	sed -i 's|^[# \t]*notification_driver[ \t]*=.*|notification_driver=messagingv2|' $(CURDIR)/debian/murano-common/usr/share/murano-common/murano.conf
	sed -i 's|#connection=<None>|connection=sqlite:///var/lib/murano/muranodb|' $(CURDIR)/debian/murano-common/usr/share/murano-common/murano.conf

	oslo-config-generator --output-file $(CURDIR)/debian/murano-common/usr/share/murano-common/murano-cfapi.conf \
		--wrap-width 140 \
		--namespace keystone_authtoken \
		--namespace murano.cfapi \
		--namespace oslo.db \
		--namespace oslo.log

	cp $(CURDIR)/etc/murano/murano-cfapi-paste.ini $(CURDIR)/debian/murano-common/usr/share/murano-common

	# Install other configuration files in a more "normal" way
	mkdir -p $(CURDIR)/debian/murano-common/etc/murano
	cp $(CURDIR)/etc/murano/logging.conf.sample $(CURDIR)/debian/murano-common/etc/murano/logging.conf
	cp $(CURDIR)/etc/murano/murano-paste.ini $(CURDIR)/etc/murano/policy.json $(CURDIR)/debian/murano-common/etc/murano

	# Also install alembic_migration folder
	set -e ; for pyvers in $(PYTHONS); do \
		cp -rfv $(CURDIR)/murano/db/migration/alembic_migrations $(CURDIR)/debian/python-murano/usr/lib/python$$pyvers/dist-packages/murano/db/migration/ ; \
	done

	# Zip the murano core-library and push it in the package.
	# Note that this is done in a reproducible way, adjusting timestamps
	# before zipping the files.
	find meta/io.murano -newermt '$(BUILD_DATE)' -print0 | xargs -0r touch --no-dereference --date='$(BUILD_DATE)'
	cd meta/io.murano ; TZ=UTC zip -r ../../debian/murano-common/usr/share/murano-common/io.murano.zip * ; cd ../..

override_dh_clean:
	rm -rf 	build \
	 	debian/murano-common.postinst \
		debian/murano-common.config \
		debian/murano-api.postinst \
		debian/murano-api.config \
		doc/build/man
	rm -f debian/*.init debian/*.service debian/*.upstart
	dh_clean -O--buildsystem=python_distutils