Makefile 1.18 KB
Newer Older
1
-include conf.mk
Natanael Copa's avatar
Natanael Copa committed
2 3 4 5 6 7 8 9

repos	:= repo1 repo2

tmproot := /tmp/apk-test
testroot = $(tmproot)/$(basename $@)

SUDO	:= sudo
APK	:= ../src/apk --keys-dir /etc/apk/keys
10 11

SYSREPO ?= http://alpinelinux.org/cgi-bin/dl.cgi/edge/main
Natanael Copa's avatar
Natanael Copa committed
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

LD_LIBRARY_PATH = ../src
export LD_LIBRARY_PATH SYSREPO

all:	tests

$(repos):
	@echo "Building $@"
	@rm -f repos.out
	@cd $@ &&\
		for i in */APKBUILD; do\
			( cd $${i%/*} && \
			PKGDEST="$$PWD/.." abuild -R ) >> ../repos.out 2>&1 || exit 1;\
		done
	@cd $@ &&\
		( apk index -o APKINDEX.tar.gz *.apk &&\
		abuild-sign APKINDEX.tar.gz ) >> ../repos.out 2>&1


clean:
	$(SUDO) rm -rf $(addsuffix /*.apk,$(repos)) $(tmproot) *.ok *.out *.stamp


repos: repos.stamp
	
repos.stamp: $(repos)
	@touch $@
	

%.ok: %.sh
	@echo -n "$<"; \
		rm -rf "$(testroot)" ;\
		mkdir -p "$(testroot)"; \
45
		if ! APK="$(APK)" ROOT="$(testroot)" SYSREPO="$(SYSREPO)" ./$< > $(basename $@).out 2>&1; then\
Natanael Copa's avatar
Natanael Copa committed
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
			echo " FAIL";\
			exit 1;\
		fi ;\
		echo " OK" ;\
		$(SUDO) rm -rf $(testroot); \
		touch $@

tests: repos.stamp
	@echo "== Testing `$(APK) --version` =="
	@for i in test*.sh; do \
		rm -f $${i%.sh}.ok ;\
		$(SUDO) $(MAKE) --no-print-directory $${i%.sh}.ok SYSREPO=$(SYSREPO); \
	done

.PHONY:	$(repos)