aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: f45620d4f2bae0417fb089e0b17075c4d106b1a2 (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
.POSIX:


.SUFFIXES:
.SUFFIXES: .in

.in:
	sed \
		-e "s|@HOSTNAME@|`hostname`|g" \
		< $< > $@
	if [ -x $< ]; then chmod +x $@; fi



all: guix nix debian homebrew src/bin/paku


paku.lock: src/bin/paku Makefile
	touch $@


test-config-files = \
	tests/internet/etc/postfix/main.cf      \
	tests/internet/etc/dkimproxyout.conf    \
	tests/internet/etc/dovecot/dovecot.conf \

derived-assets = \
	$(test-config-files) \

guix: src/org/euandre/packages.scm channel-key.sentinel \
		result-packages.sentinel result-services.sentinel

channel-key.sentinel: paku.lock
	F="$$( perl -MJSON -0777 -E 'say $${decode_json <>}{maintainer}{name}'  < paku.lock).key"; \
	ID="$$(perl -MJSON -0777 -E 'say $${decode_json <>}{maintainer}{email}' < paku.lock)"; \
	gpg --armour --export "$$ID" > "$$F"
	touch $@

src/org/euandre/packages.scm: paku.lock
	paku guix > src/org/euandre/packages.scm

result-packages result-packages.sentinel: \
		src/org/euandre/packages.scm src/org/euandre/queue.scm
	rm -f result-packages
	guix build -r result-packages -v3 -Lsrc/ -K \
		-f src/org/euandre/packages.scm \
		-f src/org/euandre/queue.scm
	touch result-packages.sentinel

local-files = \
	/etc/postfix/master.cf \
	/etc/postfix/main.cf   \

internet-files = \
	$(local-files)            \
	/etc/sasl2/smtpd.conf     \
	/etc/dkimproxyout.conf    \
	/etc/dovecot/dovecot.conf \

result-services.sentinel: result-local.sentinel result-internet.sentinel
	touch $@

result-local result-local.sentinel: result-packages.sentinel
	rm -f result-local
	guix system -v3 -Lsrc/ -K -r result-local build tests/local/system.scm
	for f in $(local-files); do \
		diff -U5 --color=always result-local$$f tests/local$$f; \
	done
	touch result-local.sentinel

result-internet result-internet.sentinel: \
		result-packages.sentinel $(test-config-files)
	rm -f result-internet
	guix system -v3 -Lsrc/ -K -r result-internet build tests/internet/system.scm
	for f in $(internet-files); do \
		diff -U5 --color=always result-internet$$f tests/internet$$f; \
	done
	touch result-internet.sentinel


nix: default.nix result.sentinel

default.nix: paku.lock
	paku nix > $@

result result.sentinel: default.nix
	nix-build build.nix
	touch result.sentinel


debian.mk: paku.lock
	paku debian > $@

debian: debian.mk
	@$(MAKE) -f debian.mk

homebrew: Formula

Formula: paku.lock
	mkdir -p $@
	paku homebrew $@
	touch $@


public/debian: debian
	mkdir -p $(@D)
	rsync -avzP --delete `$(MAKE) -s -f debian.mk public-dir`/ $@/

public/paku.html: paku.lock
	mkdir -p $(@D)
	paku html > $@

public: public/debian public/paku.html

upload: public
	rsync -avzP --delete public/ euandre.org:/srv/www/s/package-repository/

clean:
	rm -rf \
		$(derived-assets) result* .paku/ public/ debian.mk             \
		src/bin/paku *.sentinel                                        \


HTTP-REMOTE = 'https://euandre.org/s/package-repository'
GIT-REMOTE  = 'git://euandre.org/package-repository'
check-ubuntu-x86_64-deb:
	sh tests/vm-check.sh -x -H ubuntu-x86_64-headless -r $(HTTP-REMOTE) -t deb

check-ubuntu-x86_64-homebrew:
	sh tests/vm-check.sh -x -H ubuntu-x86_64-headless -r $(GIT-REMOTE)  -t homebrew

check-ubuntu: check-ubuntu-x86_64-deb check-ubuntu-x86_64-homebrew

check-debian-x86_64-deb:
	sh tests/vm-check.sh -x -H debian-x86_64-headless -r $(HTTP-REMOTE) -t deb

check-debian: check-debian-x86_64-deb

check: check-ubuntu check-debian