summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Pentchev <roam@debian.org>2019-01-13 14:31:42 +0200
committerPeter Pentchev <roam@debian.org>2019-01-13 14:31:42 +0200
commit42b81aa28a334511e05fd125ab1460d022ad4484 (patch)
tree36568363c6fb63ad43a6b3f3b4087ce5d7e4a43c
parent9df7f791baf70d57e0946b866c504672021f030e (diff)
Conditionally run some commands in the rules file depending on which packages are being built.
-rwxr-xr-xdebian/rules38
1 files changed, 37 insertions, 1 deletions
diff --git a/debian/rules b/debian/rules
index ea45649..f3d59d1 100755
--- a/debian/rules
+++ b/debian/rules
@@ -18,6 +18,27 @@ export DEB_CFLAGS_MAINT_APPEND
export PCRE_CPPFLAGS=-DHAVE_PCRE
export PCRE_LIBS=-lpcre
+ifneq (,$(filter confget,$(shell dh_listpackages)))
+BUILD_IMPL_C=yes
+else
+BUILD_IMPL_C=no
+endif
+ifneq (,$(filter python-confget,$(shell dh_listpackages)))
+BUILD_IMPL_PY2=yes
+else
+BUILD_IMPL_PY2=no
+endif
+ifneq (,$(filter python3-confget,$(shell dh_listpackages)))
+BUILD_IMPL_PY3=yes
+else
+BUILD_IMPL_PY3=no
+endif
+ifneq (no no,${BUILD_IMPL_PY2} ${BUILD_IMPL_PY3})
+BUILD_IMPL_PY=yes
+else
+BUILD_IMPL_PY=no
+endif
+
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS) $(DEB_BUILD_PROFILES)))
DEB_NODOC=0
else
@@ -30,12 +51,20 @@ PY= ${CURDIR}/python
TESTD= ${CURDIR}/t
override_dh_auto_build:
+ @echo 'building C: ${BUILD_IMPL_C}, py2: ${BUILD_IMPL_PY2}, py3: ${BUILD_IMPL_PY3}, python: ${BUILD_IMPL_PY}'
+ifeq (yes,${BUILD_IMPL_C})
dh_auto_build -- LFS_CPPFLAGS= LFS_LDFLAGS=
+endif
+ifeq (yes,${BUILD_IMPL_PY})
dh_auto_build -D '${PY}' --buildsystem pybuild
+endif
override_dh_auto_install:
+ifeq (yes,${BUILD_IMPL_PY})
dh_auto_install -D '${PY}' --buildsystem pybuild
rm -f -- '${DTMP}/usr/bin/confget'
+endif
+ifeq (yes,${BUILD_IMPL_C})
ifeq (${DEB_NODOC},1)
mv -f Makefile Makefile.bak
sed -e 's/^install:.*/install: all install-bin/' Makefile.bak > Makefile
@@ -48,18 +77,25 @@ endif
ifeq (${DEB_NODOC},1)
mv -f Makefile.bak Makefile
endif
+endif
override_dh_auto_test:
+ifeq (yes,${BUILD_IMPL_C})
dh_auto_test
+endif
+ifeq (yes,${BUILD_IMPL_PY})
set -e; for pyver in $$(pyversions -i -v) $$(py3versions -i -v); do \
echo "=============== Testing Python $$pyver"; \
env PYTHONPATH='${PY}' CONFGET="python$$pyver -m confget" TESTDIR='${TESTD}' MANPAGE='${CURDIR}/confget.1' prove '${TESTD}'; \
done
env TESTDIR='${TESTD}' dh_auto_test -D '${PY}' --buildsystem pybuild -- --test-pytest --test-args '${PY}/unit_tests'
+endif
override_dh_installchangelogs:
dh_installchangelogs -X CHANGES
- install -m 644 CHANGES debian/confget/usr/share/doc/confget/NEWS
+ set -e; for pkg in $$(dh_listpackages); do \
+ install -m 644 CHANGES "debian/$$pkg/usr/share/doc/$$pkg/NEWS"; \
+ done
override_dh_auto_clean:
dh_auto_clean