summaryrefslogtreecommitdiffstats
path: root/debian/rules
blob: e0ea7b635cf7ad2694cf97c1993d8733427a8144 (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
#!/usr/bin/make -f

DOPACKAGES = $(shell dh_listpackages)
export PYBUILD_DESTDIR=debian/tmp

# Make it easier to build one machines with ansible << 2.10 installed.
export ANSIBLE_SKIP_CONFLICT_CHECK=1

%:
#	dh $@ --with python3,sphinxdoc --buildsystem=pybuild
	dh $@ --with python3 --buildsystem=pybuild

override_dh_clean:
	dh_clean \
		-X.bak \
		-X.md~ \
		-X.j2~ \
		-X.py~ \
		-X.txt~ \
		-X.txt.orig \
		-X.un~ \
		-X.yaml~ \
		-X.yml~

override_dh_auto_build:
	dh_auto_build
	dh_auto_build --sourcedir=collections-debian-merged
#ifneq (,$(filter ansible-doc,$(DOPACKAGES)))
#	# html documentation
#	$(MAKE) webdocs
#	# manpage documentation
#	$(MAKE) docs
#endif

override_dh_auto_test:
	# For now, disable the tests
	#make tests-nonet

override_dh_python3:
	dh_python3 --shebang=/usr/bin/python3

execute_after_dh_auto_install:
	find debian/tmp/ -depth -name '.git*' -exec rm -r {} +
	find debian/tmp/ -depth -name '.*' -exec rm -r {} +
	find debian/tmp/ -name '*~' -delete
	find debian/tmp/ -name '*.bak' -delete
	find debian/tmp/ -name '*.orig' -delete

# NB: Source packages merged in bullseye (Debian 11)
#
# As a temporary measure, upstream sources ansible-base and ansible have been
# merged in bullseye. The get-orig-source target implements this merge.
#
# The approach here is somewhat inflexible/hacky. It is assumed that it will be
# only needed very rarely (as it happens in stable), so it gets the job done
# without being too complicated and fancy.

PKGDIR  = $(abspath $(dir $(MAKEFILE_LIST)))/..
BASEVER = $(shell sed -nre 's/ansible-base: ([.0-9]+)/\1/p' $(PKGDIR)/debian/merged.versions)
COLLVER = $(shell sed -nre 's/ansible: ([.0-9]+)/\1/p' $(PKGDIR)/debian/merged.versions)
RPCKDIR = ansible-$(COLLVER)+merged+dfsg

get-orig-source:
	# Download both tarballs
	uscan \
		--noconf \
		--package=ansible \
		--upstream-version=$(BASEVER) \
		--watchfile=$(PKGDIR)/debian/watch.base \
		--copyright-file=$(PKGDIR)/debian/copyright \
		--verbose \
		--rename \
		--destdir=$(CURDIR) \
		--check-dirname-level=0 \
		--force-download \
		--download-version=$(BASEVER)
	uscan \
		--noconf \
		--package=ansible-collections \
		--upstream-version=$(COLLVER) \
		--watchfile=$(PKGDIR)/debian/watch \
		--copyright-file=$(PKGDIR)/debian/copyright \
		--verbose \
		--rename \
		--destdir=$(CURDIR) \
		--check-dirname-level=0 \
		--force-download \
		--download-version=$(COLLVER)
	# Extract both tarballs into the same base dir, with the second
	# tarball in a subdir
	mkdir -p $(RPCKDIR)/collections-debian-merged
	tar -xJf ansible_$(BASEVER)+dfsg.orig.tar.xz \
		--strip-components=1 \
		-C $(RPCKDIR)
	tar -xzf ansible-collections_$(COLLVER).orig.tar.gz \
		--strip-components=1 \
		-C $(RPCKDIR)/collections-debian-merged
	# Get rid of the old tarballs
	rm -f ansible_$(BASEVER)+dfsg.orig.tar.xz
	rm -f ansible-collections_$(COLLVER).orig.tar.gz
	# Repack the basedir as a single new tarball
	tar -cJf ansible_$(COLLVER)+merged+base+$(BASEVER)+dfsg.orig.tar.xz --strip-components=1 $(RPCKDIR)
	rm -rf $(RPCKDIR)