diff --git a/.github/actions/restore-node/action.yml b/.github/actions/restore-node/action.yml index f1d2b77cad4..e86de4d7008 100644 --- a/.github/actions/restore-node/action.yml +++ b/.github/actions/restore-node/action.yml @@ -150,12 +150,12 @@ runs: function diffsha1() { stamp=$1 shift - find ${1+"$@"} -exec sha1sum {} \; | sort +1 > "$stamp.files" || true - if test ! -s "$stamp.files"; then + find ${1+"$@"} -exec sha1sum {} \; | sort +1 > "$stamp.new" || true + if test ! -s "$stamp.new"; then echo "No new dependencies found for $stamp" 1>&2 return 0 fi - diff -u "$stamp" "$stamp.files" || return 1 + diff -u "$stamp" "$stamp.new" || return 1 return 0 } @@ -171,9 +171,9 @@ runs: mkdir -p "$STAMPS" sum="$STAMPS/yarn-installed.sum" diffsha1 "$sum" "${files[@]}" || { - mv "$sum.files" "$sum" + mv "$sum.new" "$sum" } - rm -f "$sum.files" + rm -f "$sum.new" if test -e ~/endo; then # Stage the redirected `yarn install` consequences. diff --git a/bin/agd b/bin/agd index 1b2cf85281b..85d24b0e872 100755 --- a/bin/agd +++ b/bin/agd @@ -28,7 +28,7 @@ done # diffsha1 stamp_name find_args... # executes find(1) with the given arguments and saves the resulting file list, -# then runs $DIGEST_CMD on the file list, saves the digest to file stamp_name.files, +# then runs $DIGEST_CMD on the file list, saves the digest to file stamp_name.new, # and compares to the saved digest in the file stamp_name. # Returns success (0) if it cannot write to the temporary files, if the find results are empty, # or if the computed digest is the same as the saved digest. @@ -42,13 +42,13 @@ function diffsha1() { rm -f "$stamp.files.$$" return 0 fi - xargs $DIGEST_CMD <"$stamp.files.$$" | sort +1 > "$stamp.files" || true + xargs $DIGEST_CMD <"$stamp.files.$$" | sort +1 > "$stamp.new" || true rm -f "$stamp.files.$$" - if test ! -s "$stamp.files"; then - rm -f "$stamp.files" + if test ! -s "$stamp.new"; then + rm -f "$stamp.new" return 0 fi - diff -u "$stamp" "$stamp.files" || return 1 + diff -u "$stamp" "$stamp.new" || return 1 return 0 } @@ -177,8 +177,8 @@ ${NO_BUILD:-false} || ( fi ) } - test -f "$sum" || mv -f "$sum.files" "$sum" - rm -f "$sum.files" + test -f "$sum" || mv -f "$sum.new" "$sum" + rm -f "$sum.new" if $need_nodejs; then lazy_yarn() { @@ -204,9 +204,9 @@ ${NO_BUILD:-false} || ( diffsha1 "$sum" "${files[@]}" || { echo "$sum has changed"; $do_not_build; } || { rm -f "$sum" "$STAMPS/yarn-built" lazy_yarn install - mv "$sum.files" "$sum" + mv "$sum.new" "$sum" } - rm -f "$sum.files" + rm -f "$sum.new" stamp=$STAMPS/yarn-built test -e "$stamp" || {