File: rules

package info (click to toggle)
bzr 2.7.0%2Bbzr6622-15
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 41,440 kB
  • sloc: python: 228,647; ansic: 2,817; makefile: 501; sh: 293; lisp: 107
file content (104 lines) | stat: -rwxr-xr-x 3,633 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
#!/usr/bin/make -f

# Get the supported Python versions
PYVERS = $(shell pyversions -r -v)
# Get the default Python version
PYVERSION = $(shell pyversions -d -v)

# Callable functions to determine the correct PYTHONPATH
pythonpath = $$(ls -d $(CURDIR)/build/lib.*-$(1))
pythonpath_dbg = $$(ls -d $(CURDIR)/build/lib_d.*-$(1) 2>/dev/null || ls -d $(CURDIR)/build/lib.*$(1)-pydebug)

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

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

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	[ -d debian/bzrhome ] || mkdir debian/bzrhome
	$(CONCURRENCY) \
	BZR_HOME=debian/bzrhome \
	BZR_PLUGIN_PATH=-site:-user \
	BZR_DISABLE_PLUGINS=launchpad \
	PYTHONPATH=$(wildcard $(CURDIR)/build/lib.*-$(PYVERSION)) \
	$(CURDIR)/build/scripts-$(PYVERSION)/bzr -Derror selftest -v --parallel=fork
endif

override_dh_auto_clean:
	dh_auto_clean
	rm -rf debian/bzrhome
	rm -f bzrlib/*_pyx.c
	# 'make clean-sphinx' calls Makefiles in sub-directories that are
	# created only after calling 'make docs-sphinx'. Check for them first.
	if [ -f doc/es/Makefile ]; then $(MAKE) clean-sphinx; fi
	# 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/es/make.bat \
		doc/ja/make.bat \
		doc/ru/make.bat \
		doc/developers/Makefile \
		doc/es/Makefile \
		doc/ja/Makefile \
		doc/ru/Makefile \
		doc/*/_build/ \
		doc/en/release-notes/index.txt

override_dh_install:
	find debian/tmp/ -name "*.pyc" | xargs rm -f
	find debian/tmp/ -name "*.pyo" | xargs rm -f
	mkdir -p debian/python-bzrlib.tests/usr/lib \
		debian/python-bzrlib.tests/usr/share/pyshared/bzrlib
	for py in $(shell pyversions -r); do \
		mkdir -p debian/python-bzrlib.tests/usr/lib/$$py/dist-packages/bzrlib; \
		mv debian/tmp/usr/lib/$$py/dist-packages/bzrlib/tests \
			debian/python-bzrlib.tests/usr/lib/$$py/dist-packages/bzrlib/tests; \
	done
	if [ -d debian/tmp/usr/share/locale ]; then \
		mkdir -p debian/python-bzrlib/usr/share; \
		mv debian/tmp/usr/share/locale debian/python-bzrlib/usr/share/locale; \
	fi;
	mv debian/tmp/usr/bin/bzr debian/tmp/usr/bin/bzr.bzr
	mkdir -p debian/tmp/usr/share/man/man1
	mv debian/tmp/usr/man/man1/bzr.1 \
	   debian/tmp/usr/share/man/man1/bzr.bzr.1
	dh_install --list-missing --fail-missing
	# Install the documentation; since html and txt and intermixed
	# under doc/, this is handier than trying to do it from bzr-doc.install.
	( cd doc && find -name "*.txt" -not -wholename "*/_build/*" -print0 ) | \
		xargs -r0 -i'{}' -n1 install -D -m 644 'doc/{}' \
		"debian/bzr-doc/usr/share/doc/bzr/txt/{}"

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

override_dh_compress:
	dh_compress -X.xvg -X.pdf

override_dh_strip:
	dh_strip -ppython-bzrlib --dbg-package=python-bzrlib-dbg

override_dh_link:
	# symlink identical resources.
	cd debian/bzr-doc/usr/share/doc && fdupes -o name -rnq . | while read line; do \
		if [ -z "$$line" ]; then \
			target=""; \
		elif [ -z "$$target" ]; then \
			target=$$line; \
		else \
			echo "symlinking duplicate file '$$line' to '$$target'"; \
			ln -sf /usr/share/doc/"$$target" "$$line"; \
		fi; \
	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/bzr-doc/usr/share/doc/bzr -name "licence.txt" -print | xargs rm -f