From: Pierre Schmitz <pie...@archlinux.de> (cherry picked from commit 59d495b55f52253518fe1a184627e7259034f978) --- test/Makefile | 6 ++++-- test/lib/common.bash | 25 +++++++++++++++++++------ 2 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/test/Makefile b/test/Makefile index d9437bf..5ed3910 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,8 +1,10 @@ +PACKAGE_CACHE:=$(shell mktemp -d) + test: - PATH=$(CURDIR)/../:$(CURDIR)/../cron-jobs/:$(PATH) bats cases + PATH=$(CURDIR)/../:$(CURDIR)/../cron-jobs/:$(PATH) PACKAGE_CACHE=$(PACKAGE_CACHE) bats cases test-coverage: - PATH=$(CURDIR)/../:$(CURDIR)/../cron-jobs/:$(PATH) kcov \ + PATH=$(CURDIR)/../:$(CURDIR)/../cron-jobs/:$(PATH) PACKAGE_CACHE=$(PACKAGE_CACHE) kcov \ --include-path=$(CURDIR)/../ \ --exclude-path=$(CURDIR)/../test,$(CURDIR)/../cron-jobs/makepkg.conf,$(CURDIR)/../config \ $(COVERAGE_DIR) \ diff --git a/test/lib/common.bash b/test/lib/common.bash index c61c948..7704098 100644 --- a/test/lib/common.bash +++ b/test/lib/common.bash @@ -8,22 +8,30 @@ die() { exit 1 } +__getCheckSum() { + local result=($(sha1sum $1)) + echo ${result[0]} +} + __buildPackage() { local arch=$1 local pkgver local pkgname local a local p + local checkSum + + if [[ -n ${PACKAGE_CACHE} ]]; then + checkSum=$(__getCheckSum PKGBUILD) + # TODO: Be more specific + if cp -av ${PACKAGE_CACHE}/${checkSum}/*-${arch}${PKGEXT}{,.sig} .; then + return 0 + fi + fi pkgname=($(. PKGBUILD; echo "${pkgname[@]}")) pkgver=$(. PKGBUILD; get_full_version) - for p in "${pkgname[@]}"; do - if [ -f "${p}-${pkgver}-${arch}"${PKGEXT} ]; then - return 0 - fi - done - if [ "${arch}" == 'any' ]; then sudo librechroot -n "dbscripts@${arch}" make else @@ -36,6 +44,11 @@ __buildPackage() { gpg --detach-sign --no-armor --use-agent "$file" done done + + if [[ -n ${PACKAGE_CACHE} ]]; then + mkdir -p ${PACKAGE_CACHE}/${checkSum} + cp -av *-${arch}${PKGEXT}{,.sig} ${PACKAGE_CACHE}/${checkSum}/ + fi } setup() { -- 2.16.2 _______________________________________________ Dev mailing list Dev@lists.parabola.nu https://lists.parabola.nu/mailman/listinfo/dev