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