aboutsummaryrefslogblamecommitdiff
path: root/Makefile
blob: 1d13b24cd9b7bbd8d963ea04286080e3c1d76beb (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
       
 
 









                                                
 
                     


                                                 


                              
                              
                              

 
                                                      
 





                                            


                                
 


                                                     
                                                                 
                           
                


                                  
 
 
                                       
                                                
 

                                                                      

                                                     
                                                 
                                            
                                      
 


                                                                        
                                                            

                                                                              
                                   
 
                                                                  

                                                                                    
                                      

 
                    
 


                           
                      
                     
 
                                   
                           
                             
 
 
                    
                        
 
                          
                             
                


                       
 






                             

                                   

 
                 
 
                  
                 
                   
                        

                
 
                              

                                     
                
 
                              
                 



                                     
                           
                      
                      
 
                                                    
 


                                                                               


                                  
                

                                                                                

 
                 
                                     
 









                                   
                                                                               






                                                                               

                                  
                        
                                                                                           
 
                             
                                                                                                
 

                                                                  




                                                                                  
                                     
                                                                                                                     



                                                                         
.POSIX:


.SUFFIXES:
.SUFFIXES: .in

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



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) \
	src/bin/paku         \
	public               \


all: guix nix debian alpine homebrew $(derived-assets)


refresh: src/bin/paku
	paku refresh < paku.json > paku.lock



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


guix: guix.sentinel

guix.sentinel: src/org/euandre/packages.scm guix.mk \
		result-packages.sentinel result-services.sentinel
	@$(MAKE) -f guix.mk
	touch $@

guix.mk: paku.lock
	paku guix-channel-key > $@


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

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
	touch result-local.sentinel

result-internet result-internet.sentinel: result-packages.sentinel
	rm -f result-internet
	guix system -v3 -Lsrc/ -K -r result-internet build tests/internet/system.scm
	touch result-internet.sentinel


nix: result.sentinel

build.nix: paku.lock
	paku build-nix > $@

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.sentinel: debian.mk
	@$(MAKE) -f debian.mk
	touch $@

debian: debian.sentinel


alpine: alpine.sentinel

alpine.sentinel: alpine.mk
	@$(MAKE) -f alpine.mk
	touch $@

alpine.mk: paku.lock
	mkdir -p src/alpine
	paku alpine src/alpine > $@


homebrew: Formula

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


public/debian: debian.sentinel
	mkdir -p $@
	cp -R `cat debian.out.txt` $@
	touch $@

public/alpine: alpine.sentinel
	rm -rf $@
	mkdir -p $@
	cp -R `cat alpine.out.txt` $@
	touch $@

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

public: public/debian public/alpine public/paku.html

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


clean: src/bin/paku
	rm -rf "`paku -C datadir`"
	rm -rf \
		$(derived-assets) result* *.mk *.sentinel *.out.txt            \
		src/secrets/*.rsa


check-shellcheck:
	sh tests/assert-shellcheck.sh

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 \

check-guix: result-local.sentinel result-internet.sentinel $(test-config-files)
	for f in $(local-files); do \
		diff -U5 --color=always result-local$$f tests/local$$f; \
	done
	for f in $(internet-files); do \
		diff -U5 --color=always result-internet$$f tests/internet$$f; \
	done

HTTP-REMOTE = "`paku -C base-url`"
GIT-REMOTE  = "`paku -C vcs.http`"
check-ubuntu-x86_64-deb:
	sh tests/vm-check.sh -x -H ubuntu-x86_64-headless-deb      -r $(HTTP-REMOTE) -t deb

check-ubuntu-x86_64-homebrew:
	sh tests/vm-check.sh -x -H ubuntu-x86_64-headless-homebrew -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-alpine-x86_64-apk: src/bin/paku
	sh tests/vm-check.sh -x -H alpine-x86_64-headless -r $(HTTP-REMOTE) -t apk -- -k "`paku -C maintainer.email`"

check-alpine: check-alpine-x86_64-apk

check: check-shellcheck check-guix check-ubuntu check-debian check-alpine