]> git.proxmox.com Git - proxmox-spamassassin.git/blob - Makefile
52bdf98b291f783f332008d98a81cd12dc45663a
[proxmox-spamassassin.git] / Makefile
1 include /usr/share/dpkg/default.mk
2
3 # howto add rule updates:
4
5 # running `make update-sa` updates the core SA rules (in the sa-updates directory)
6 # running `make update-kam` updates the KAM ruleset (in the kam-updates directory)
7
8 PACKAGE = proxmox-spamassassin
9
10 OPKGNAME = Mail-SpamAssassin-$(DEB_VERSION_UPSTREAM)
11
12 BUILDDIR = $(PACKAGE)-$(DEB_VERSION_UPSTREAM)
13 DSC = $(PACKAGE)_$(DEB_VERSION_UPSTREAM_REVISION).dsc
14
15 DEB = $(PACKAGE)_$(DEB_VERSION_UPSTREAM_REVISION)_amd64.deb
16 DBG_DEB = $(PACKAGE)-dbgsym_$(DEB_VERSION_UPSTREAM_REVISION)_amd64.deb
17 DEBS = $(DEB) $(DBG_DEB)
18
19 KAM_CHANNEL_FILE = debian/tree/etc/mail/spamassassin/channel.d/KAM_channel.conf
20 KAM_KEYID = $(shell awk -F '=' '/^KEYID/ { print $$2 }' $(KAM_CHANNEL_FILE))
21
22
23 SA_UPDATE_GPG_DIR = .sa-update-gpghome
24
25 deb: $(DEB)
26
27 $(DEB) $(DBG_DEB): $(BUILDDIR)
28 cd $(BUILDDIR); dpkg-buildpackage -b -us -uc
29 lintian $(DEB)
30
31 dsc:
32 $(MAKE) $(DSC)
33 lintian $(DSC)
34
35 $(DSC): $(BUILDDIR)
36 cd $(BUILDDIR); dpkg-buildpackage -S -us -uc -d
37
38 .PHONY: sbuild
39 sbuild: $(DSC)
40 sbuild $(DSC)
41
42 .PHONY: update-upstream
43 update-upstream: $(OPKGNAME).tar.gz
44 rm -rf upstream
45 tar -xzf $<
46 mv $(OPKGNAME) upstream
47
48 $(BUILDDIR).orig.tar.gz: upstream/
49 rm -rf $(NPKGNAME)
50 cp -a upstream $(NPKGNAME)
51 tar -czf $@ $(NPKGNAME)
52
53 $(BUILDDIR): sa-updates kam-updates $(NPKGNAME).orig.tar.gz
54 cp -a debian $@
55 mkdir -p $@/debian/tree/usr/share/spamassassin
56 rsync -av sa-updates/ $@/debian/tree/usr/share/spamassassin
57 mkdir -p $@/debian/tree/usr/share/spamassassin-extra
58 rsync -av kam-updates/ $@/debian/tree/usr/share/spamassassin-extra
59
60 $(OPKGNAME).tar.gz:
61 rm -f $@*
62 curl -L -o '$@#1.tmp' 'https://www-eu.apache.org/dist/spamassassin/source/$@{,.asc}'
63 mv $@.tmp $@
64 mv $@.asc.tmp $@.asc
65 gpgv --keyring ./sa-releasekey.gpg $@.asc $@
66
67 $(SA_UPDATE_GPG_DIR)/.prepared: $(OPKGNAME).tar.gz
68 rm -rf $(SA_UPDATE_GPG_DIR)
69 mkdir --mode=0700 -p $(SA_UPDATE_GPG_DIR)
70 tar --strip-components 2 -xzf $(OPKGNAME).tar.gz $(OPKGNAME)/rules/sa-update-pubkey.txt
71 sa-update --gpghomedir $(SA_UPDATE_GPG_DIR) --import sa-update-pubkey.txt
72 sa-update --gpghomedir $(SA_UPDATE_GPG_DIR) --import $(KAM_CHANNEL_FILE)
73 rm sa-update-pubkey.txt
74 touch $@
75
76 .PHONY: update-sa
77 update-sa: $(SA_UPDATE_GPG_DIR)/.prepared
78 rm -rf updates.tmp
79 sa-update --gpghomedir $(SA_UPDATE_GPG_DIR) --updatedir updates.tmp --channel updates.spamassassin.org
80 rsync -av --delete --exclude=local.cf --exclude=regression_tests.cf --exclude=*.txt --exclude=MIRRORED.BY updates.tmp/updates_spamassassin_org/ sa-updates
81
82 .PHONY: update-kam
83 update-kam: $(SA_UPDATE_GPG_DIR)/.prepared
84 rm -rf kam-updates.tmp kam-updates
85 sa-update --gpghomedir $(SA_UPDATE_GPG_DIR) --gpgkey $(KAM_KEYID) --updatedir kam-updates.tmp --channel kam.sa-channels.mcgrail.com
86 rm -rf kam-updates.tmp/kam_sa-channels_mcgrail_com/MIRRORED.BY
87 mv kam-updates.tmp kam-updates
88
89 .PHONY: upload
90 upload: UPLOAD_DIST ?= $(DEB_DISTRIBUTION)
91 upload: $(DEBS)
92 tar cf - $(DEBS) | ssh -X repoman@repo.proxmox.com -- upload --product pmg --dist $(UPLOAD_DIST)
93
94 .PHONY: clean distclean
95 clean:
96 rm -rf *~ debian/*~ *.deb $(PACKAGE)_* updates.tmp kam-updates.tmp $(SA_UPDATE_GPG_DIR) $(OPKGNAME).tar.gz.*
97
98 distclean: clean
99 rm -rf $(OPKGNAME).*
100
101 .PHONY: dinstall
102 dinstall: $(DEB)
103 dpkg -i $(DEB)