aboutsummaryrefslogtreecommitdiff
path: root/debian/rules
blob: 93d3ebc0ab9b4d7d72a391d4fa82dde0f868e55e (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
#!/usr/bin/make -f
  
DEB_PYTHON2_MODULE_PACKAGES = git-buildpackage
DEB_PYTHON_CLEAN_ARGS = --all

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/python-distutils.mk

COMMANDS = git-buildpackage  \
           git-import-dsc    \
           git-import-dscs   \
           git-import-orig   \
           git-dch           \
           gbp-pull          \
           gbp-clone         \
           gbp-pq            \
           gbp-create-remote-repo

EXAMPLE_SCRIPTS=\
    gbp-add-patch          \
    gbp-cowbuilder-sid     \
    gbp-posttag-push       \
    gbp-configure-unpatched-source \
    wrap_cl.py

DEB_COMPRESS_EXCLUDE=$(EXAMPLE_SCRIPTS)

SGML_MANPAGES=$(patsubst %,docs/%.1,$(COMMANDS))
POD_MANPAGES=docs/git-pbuilder.1
MANPAGES=$(SGML_MANPAGES) $(POD_MANPAGES)
MANUAL=docs/manual-html
PYCHECKER_ARGS=-boptparse --no-override --no-shadowbuiltin
GBP_VERSION=gbp/gbp_version.py
VERSION_ENT=docs/version.ent

docs/%.1: docs/man.%.sgml
	docbook2man -o docs/ $<

docs/manual.sgml: docs/version.ent

$(MANUAL): docs/manual.sgml docs/chapters/*.sgml docs/manpages/*.sgml
	docbook-2-html -s local $<
	cp /usr/share/gtk-doc/data/*.png $(MANUAL)


docs/git-pbuilder.1: git-pbuilder
	pod2man $< $@

links_stamp:
	for c in $(COMMANDS); do \
		ln -s $$c $$(echo $$c | sed -e 's,-,_,g').py; \
	done
	touch links_stamp
	
apidocs: links_stamp
	epydoc -n git-buildpackage --no-sourcecode -o docs/apidocs/ \
		gbp*.py git*.py gbp/

ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
pychecker:
	PYTHONPATH=. pychecker $(PYCHECKER_ARGS) -q git*.py gbp*.py

checks: links_stamp pychecker
	export GIT_AUTHOR_NAME="Gbp Tests";		\
	export GIT_AUTHOR_EMAIL=tests@example.com;	\
	export GIT_COMMITTER_NAME=$$GIT_AUTHOR_NAME;	\
	export GIT_COMMITTER_EMAIL=$$GIT_AUTHOR_EMAIL;	\
	nosetests --exe --with-doctest
endif

$(GBP_VERSION): debian/changelog
	echo 'gbp_version="$(DEB_VERSION)"' > $(GBP_VERSION)

$(VERSION_ENT): debian/changelog
	echo '<!ENTITY gbp-version "$(DEB_VERSION)">' >  $(VERSION_ENT)

build/git-buildpackage:: $(MANPAGES) $(MANUAL) $(GBP_VERSION) checks apidocs

binary-post-install/git-buildpackage::
	dh_bash-completion

clean::
	-rm git_*.py gbp_*.py gbp/gbp_version.py links_stamp
	-rm docs/*.1 docs/manpage.* $(VERSION_ENT) git-pbuilder.1
	-rm -r docs/manual-html/ docs/apidocs/

.PHONY: checks