From 71e6115c86a603e9a6c27d371efbb94575d557d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Mon, 1 Mar 2021 11:35:48 +0100 Subject: turris: do not rebuild if not needed This hould make building HBT and HBS viable as I would not waste resources on building those feeds every night. --- templates/turris.run | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/templates/turris.run b/templates/turris.run index 58a4714..0e98531 100755 --- a/templates/turris.run +++ b/templates/turris.run @@ -18,7 +18,18 @@ shift # Shift --locked curl "https://repo.turris.cz/$ANIMAL/$BOARD/packages/git-hash" > git-hash cat git-hash -if [ -z "$CLEAN" ] && [ -f "$WORKSPACE/openwrt-git-hash" ] && cmp -s git-hash "$WORKSPACE/openwrt-git-hash"; then +new_upstream="n" +cmp -s git-hash "$WORKSPACE/openwrt-git-hash" || new_upstream="y" + +latest_master="$(echo list \ + | git remote-https https://git.cynerd.cz/openwrt-personal-pkgs \ + | awk '$2 == "refs/heads/master" { print $1 }')" +if [ "$new_upstream" = "n" ] && [ "$latest_master" = "$(cat "$WORKSPACE/personal-git-hash")" ]; then + echo_info "Latest version of personal packages is already build." + exit 0 +fi + +if [ -z "$CLEAN" ] && [ -f "$WORKSPACE/openwrt-git-hash" ] && [ "$new_upstream" = "n" ]; then echo_info "Using previous version of SDK" tar -xzf "$WORKSPACE/openwrt.tar.gz" else @@ -79,3 +90,4 @@ ssh upload /bin/sh -se "$ANIMAL" "$BOARD" <<"EOF" rm -rf "/var/www/repo/turris/$1/$2" mv "deploy-turris-$1-$2" "/var/www/repo/turris/$1/$2" EOF +echo "$latest_master" > "$WORKSPACE/personal-git-hash" -- cgit v1.2.3