File: rules

package info (click to toggle)
watcher 0.30.0-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 3,788 kB
  • ctags: 4,126
  • sloc: python: 26,555; sh: 255; makefile: 60
file content (79 lines) | stat: -rwxr-xr-x 3,259 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
#!/usr/bin/make -f

include /usr/share/openstack-pkg-tools/pkgos.make
export OSLO_PACKAGE_VERSION=$(shell dpkg-parsechangelog -SVersion | sed -e 's/^[[:digit:]]*://' -e 's/[-].*//' -e 's/~/.0/' | head -n 1)

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

override_dh_clean:
	dh_clean
	rm -f debian/watcher-common.config debian/watcher-common.postinst debian/watcher-api.config debian/watcher-api.postinst
	rm -rf debian/*.upstart debian/*.service

override_dh_auto_build:
	dh_auto_build -O--buildsystem=python_distutils

	/usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func watcher-common.config
	/usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func watcher-common.postinst
	/usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func watcher-api.config
	/usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func watcher-api.postinst

override_dh_auto_install:
	echo "Do nothing..."

override_dh_install:
	python2.7 setup.py install --install-layout=deb --root $(CURDIR)/debian/tmp

	rm -rf $(CURDIR)/debian/tmp/usr/etc

	mkdir -p $(CURDIR)/debian/watcher-common/usr/share/watcher-common
	PYTHONPATH=$(CURDIR)/debian/tmp/usr/lib/python2.7/dist-packages oslo-config-generator \
		--output-file $(CURDIR)/debian/watcher-common/usr/share/watcher-common/watcher.conf \
		--wrap-width 140 \
		--namespace watcher \
		--namespace keystonemiddleware.auth_token \
		--namespace oslo.cache \
		--namespace oslo.concurrency \
		--namespace oslo.db \
		--namespace oslo.log \
		--namespace oslo.messaging \
		--namespace oslo.policy \
		--namespace oslo.reports \
		--namespace oslo.service.periodic_task \
		--namespace oslo.service.service \
		--namespace oslo.service.wsgi

	pkgos-fix-config-default $(CURDIR)/debian/watcher-common/usr/share/watcher-common/watcher.conf oslo_concurrency lock_path /var/lock/watcher

	dh_install --fail-missing

	# Disable https in default setup, as this makes our CI fail
	pkgos-fix-config-default $(CURDIR)/debian/watcher-common/usr/share/watcher-common/watcher.conf keystone_authtoken auth_protocol http

	# Fix the missing sql_connection directive
	pkgos-fix-config-default $(CURDIR)/debian/watcher-common/usr/share/watcher-common/watcher.conf database sqlite:////var/lib/watcher/watcherdb

override_dh_auto_test:
ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
	@echo "===> Running tests"
	set -e ; set -x ; 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` ; \
		PYTHONPATH=$(CURDIR) PYTHON=python$$i testr-python$$PYMAJOR run --subunit 'watcher\.tests\.(?!.*api\.test_hooks\.TestContextHook\.test_context_hook_before_method.*)' | 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/watcher-doc/usr/share/doc/watcher-doc/html
	touch $(CURDIR)/debian/watcher-doc/usr/share/doc/watcher-doc/html/_static/toggle.js
	dh_sphinxdoc
endif