File: rules

package info (click to toggle)
placement 13.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,360 kB
  • sloc: python: 17,532; sh: 310; makefile: 61; pascal: 30
file content (95 lines) | stat: -rwxr-xr-x 3,869 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
#!/usr/bin/make -f

include /usr/share/openstack-pkg-tools/pkgos.make

PLACEMENT_CONF=$(CURDIR)/debian/placement-common/usr/share/placement-common/placement.conf

%:
	dh $@ --buildsystem=pybuild --with python3,sphinxdoc

override_dh_auto_clean:
	rm -f debian/placement-common.config debian/placement-common.postinst debian/placement-common.postrm debian/placement-api.config debian/placement-api.postinst
	rm -f debian/*.init debian/*.upstart debian/*.service debian/*.templates
	rm -rf build doc/source/_static/*.sample *.egg-info .stestr debian/po
	find . -iname '*.pyc' -delete
	for i in $$(find . -type d -iname __pycache__) ; do rm -rf $$i ; done

override_dh_auto_test:
	echo "Do nothing..."

override_dh_auto_install:
	echo "Do nothing..."

override_dh_auto_build:
	/usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func placement-common.config
	/usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func placement-common.postinst
	/usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func placement-api.config
	/usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func placement-api.postinst
	/usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_postrm placement-common.postrm
	pkgos-merge-templates placement-api placement endpoint
	pkgos-merge-templates placement-common placement db ksat

override_dh_install:
	pkgos-dh_auto_install --no-py2 --in-tmp

ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
	pkgos-dh_auto_test --no-py2 'placement\.tests\.unit\.(?!cmd\.test_manage\.TestCommandParsers\.test_too_many_args)'
endif

	# Generate all config files
	mkdir -p $(CURDIR)/debian/placement-common/usr/share/placement-common
	PYTHONPATH=$(CURDIR)/debian/tmp/usr/lib/python3/dist-packages oslo-config-generator \
		--output-file $(PLACEMENT_CONF) \
		--namespace placement.conf \
		--namespace keystonemiddleware.auth_token \
		--namespace oslo.log \
		--namespace oslo.middleware.cors \
		--namespace oslo.middleware.http_proxy_to_wsgi \
		--namespace oslo.policy \
		--namespace osprofiler

	mkdir -p $(CURDIR)/debian/placement-common/etc/placement/policy.d
	PYTHONPATH=$(CURDIR)/debian/tmp/usr/lib/python3/dist-packages oslopolicy-sample-generator \
                --output-file=$(CURDIR)/debian/placement-common/etc/placement/policy.d/00_default_policy.yaml \
                --format yaml \
		--namespace placement

	# Comment out deprecated policies
	sed -i 's/^"/#"/' $(CURDIR)/debian/placement-common/etc/placement/policy.d/00_default_policy.yaml


	# Comment out deprecated policies, otherwise, Placement doesn't work
	sed -i 's/^"/#"/' $(CURDIR)/debian/placement-common/etc/placement/policy.d/00_default_policy.yaml

	# Use the policy.d folder
	pkgos-fix-config-default $(CURDIR)/debian/placement-common/usr/share/placement-common/placement.conf oslo_policy policy_dirs /etc/placement/policy.d

	# Fix config default value
	# Add missing options to keystone_authtoken
	pkgos-readd-keystone-authtoken-missing-options $(PLACEMENT_CONF) keystone_authtoken placement
	pkgos-fix-config-default $(PLACEMENT_CONF) DEFAULT pybasedir /usr/lib/python3/dist-packages

	# Add mysql-migrate-db.sh script to package if present
	if [ -e $(CURDIR)/tools/mysql-migrate-db.sh ]; then \
		cp $(CURDIR)/tools/mysql-migrate-db.sh \
		$(CURDIR)/debian/placement-common/usr/share/placement-common/mysql-migrate-db.sh ; \
	fi

	rm -rf $(CURDIR)/debian/tmp/usr/etc
	dh_install
	dh_missing --fail-missing

override_dh_sphinxdoc:
ifeq (,$(findstring nodocs, $(DEB_BUILD_OPTIONS)))
	PYTHON=python3 python3 -m sphinx -b html doc/source $(CURDIR)/debian/placement-doc/usr/share/doc/placement-doc/html
	dh_sphinxdoc
endif

#override_dh_installman:
#ifeq (,$(findstring nodocs, $(DEB_BUILD_OPTIONS)))
#	python3 -m sphinx $(SPHINXOPTS) -b man doc/source doc/build/man
#	dh_installman
#endif

override_dh_python3:
	dh_python3 --shebang=/usr/bin/python3