summaryrefslogtreecommitdiff
path: root/debian/rules
blob: d638e5dfcc569095631cecaad4fd9c83070091f9 (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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/usr/bin/make -f

#export DH_VERBOSE=1


# Do not install the borg package into the usual Python path:
#  * Upstream does not consider its API stable.
#  * We want to coinstall multiple versions of borg.
VERSION_SUFFIX=2
MODULE_DIR=/usr/lib/borgbackup$(VERSION_SUFFIX)
PACKAGE=borgbackup$(VERSION_SUFFIX)

# Full hardening for the cython build.
export DEB_BUILD_MAINT_OPTIONS=hardening=+all

# pybuild: use pytest instead of auto-detection
#
# The autodetection failed on jessie, resulting in a failed
# build, since unittest does not support pytest's command
# line switches
export PYBUILD_TEST_PYTEST=1

# Command line arguments to pytest
#
# We cannot rely on the buildds allowing fuse to be
# used, so we disable the fuse-mount tests.
export PYBUILD_TEST_ARGS=\
	-k 'not fuse_mount and not test_fuse and not test_readonly_mount and not test_migrate_lock_alive' \
	--pyargs borg.testsuite

# To display coverage information, add the following
# switches to PYBUILD_TEST_ARGS (Upstream does this)
#
# Note that this currently breaks unittests on jessie,
# because borg will trip over the unexpected coverage
# files.  Since this failure does not occur in stretch,
# this is likely due to an outdated version in jessie.
#
# --cov=borg --cov-config=../.coveragerc

%:
	dh $@ --buildsystem=pybuild

override_dh_clean:
	dh_clean
	# make sure system libraries are used
	find . -name blake2.h -delete
	find . -name lz4.h -delete
	find . -name zstd.h -delete
	find . -name xxhash.h -delete
	find . -name xxhash.c -delete

override_dh_auto_configure:
	dh_auto_configure -- --install-dir=$(MODULE_DIR)

override_dh_installdocs:
	python3 setup.py build_ext --inplace
	$(MAKE) -C docs html
	dh_installdocs

override_dh_installman:
	python3 setup.py build_ext --inplace
	$(MAKE) -C docs man
	dh_installman

#override_dh_auto_install:
#	dh_auto_install
#	#removing bundled msgpack directory
#	rm -rf debian/tmp/usr/lib/python3*/dist-packages/borg/algorithms/msgpack

# Run dh_auto_test in a fakeroot environment, this will
# disable some feature tests from upstream that are not
# guaranteed to work on a buildd anyway, like acls.
#
# Also, make sure the compiled cython files are present
# in-place, to allow the tests to find them.
override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	python3 setup.py build_ext --inplace
	LC_ALL=C.UTF-8 fakeroot dh_auto_test
endif

execute_after_dh_install-arch:
	set -e; for f in debian/$(PACKAGE)/usr/bin/*; do \
		sed -i -e '5asys.path.insert(0, "$(MODULE_DIR)")' "$$f"; \
	done

# Do not compress .ico file (affects html documentation)
override_dh_compress:
	dh_compress -X.ico -Xfonts