summaryrefslogtreecommitdiff
path: root/rules
blob: 00354e375f23d699391925cdc39b009f0c0e075d (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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/usr/bin/make -f
# -*- makefile -*-

#export DH_VERBOSE=1
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

%:
	dh $@ --with python3,sphinxdoc

override_dh_auto_build: build_cython build_sphinx build_python

build_cython:
	dh_testdir
	python3 setup.py build_cython
	touch $@

build_sphinx: build_inplace
	dh_testdir
	python3 setup.py build_sphinx
	touch $@

build_inplace: build_cython
	python3 setup.py build_ext --inplace
	touch $@

build_python: build_cython
	dh_testdir
	python3-dbg setup.py build -g
	python3 setup.py build -g
	touch $@

override_dh_auto_install:
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs

	# Note: Install non -dbg last, so that scripts don't get a -dbg interpreter
	python3-dbg setup.py install --force --root=debian/tmp \
               --install-lib=/usr/lib/s3ql \
               --install-scripts=/usr/lib/s3ql \
               --no-compile -O0 --install-layout=deb

	python3 setup.py install --force --root=debian/tmp \
               --install-lib=/usr/lib/s3ql \
               --install-scripts=/usr/lib/s3ql \
               --no-compile -O0 --install-layout=deb

override_dh_auto_test:
ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
	python3 setup.py build_ext --inplace
	# Some tests will try to create log files in $HOME
	mkdir -p debian/tmphome
	HOME=$(CURDIR)/debian/tmphome py.test-3 --logdebug=s3ql.verify tests/
endif

override_dh_install:
	dh_install

	# Rename to avoid conflict with pcp package
	(cd debian/s3ql/usr/share/man/man1/; mv pcp.1 parallel-cp.1)

	# Install debugging extension and remove from regular package
	(cd debian/s3ql; \
	    find . -regextype posix-egrep -regex ".+\\.[a-z]+-[0-9]{2,}[a-z]*d[a-z]*-$(DEB_HOST_MULTIARCH)\\.so" \
	           -printf "%P\0" -delete) \
	| xargs -0 dh_install --autodest -ps3ql-dbg

	# Link all executable files not ending in .py into /usr/bin 
	mkdir -p debian/s3ql/usr/bin/
	for entry in debian/s3ql/usr/lib/s3ql/*; do \
	    if [ -d "$$entry" ] || [ ! -x "$$entry" ] \
               || [ "$${entry%.py}" != "$$entry" ]; then \
               continue; \
            fi; \
            ln -s ../lib/s3ql/`basename "$$entry"` \
                  "debian/s3ql/usr/bin/`basename \"$$entry\"`"; \
        done

override_dh_link:
	rm -rf debian/s3ql-dbg/usr/share/doc/s3ql-dbg
	dh_link


# We don't want to call setup.py clean, because this
# requires a number of (potentially uninstalled) build-dependencies.
override_dh_auto_clean:
	rm -rf build doc tests/test.log src/s3ql/deltadump.c contrib/*.1
	find \( \( -name '*.egg-info' -type d \) \
	     -o \( -name __pycache__  -type d \) \
	     -o \( -name '*.so' -type f \) \
	     \) -prune -exec rm -rf '{}' +
	rm -rf build-python build_cython build_sphinx build-stamp
	rm -rf debian/tmphome

override_dh_strip:
ifeq (,$(filter nostrip,$(DEB_BUILD_OPTIONS)))
	dh_strip -ps3ql --dbg-package=s3ql-dbg
endif

.PHONY: get-orig-source
get-orig-source:
	# Work around bug #749225
	PERL_LWP_SSL_VERIFY_HOSTNAME=0 \
	uscan --rename --destdir=$(CURDIR)/.. --repack --force-download \
	      --download-current-version --compression xz

.PHONY: uscan
uscan:
	# Work around bug #749225
	PERL_LWP_SSL_VERIFY_HOSTNAME=0 \
	uscan --rename --destdir=$(CURDIR)/.. --repack --compression xz