File: rules

package info (click to toggle)
breezy 3.0.0~bzr7290-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 39,840 kB
  • sloc: python: 252,375; ansic: 2,772; makefile: 400; sh: 284; lisp: 107
file content (135 lines) | stat: -rwxr-xr-x 4,941 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#!/usr/bin/make -f

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

# Get the default Python version
PYVERSION = $(shell pyversions -d -v)
PY3VERSION = $(shell py3versions -d -v)

export PYBUILD_NAME=breezy

%:
	dh $* --with python2,python3,sphinxdoc,bash_completion  --buildsystem=pybuild

ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
CONCURRENCY = BRZ_CONCURRENCY=$(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
endif

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	[ -d debian/brzhome ] || mkdir debian/brzhome
	$(CONCURRENCY) \
	BRZ_HOME=debian/brzhome \
	BRZ_PLUGIN_PATH=-site:-user \
	LC_ALL=C.UTF-8 \
	PYTHONPATH=$(CURDIR)/.pybuild/cpython2_$(PYVERSION)_breezy/build \
	$(shell pyversions -d) ./brz -Derror selftest -v --parallel=fork \
	-Oselftest.timeout=6000
	$(CONCURRENCY) \
	BRZ_HOME=debian/brzhome \
	BRZ_PLUGIN_PATH=-site:-user \
	LC_ALL=C.UTF-8 \
	PYTHONPATH=$(CURDIR)/.pybuild/cpython3_$(PY3VERSION)_breezy/build \
	$(shell py3versions -d) ./brz -Derror selftest -v --parallel=fork \
	-Oselftest.timeout=6000
endif

override_dh_auto_clean:
	dh_auto_clean
	rm -rf debian/brzhome
	rm -f brzlib/*_pyx.c
	# It also doesn't really clean every thing...
	ls doc/en/user-reference/*txt | grep -v readme.txt | xargs rm -rf
	rm -rf doc/developers/make.bat \
		doc/developers/Makefile \
		doc/*/_build/ \
		doc/en/release-notes/index.txt

override_dh_install:
	dh_install
	find debian/
	mkdir -p debian/python-breezy.tests/usr/lib
	for py in $(shell pyversions -r); do \
		mkdir -p debian/python-breezy.tests/usr/lib/$$py/dist-packages/breezy; \
		mv debian/python-breezy/usr/lib/$$py/dist-packages/breezy/tests \
			debian/python-breezy.tests/usr/lib/$$py/dist-packages/breezy/tests; \
	done
	for py in $(shell py3versions -r); do \
		mkdir -p debian/python3-breezy.tests/usr/lib/$$py/dist-packages/breezy; \
		mv debian/python3-breezy/usr/lib/$$py/dist-packages/breezy/tests \
			debian/python3-breezy.tests/usr/lib/$$py/dist-packages/breezy/tests; \
	done
	# Install the documentation; since html and txt and intermixed
	# under doc/, this is handier than trying to do it from brz-doc.install.
	( cd doc && find -name "*.txt" -not -wholename "*/_build/*" -print0 ) | \
		xargs -r0 -i'{}' -n1 install -D -m 644 'doc/{}' \
		"debian/brz-doc/usr/share/doc/brz/txt/{}"
	rm debian/python-breezy-dbg/usr/man/man1/brz.1 \
		debian/python-breezy-dbg/usr/man/man1/git-remote-bzr.1 \
		debian/python-breezy-dbg/usr/bin/bzr-receive-pack \
		debian/python-breezy-dbg/usr/bin/brz \
		debian/python-breezy-dbg/usr/bin/bzr-upload-pack \
		debian/python-breezy-dbg/usr/bin/git-remote-bzr
	rmdir debian/python-breezy-dbg/usr/man/man1 \
		  debian/python-breezy-dbg/usr/man
	rm debian/python-breezy/usr/man/man1/brz.1 \
		debian/python-breezy/usr/man/man1/git-remote-bzr.1 \
		debian/python-breezy/usr/bin/bzr-receive-pack \
		debian/python-breezy/usr/bin/brz \
		debian/python-breezy/usr/bin/bzr-upload-pack \
		debian/python-breezy/usr/bin/git-remote-bzr
	rmdir debian/python-breezy/usr/man/man1 \
		  debian/python-breezy/usr/man
	rm debian/python3-breezy/usr/man/man1/brz.1 \
		debian/python3-breezy/usr/man/man1/git-remote-bzr.1 \
		debian/python3-breezy/usr/bin/bzr-receive-pack \
		debian/python3-breezy/usr/bin/brz \
		debian/python3-breezy/usr/bin/bzr-upload-pack \
		debian/python3-breezy/usr/bin/git-remote-bzr
	rmdir debian/python3-breezy/usr/man/man1 \
		  debian/python3-breezy/usr/man
	rm debian/python3-breezy-dbg/usr/man/man1/brz.1 \
		debian/python3-breezy-dbg/usr/man/man1/git-remote-bzr.1 \
		debian/python3-breezy-dbg/usr/bin/bzr-receive-pack \
		debian/python3-breezy-dbg/usr/bin/brz \
		debian/python3-breezy-dbg/usr/bin/bzr-upload-pack \
		debian/python3-breezy-dbg/usr/bin/git-remote-bzr
	rmdir debian/python3-breezy-dbg/usr/man/man1 \
		  debian/python3-breezy-dbg/usr/man

override_dh_auto_missing:
	dh_missing --fail-missing

override_dh_auto_build:
	dh_auto_build
	PYTHONHASHSEED=0 $(MAKE) docs-sphinx

override_dh_compress:
	dh_compress -X.xvg -X.pdf

override_dh_strip:
ifeq (,$(filter nostrip,$(DEB_BUILD_OPTIONS)))
	dh_strip -ppython-breezy --dbgsym-migration='python-breezy-dbg (<< 3.0.0~bzr7141-2)'
	dh_strip -ppython3-breezy --dbgsym-migration='python3-breezy-dbg (<< 3.0.0~bzr7141-2)'
endif

override_dh_link:
	# symlink identical resources.
	( cd debian/brz-doc/usr/share/doc && fdupes -o name -r1q . | while read s; do \
	      set -- $$(echo $$s | tr ' ' '\n' | sort); \
	      f=$$1; shift; \
	      for d; do \
		  ln -sf /usr/share/doc/"$$d" "$$f"; \
	      done; \
	done )
	dh_link

override_dh_sphinxdoc:
ifneq "$(shell dh_listpackages | grep -- -doc)" ""
	dh_sphinxdoc -X searchtools.js
endif
	# dh_sphinxdoc chokes if we delete the extra licence files before it runs.
	find debian/brz-doc/usr/share/doc/brz -name "licence.txt" -print | xargs rm -f