From 4ffb9da917fc9721e4a0f6d2c3628c933259a9d6 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Mon, 20 Jul 2020 00:49:49 +0200 Subject: [PATCH] Add a "build-cache" not to re-build packages on every run Signed-off-by: Knut Ahlers --- .gitignore | 1 + scripts/update-repo.sh | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/.gitignore b/.gitignore index fb781a6..9d95c2e 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ *.db.sig *.files *.files.sig +.repo_cache *.tar.xz *.tar.xz.sig *.tar.zst diff --git a/scripts/update-repo.sh b/scripts/update-repo.sh index 1eb95f0..eadf76f 100755 --- a/scripts/update-repo.sh +++ b/scripts/update-repo.sh @@ -8,6 +8,13 @@ REPO_DIR=${REPO_DIR:-$(pwd)} REPO=${1:-} [ -z "${REPO}" ] && fail "No repo given as CLI argument" +step "Checking for changes from last build" +last_remote_hash=$(git ls-remote ${REPO} master | awk '{print $1}') +grep "${REPO}#${last_remote_hash}" .repo_cache && { + warn "Remote has no changes from last build, skipping..." + exit 0 +} || true + # Create working dir TMPDIR="/tmp/aur2repo_$(basename ${REPO})" mkdir -p "${TMPDIR}/cfg" @@ -32,3 +39,8 @@ docker run --rm -ti \ -v "$(pwd)/scripts/pacman.conf:/etc/pacman.conf:ro" \ luzifer/arch-repo-builder \ "${REPO}" + +step "Updating cache entry" +grep -v "^${REPO}#" .repo_cache >.repo_cache.tmp || true +echo "${REPO}#${last_remote_hash}" >>.repo_cache.tmp +mv .repo_cache.tmp .repo_cache