File: rules

package info (click to toggle)
diffoscope 78%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 3,520 kB
  • sloc: python: 7,903; makefile: 58; sh: 58
file content (71 lines) | stat: -rwxr-xr-x 2,449 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
#!/usr/bin/make -f

MANPAGES = $(patsubst %.1.rst,%.1,$(wildcard debian/*.1.rst))
VERSION_dch := $(shell dpkg-parsechangelog --show-field Version)
VERSION_py := $(shell awk '/^VERSION = / {gsub(/"/, "", $$3); print $$3}' diffoscope/__init__.py )
DIST := $(shell dpkg-parsechangelog --show-field Distribution)

ifneq ($(VERSION_dch),$(VERSION_py))
 ifneq ($(DIST),UNRELEASED)
  ifneq (,$(filter %-backports,$(DIST)))
    ifeq ($(VERSION_dch:~bpo8+1=),$(VERSION_py))
     $(info Building a Debian backport, accepting version mismatch $(VERSION_py) <-> $(VERSION_dch))
    else
     $(error Version in debian/changelog does not match diffoscope version or backport policy)
    endif
  else
    ifeq ($(DIST),stretch)
     $(info "Stable update!  ☺")
    else
     $(error Version in debian/changelog does not match diffoscope version)
    endif
  endif
 endif
endif

export PATH := $(CURDIR)/bin:$(PATH)
export PYBUILD_DESTDIR = debian/diffoscope
export PYBUILD_TEST_ARGS = -vv -r sxX -l --cov=diffoscope --cov-report=term-missing --cov-report=html
export PYBUILD_AFTER_TEST = debian/tests/basic-command-line
export PYBUILD_AFTER_INSTALL = rm -rvf '{destdir}/{install_dir}/htmlcov' '{destdir}/{install_dir}/.coverage'

%:
	dh $@ --with python3 --with bash-completion --buildsystem=pybuild

override_dh_python3:
	dh_python3 -p diffoscope \
		--recommends=python-debian \
		--recommends=rpm-python \
		--recommends=tlsh \
		--recommends=guestfs \
		--recommends=argcomplete \
		--recommends=progressbar

override_dh_gencontrol:
	TOOLS="$$(bin/diffoscope --list-tools=debian | awk -F': ' '/Available-in-Debian-packages/ { print $$2 }' | \
		sed -e 's/\(^\| \)\(coreutils\|diffutils\|e2fsprogs\|findutils\|gzip\|tar\)\(,\|$$\)//g')"; \
		[ -n "$$TOOLS" ] || { echo '--list-tools failed' >&2; exit 1; }; \
		echo "diffoscope:Recommends=$$TOOLS" >> debian/diffoscope.substvars
	dh_gencontrol -O--buildsystem=pybuild

debian/%.1: debian/%.1.rst
	rst2man $< $@

debian/diffoscope.bash-completion:
	register-python-argcomplete diffoscope > $@

override_dh_auto_build: debian/diffoscope.bash-completion $(MANPAGES)
	dh_auto_build -O--buildsystem=pybuild

override_dh_installman: $(MANPAGES)
	dh_installman -O--buildsystem=pybuild

diffoscope/presenters/icon.py: favicon.png
	(echo '# Generated from favicon.png'; \
	 echo 'FAVICON_BASE64 = """'; \
	 base64 $<; \
	 echo '""".replace("\\n", "")'; \
	) > $@

favicon.png: logo.svg
	inkscape -w 32 -h 32 -e $@ $<