File: rules

package info (click to toggle)
cdist 4.10.6-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 8,296 kB
  • sloc: sh: 10,167; python: 8,002; makefile: 366
file content (52 lines) | stat: -rwxr-xr-x 1,619 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
#!/usr/bin/make -f
include /usr/share/dpkg/default.mk
export PYBUILD_DESTDIR = debian/cdist

clean build-arch build-indep: cdist/version.py
%:
	dh $@ --with python3,linktree,sphinxdoc,bash_completion \
	    --buildsystem=pybuild

# Upstream build system assumes git checkout. Since Debian source packages
# should be buildable from tarballs, we have to reimplement some of upstream
# build trickery.

cdist/version.py:
	echo "VERSION = '$(DEB_VERSION_UPSTREAM)'" > $@

override_dh_auto_build:
	# This directory is lost during
	#
	# upstream git -> tarball -> git-buildpackage
	#
	# process, since .gitignore files are excluded by
	# git-archive(1) and tarballs can store empty directories,
	# but git can not.
	#
	# Without this directory, build from git repository fails.
	mkdir -p docs/src/man7
	$(MAKE) man html

# This file contains instruction how to install cdist system-wide. It
# gets installed in wrong place and actually redundant.
override_dh_auto_install:
	dh_auto_install
	find debian/cdist/usr/lib -name 'README' -delete

override_dh_install:
	dh_install
	jdupes --linksoft --recurse debian/cdist-doc

# If something has shebang, then `chmod +x'. But it is important to
# search only among scripts, since some manpages trigger false-positive
# (compressed manpages are considered to have single line by head(1),
# and somewhere in that line #! sometimes occurs)
override_dh_fixperms:
	dh_fixperms
	find debian/cdist/usr/lib/python3 -type f -execdir \
	    /bin/sh -c '(head -n1 {} | grep -qF "#!") && chmod +x {}' \;

override_dh_auto_clean: cdist/version.py
	$(MAKE) clean
	rm -rf ./build
	dh_auto_clean