[pmg-devel] [PATCH spamassassin 2/4] buildsys: import sa-update key from tarball
Stoiko Ivanov
s.ivanov at proxmox.com
Tue Jun 4 16:12:02 CEST 2019
`make sa-updates.tgz` runs sa-update with a temporary directory and packs the
gathered rules into a tarball, which gets extracted during dpkg-buildpackage.
This patch creates a gpg-homedir and imports the sa-update-key distributed with
the upstream tarball, and changes the call to sa-update to use this directory
instead of the default '/etc/mail/spamassassin/sa-update-keys'.
In addition to being a bit more self-contained this also enables running
`make sa-updates.tgz` without being root.
The temporary gpg-homedir is added to '.gitignore'
Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
.gitignore | 1 +
Makefile | 16 +++++++++++++---
2 files changed, 14 insertions(+), 3 deletions(-)
create mode 100644 .gitignore
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..ec497c1
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+.sa-update-gpghome
diff --git a/Makefile b/Makefile
index 6e82742..7f3bb53 100644
--- a/Makefile
+++ b/Makefile
@@ -24,6 +24,8 @@ DEB = proxmox-spamassassin_${SAVER}-${PKGREL}_amd64.deb
EXTRA_RULES = KAM.cf
+SA_UPDATE_GPG_DIR = .sa-update-gpghome
+
#${DEB}: ${OPKGNAME}.tar.gz
${DEB}: ${OPKGNAME}.tar.gz sa-updates.tgz ${EXTRA_RULES}
-rm -rf ${OPKGNAME} ${NPKGNAME}
@@ -40,16 +42,24 @@ KAM.cf:
wget http://www.pccc.com/downloads/SpamAssassin/contrib/KAM.cf -O $@.tmp
mv KAM.cf.tmp $@
-sa-updates.tgz:
+${SA_UPDATE_GPG_DIR}/.prepared: ${OPKGNAME}.tar.gz
+ rm -rf ${SA_UPDATE_GPG_DIR}
+ mkdir --mode=0700 -p ${SA_UPDATE_GPG_DIR}
+ tar --strip-components 2 -xzf ${OPKGNAME}.tar.gz ${OPKGNAME}/rules/sa-update-pubkey.txt
+ sa-update --gpghomedir ${SA_UPDATE_GPG_DIR} --import sa-update-pubkey.txt
+ rm sa-update-pubkey.txt
+ touch $@
+
+sa-updates.tgz: ${SA_UPDATE_GPG_DIR}/.prepared
rm -rf updates.tmp
- sa-update --updatedir updates.tmp --channel updates.spamassassin.org
+ sa-update --gpghomedir ${SA_UPDATE_GPG_DIR} --updatedir updates.tmp --channel updates.spamassassin.org
tar cvzf sa-updates.tgz --exclude=local.cf --exclude=regression_tests.cf --exclude=*.txt --exclude=MIRRORED.BY -C updates.tmp/updates_spamassassin_org/ .
.PHONY: upload
upload: ${DEB}
tar cf - ${DEB} | ssh -X repoman at repo.proxmox.com -- upload --product pmg --dist stretch
-CLEANFILES = *~ debian/*~ *.deb proxmox-spamassassin_* updates.tmp
+CLEANFILES = *~ debian/*~ *.deb proxmox-spamassassin_* updates.tmp ${SA_UPDATE_GPG_DIR}
.PHONY: clean
clean:
--
2.11.0
More information about the pmg-devel
mailing list