2019-09-11 08:41:07 +00:00
|
|
|
SRC := ./BuildSourceImage.sh
|
2019-09-11 09:45:53 +00:00
|
|
|
CTR_IMAGE := localhost/containers/buildsourceimage
|
2019-09-11 09:13:02 +00:00
|
|
|
CTR_ENGINE ?= podman
|
2019-09-19 11:50:30 +00:00
|
|
|
BATS_OPTS ?=
|
2019-09-18 13:15:45 +00:00
|
|
|
cleanfiles =
|
2019-09-18 15:35:34 +00:00
|
|
|
# these are packages whose src.rpms are very small
|
|
|
|
srpm_urls = \
|
|
|
|
https://archive.kernel.org/centos-vault/7.0.1406/os/Source/SPackages/basesystem-10.0-7.el7.centos.src.rpm \
|
|
|
|
https://archive.kernel.org/centos-vault/7.0.1406/os/Source/SPackages/rootfiles-8.1-11.el7.src.rpm \
|
|
|
|
https://archive.kernel.org/centos-vault/7.0.1406/os/Source/SPackages/centos-bookmarks-7-1.el7.src.rpm
|
|
|
|
srpms = $(addprefix ./.testprep/srpms/,$(notdir $(rpms)))
|
2019-09-11 08:41:07 +00:00
|
|
|
|
2019-09-19 11:50:30 +00:00
|
|
|
export CTR_IMAGE
|
|
|
|
export CTR_ENGINE
|
|
|
|
|
2019-09-11 08:41:07 +00:00
|
|
|
all: validate
|
|
|
|
|
2019-09-18 13:15:45 +00:00
|
|
|
validate: .validate
|
2019-09-11 09:45:53 +00:00
|
|
|
|
2019-09-18 13:15:45 +00:00
|
|
|
cleanfiles += .validate
|
|
|
|
.validate: $(SRC)
|
|
|
|
shellcheck $(SRC) && touch $@
|
|
|
|
|
|
|
|
build-container: .build-container
|
|
|
|
|
|
|
|
cleanfiles += .build-container
|
|
|
|
.build-container: .validate Dockerfile $(SRC)
|
2019-09-11 09:13:02 +00:00
|
|
|
@echo
|
2019-09-18 15:35:34 +00:00
|
|
|
@echo "==> Building BuildSourceImage Container"
|
2019-09-18 13:15:45 +00:00
|
|
|
$(CTR_ENGINE) build --quiet --file Dockerfile --tag $(CTR_IMAGE) . && touch $@
|
2019-09-11 09:13:02 +00:00
|
|
|
|
2019-09-18 15:35:34 +00:00
|
|
|
cleanfiles += .testprep $(srpms)
|
|
|
|
.testprep:
|
|
|
|
@echo "==> Fetching SRPMs for testing against"
|
|
|
|
mkdir -p $@/{srpms,tmp}
|
|
|
|
wget -P $@/srpms/ $(srpm_urls)
|
|
|
|
|
2019-09-11 09:13:02 +00:00
|
|
|
.PHONY: test-integration
|
2019-09-18 15:35:34 +00:00
|
|
|
test-integration: .build-container .testprep
|
2019-09-11 09:13:02 +00:00
|
|
|
@echo
|
2019-09-18 15:35:34 +00:00
|
|
|
@echo "==> Running integration tests"
|
2019-09-19 11:50:30 +00:00
|
|
|
TMPDIR=$(shell realpath .testprep/tmp) bats $(BATS_OPTS) test/
|
2019-09-18 13:15:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
clean:
|
|
|
|
if [ -n "$(cleanfiles)" ] ; then rm -rf $(cleanfiles) ; fi
|