[pmg-devel] [PATCH spamassassin 3/9] buildsys: use debhelper for building

Stoiko Ivanov s.ivanov at proxmox.com
Mon Jan 20 19:37:29 CET 2020


this additionally creates a complete source package

Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
 Makefile                       | 24 +++++----
 debian/install                 |  1 +
 debian/rules                   | 99 +++++-----------------------------
 debian/source/format           |  1 +
 debian/source/include-binaries |  1 +
 5 files changed, 30 insertions(+), 96 deletions(-)
 create mode 100644 debian/install
 create mode 100644 debian/source/format
 create mode 100644 debian/source/include-binaries

diff --git a/Makefile b/Makefile
index 7d06b08..53dc412 100644
--- a/Makefile
+++ b/Makefile
@@ -29,18 +29,24 @@ SA_UPDATE_GPG_DIR = .sa-update-gpghome
 
 deb: ${DEB}
 
-#${DEB}: ${OPKGNAME}.tar.gz
-${DEB}: ${OPKGNAME}.tar.gz sa-updates.tgz ${EXTRA_RULES}
-	-rm -rf ${OPKGNAME} ${NPKGNAME}
-	tar xzf ${OPKGNAME}.tar.gz
-	mv ${OPKGNAME} ${NPKGNAME}
-	cp -a debian ${NPKGNAME}
-	mkdir ${NPKGNAME}/extra_rules
-	cp ${EXTRA_RULES} ${NPKGNAME}/extra_rules
+${DEB}: ${NPKGNAME}
 	cd ${NPKGNAME}; dpkg-buildpackage -us -uc -rfakeroot
-	-rm -rf ${OPKGNAME} ${NPKGNAME}
 	lintian ${DEB}
 
+
+${NPKGNAME}.orig.tar.gz: ${OPKGNAME}.tar.gz
+	rm -rf ${NPKGNAME}
+	tar -xzf $<
+	mv ${OPKGNAME} ${NPKGNAME}
+	tar -czf ${NPKGNAME}.orig.tar.gz ${NPKGNAME}
+
+${NPKGNAME}: sa-updates.tgz ${EXTRA_RULES} ${NPKGNAME}.orig.tar.gz
+	cp -a debian $@
+	mkdir -p $@/debian/tree/usr/share/spamassassin
+	tar -C $@/debian/tree/usr/share/spamassassin -xzf sa-updates.tgz
+	mkdir -p $@/debian/tree/usr/share/spamassassin-extra
+	cp -a ${EXTRA_RULES} $@/debian/tree/usr/share/spamassassin-extra
+
 KAM.cf:
 	wget http://www.pccc.com/downloads/SpamAssassin/contrib/KAM.cf -O $@.tmp
 	mv KAM.cf.tmp $@
diff --git a/debian/install b/debian/install
new file mode 100644
index 0000000..b8d5416
--- /dev/null
+++ b/debian/install
@@ -0,0 +1 @@
+debian/tree/* /
diff --git a/debian/rules b/debian/rules
index 9e4a719..d51600e 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,9 +1,4 @@
 #!/usr/bin/make -f
-# This debian/rules file is provided as a template for normal perl
-# packages. It was created by Marc Brockschmidt <marc at dch-faq.de> for
-# the Debian Perl Group (http://pkg-perl.alioth.debian.org/) but may
-# be used freely wherever it is useful.
-
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
 
@@ -13,54 +8,22 @@ export PERL_MM_USE_DEFAULT=1
 
 PACKAGE=$(shell dh_listpackages)
 
-ifndef PERL
-PERL = /usr/bin/perl
-endif
-
-include /usr/share/quilt/quilt.make
-
 TMP     =$(CURDIR)/debian/$(PACKAGE)
 
-# Allow disabling build optimation by setting noopt in
-# $DEB_BUILD_OPTIONS
-CFLAGS = -Wall -g
-ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
-        CFLAGS += -O0
-else
-        CFLAGS += -O2
-endif
-
-build: build-stamp
-build-stamp: $(QUILT_STAMPFN)
-
-	dh_testdir
-
-	# Add commands to compile the package here
-	$(PERL) Makefile.PL INSTALLDIRS=vendor
-	$(MAKE) OPTIMIZE="$(CFLAGS)" LD_RUN_PATH=""
-
-	$(MAKE) test
-
-	touch build-stamp
+%:
+	dh $@
 
-clean: unpatch
-	dh_testdir
-	dh_testroot
+# implicit rules are skipped for phony targets and SA has a 'build' directory
+# in the source
+.PHONY: build
+build:
+	dh $@
 
-	# Add commands to clean up after the build process here
-	[ ! -f Makefile ] || $(MAKE) realclean
-
-	dh_clean build-stamp install-stamp
-
-install: build install-stamp
-install-stamp:
-	dh_testdir
-	dh_testroot
-	dh_clean -k
-
-	# Add commands to install the package into debian/PACKAGE_NAME here
-	$(MAKE) install DESTDIR=$(TMP) PREFIX=/usr
+override_dh_auto_test:
+	dh_auto_test -- TEST_VERBOSE=0
 
+override_dh_auto_install:
+	dh_auto_install
 	# rm example local.cf
 	rm $(TMP)/etc/mail/spamassassin/local.cf
 
@@ -69,49 +32,11 @@ install-stamp:
 	rm $(TMP)/etc/mail/spamassassin/v310.pre
 	rm $(TMP)/etc/mail/spamassassin/v320.pre
 
-	# apply rule updates
-	tar xzvf ../sa-updates.tgz -C $(TMP)/usr/share/spamassassin/
-	#patch -d $(TMP)/usr/share/spamassassin <../72_active.cf.diff
-
-	# install extra rules
-	mkdir $(TMP)/usr/share/spamassassin-extra/
-	install -m 0644 extra_rules/KAM.cf $(TMP)/usr/share/spamassassin-extra/
-
 	# As this is a architecture dependent package, we are not
 	# supposed to install stuff to /usr/share. MakeMaker creates
 	# the dirs, we delete them from the deb:
 	rmdir --ignore-fail-on-non-empty --parents $(TMP)/usr/share/perl5
 
-	touch install-stamp
-
-# Build architecture-independent files here.
-binary-indep: build install
-# We have nothing to do by default.
-
-# Build architecture-dependent files here.
-binary-arch: build install
-	dh_testdir
-	dh_testroot
+override_dh_installdocs:
 	dh_installdocs README t/README sql/README.awl sql/README.bayes sql/README spamd/README.vpopmail spamd/README spamd/OSXStartup/README spamc/README.win spamc/README.qmail spamd-apache2/README.apache ldap/README ldap/README.testing
-	dh_installexamples 
-#	dh_installmenu
-#	dh_installcron
-#	dh_installman
-	dh_installchangelogs Changes
-	dh_link
-	dh_strip
-	dh_compress
-	dh_fixperms
-	dh_makeshlibs
-	dh_installdeb
-	dh_perl 
-	dh_shlibdeps
-	dh_gencontrol
-	dh_md5sums
-	dh_builddeb
-
-source diff:                                                                  
-	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
 
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..163aaf8
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (quilt)
diff --git a/debian/source/include-binaries b/debian/source/include-binaries
new file mode 100644
index 0000000..480a512
--- /dev/null
+++ b/debian/source/include-binaries
@@ -0,0 +1 @@
+debian/tree/usr/share/spamassassin/languages
-- 
2.20.1




More information about the pmg-devel mailing list