[pmg-devel] [PATCH pmg-api 2/2] buildsys: put TEMPLATES into separate Makefile

Stoiko Ivanov s.ivanov at proxmox.com
Wed Mar 25 19:42:55 CET 2020


with the addition of 'ucf' handling for templates it is necessary to edit
the maintainerscripts while packaging. Since this does not belong in the
'src/Makefile' and the listing of all templates does not belong in the
top-level Makefile - add the list of templates to a separate makefile in
'src/templates' and include it in both places where it is needed.

Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
 Makefile                   |  2 ++
 src/Makefile               | 21 +--------------------
 src/templates/templates.mk | 20 ++++++++++++++++++++
 3 files changed, 23 insertions(+), 20 deletions(-)
 create mode 100644 src/templates/templates.mk

diff --git a/Makefile b/Makefile
index f6bf7c6..1d70117 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,5 @@
 include /usr/share/dpkg/pkg-info.mk
+include src/templates/templates.mk
 
 PACKAGE=pmg-api
 
@@ -17,6 +18,7 @@ export PMGRELEASE=${DEB_VERSION_UPSTREAM}
 deb ${DEB}:
 	rm -rf ${BUILDDIR}
 	rsync -a src/ debian ${BUILDDIR}
+	sed -ri 's/^    PMG_TEMPLATES=.*$$/PMG_TEMPLATES="${TEMPLATES}"/' ${BUILDDIR}/debian/postinst ${BUILDDIR}/debian/postrm
 	cd ${BUILDDIR}; dpkg-buildpackage -b -us -uc
 	lintian ${DEB}
 
diff --git a/src/Makefile b/src/Makefile
index 3617f05..8cd3a84 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,6 +1,7 @@
 # this requires package pmg-doc-generator
 export NOVIEW=1
 include /usr/share/pmg-doc-generator/pmg-doc-generator.mk
+include templates/templates.mk
 
 DESTDIR=
 
@@ -25,25 +26,6 @@ CLI_MANS = $(addsuffix .1, ${CLITOOLS}) pmgsh.1 pmg-system-report.1
 SERVICE_MANS = $(addsuffix .8, ${SERVICES}) pmg-smtp-filter.8 pmgpolicy.8
 CONF_MANS= pmg.conf.5 cluster.conf.5
 
-TEMPLATES =				\
-	fetchmailrc.tt			\
-	pmgreport.tt			\
-	spamreport-verbose.tt		\
-	spamreport-short.tt		\
-	main.cf.in			\
-	main.cf.in.demo			\
-	master.cf.in			\
-	master.cf.in.demo		\
-	init.pre.in			\
-	local.cf.in			\
-	v310.pre.in			\
-	v320.pre.in			\
-	razor-agent.conf.in		\
-	freshclam.conf.in		\
-	clamd.conf.in 			\
-	postgresql.conf.in		\
-	pg_hba.conf.in
-
 TEMPLATES_FILES = $(addprefix templates/, ${TEMPLATES})
 
 LIBSOURCES =				\
@@ -192,7 +174,6 @@ install: ${SOURCES} $(addsuffix .service-bash-completion, ${SERVICES}) $(addsuff
 	install -d -m 0755 ${DESTDIR}/lib/systemd/system
 	for i in ${TIMER_UNITS}; do install -m 0644 $$i ${DESTDIR}/lib/systemd/system/; done
 	install -D -m 0644 pmg-initramfs.conf ${DESTDIR}/etc/initramfs-tools/conf.d/pmg-initramfs.conf
-	sed -ri 's/^    PMG_TEMPLATES=.*$$/PMG_TEMPLATES="${TEMPLATES}"/' debian/postinst debian/postrm
 
 .PHONY: check
 check:
diff --git a/src/templates/templates.mk b/src/templates/templates.mk
new file mode 100644
index 0000000..36d6312
--- /dev/null
+++ b/src/templates/templates.mk
@@ -0,0 +1,20 @@
+TEMPLATES =				\
+	fetchmailrc.tt			\
+	pmgreport.tt			\
+	spamreport-verbose.tt		\
+	spamreport-short.tt		\
+	main.cf.in			\
+	main.cf.in.demo			\
+	master.cf.in			\
+	master.cf.in.demo		\
+	init.pre.in			\
+	local.cf.in			\
+	v310.pre.in			\
+	v320.pre.in			\
+	razor-agent.conf.in		\
+	freshclam.conf.in		\
+	clamd.conf.in 			\
+	postgresql.conf.in		\
+	pg_hba.conf.in
+
+
-- 
2.20.1




More information about the pmg-devel mailing list