Skip to content

Commit

Permalink
Merge pull request #9130 from Agoric/ta/stamp-filename
Browse files Browse the repository at this point in the history
refactor: actually clearer stamps file name
  • Loading branch information
mergify[bot] authored Mar 22, 2024
2 parents 0b0694a + 2b4bef0 commit abd1d03
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions .github/actions/restore-node/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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.
Expand Down
18 changes: 9 additions & 9 deletions bin/agd
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
}

Expand Down Expand Up @@ -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() {
Expand All @@ -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" || {
Expand Down

0 comments on commit abd1d03

Please sign in to comment.