File: rules

package info (click to toggle)
swap-cwm 1.2.1-7
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 6,396 kB
  • ctags: 9,781
  • sloc: python: 20,607; ansic: 512; makefile: 214; sh: 45; xml: 13
file content (99 lines) | stat: -rwxr-xr-x 3,827 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
#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-
# Copyright © 2009, 2011, 2013, 2015 Jonas Smedegaard <dr@jones.dk>
# Description: Main Debian packaging script for Cwm
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

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

libpkg = python-swap
pkg = swap-cwm
cmds = cant cwm delta
manpages = $(cmds:%=debian/%.1)

DEB_UPSTREAM_URL = http://www.w3.org/2000/10/swap
DEB_UPSTREAM_PACKAGE = cwm
DEB_UPSTREAM_TARBALL_MD5 = e89a71e4f48ee5f9c89d4ba2e88f5a73

DEB_INSTALL_CHANGELOGS_ALL = doc/changes.html
DEB_INSTALL_DOCS_$(libpkg) += *.html
DEB_INSTALL_MANPAGES_$(pkg) = $(manpages)

DEB_CLEAN_EXCLUDE = README~ setup.py~

# Install directly into Python library package
DEB_PYTHON_DESTDIR = $(CURDIR)/debian/$(cdbs_curpkg)

ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
build/$(libpkg):: debian/stamp-python-check
debian/stamp-python-check: debian/python-module-stampdir/$(libpkg)
	$(MAKE) -C test post-install P="python$(cdbs_python_compile_version)"
	touch $@

clean::
	rm -rf test/,diffs test/,temp
	rm -f test/pyc-check debian/stamp-python-check
endif

# Move scripts from library to cwm package and fix hashbang
# - Strip hardcoded python version
# - Use default system Python
# (binary-fixup rule is too late for dh_pycentral dependency resolving)
common-binary-indep:: debian/$(pkg)/usr/bin
debian/$(pkg)/usr/bin: install/$(libpkg)
	mkdir -p debian/$(pkg)/usr
	mv debian/$(libpkg)/usr/bin debian/$(pkg)/usr/
	egrep -r -l -Z '^#! ?/(usr/)?(local/)?bin/(env )?python[[:print:]]*$$' debian/$(pkg)/usr/bin \
		| xargs -r -0 perl -pi -e 's,^#! ?/(usr/)?(local/)?bin/(env )?python[[:print:]]*$$,#!/usr/bin/python$(cdbs_python_compile_version),'

# Fix filename of scripts
# - strip extension
binary-post-install/$(pkg)::
	mv debian/$(cdbs_curpkg)/usr/bin/cant.py debian/$(cdbs_curpkg)/usr/bin/cant

# Strip hashbang from Python modules
binary-fixup/$(libpkg)::
	egrep -r -l -Z '^#! ?/(usr/)?(local/)?bin/(env )?python[[:print:]]*$$' debian/$(cdbs_curpkg)/usr \
		| xargs -r -0 perl -ni -e 'print unless m,^#! ?/(usr/)?(local/)?bin/(env )?python[[:print:]]*$$,'

# generate manpage based on --help of script itself
# (using wrappers to emulate --version and provide --description)
common-post-build-indep:: $(manpages)
$(manpages): %.1 : %
	chmod +x $<
	help2man --name="$$($< --description)" --no-info --output=$@ $<
	perl -i -0 -p \
		-e 's/^\.PP\noptions:\n\.PP$$/.SH OPTIONS/m; # fix marking options as a headline' \
		-e 's/^(\\fB\\-\\-.*?)=\\fR([^ ]*)/$$1\\fR=\\fI$$2\\fR/mg; # fix option value hilite' \
		-e 's/^(\w)$$/.B $$1/mg; # fix mode flags hilite' \
		-e 's/^\\fB\\-\\-(.*?)\\fR([^ ]*) +/.TP\n.B \\--$$1$$2\n/mg; # improve option listing' \
		-e 's/^(\.TP\n\.B.*\n[^\.].*\n)\.IP(\n\(.*)\n\.PP$$/$$1.RS$$2/mg; # keep option lines together' \
		$@

clean::
	rm -f $(manpages)

# Needed for our packaging
CDBS_BUILD_DEPENDS += help2man

# tools needs library
CDBS_DEPENDS_$(pkg) = $(libpkg)

# Needed (sometimes) at runtime
CDBS_SUGGESTS_$(libpkg) = python-crypto, python-rdflib, $(pkg)
CDBS_SUGGESTS_$(pkg) = python-crypto, python-rdflib, otter