summaryrefslogtreecommitdiffstats
path: root/debian/rules
blob: 68d5ce68c35d6e5cd0890363982f80bc4d5842d8 (plain)
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
#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
include /usr/share/dpkg/pkg-info.mk
include /usr/share/dpkg/architecture.mk

# Fix FTBFS in s390x with GCC 12
ifeq ($(DEB_HOST_ARCH),s390x)
export DEB_CFLAGS_MAINT_APPEND=-Wno-stringop-truncation
endif

%:
	dh $@ --with python3

override_dh_autoreconf:
	# fix version reported by agents
	echo $(DEB_VERSION_UPSTREAM) > .tarball-version
	dh_autoreconf ./autogen.sh

override_dh_auto_configure:
	dh_auto_configure -- \
		--libexecdir=/usr/libexec/fence-agents \
		--with-fencetmpdir=/run/fence-agents \
		PING_CMD=/bin/ping \
		PING6_CMD=/bin/ping6 \
		PING4_CMD="/bin/ping -4" \
		PYTHON=/usr/bin/python3 \
		SBD_PATH=/usr/sbin/sbd \
		VGS_PATH=/sbin/vgs

override_dh_auto_build:
	LC_ALL=C dh_auto_build

override_dh_auto_install:
	$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp

override_dh_install:
	rm -v debian/tmp/usr/share/doc/fence-agents/COPY*
	rm -v debian/tmp/usr/share/doc/fence-agents/README.licence
	rmdir debian/tmp/usr/share/doc/fence-agents
	dh_install
	install -m 755 -D agents/vmware/fence_vmware_helper.pl debian/fence-agents-vmware/usr/libexec/fence-agents/fence_vmware_helper
	# we test in tmp after install so the .pyc files generated don't make it into the package
	for agent in debian/*/usr/sbin/*; do \
		case $${agent##*/} in fence_ack_manual|fence_virt*|fence_xvm) continue;; esac; \
		echo "Testing $$agent"; \
		PYTHONPATH=debian/tmp/usr/share/fence $$agent --help >/dev/null || exit; \
	done

# tests are slow and require network access so moved to debian/tests/{delay,metadata}
override_dh_auto_test:

override_dh_python3:
	dh_python3
	dh_python3 /usr/share/fence

override_dh_installsystemd:
	mkdir -p debian/fence-virtd/lib/systemd/system/
	cp agents/virt/fence_virtd.service debian/fence-virtd/lib/systemd/system/
	dh_installsystemd -pfence-virtd

override_dh_installinit:
	dh_installinit -pfence-virtd --name=fence_virtd

override_dh_missing:
	rm debian/tmp/usr/lib/*/fence-virt/*.*a
	rm -r debian/tmp/usr/share/fence/__pycache__

	dh_missing --fail-missing