diff --git a/bin/agd b/bin/agd index facec9f1c01..8f9a5ea02ed 100755 --- a/bin/agd +++ b/bin/agd @@ -45,7 +45,7 @@ fi NEED_NODEJS=$BUILD_ONLY case $@ in -*" start" | *" start "*) +start | *" start" | *" start "*) # We're starting the daemon, so we need Node.js. NEED_NODEJS=true ;; @@ -110,14 +110,8 @@ fi yarn "$@" } - # Check if any package.json is newer than the installation stamp. - stamp=$STAMPS/yarn-installed - if test -e "$stamp"; then - print=( -newer "$stamp" ) - else - print=() - fi - print+=( -print ) + # Check if any package.json sums are different. + sum=$STAMPS/yarn-installed.sum # Find the current list of package.jsons. files=( package.json ) @@ -126,14 +120,14 @@ fi done < <(lazy_yarn -s workspaces info | sed -ne '/"location":/{ s/.*": "//; s!",.*!/package.json!; p; }') - src=$(find "${files[@]}" "${print[@]}" | head -1 || true) - test -z "$src" || { - echo "At least $src is newer than $stamp" - ls -l "$src" "$stamp" || true - rm -f "$STAMPS/yarn-built" + find "${files[@]}" -print0 | xargs -0 sha1sum | sort +1 > "${sum}T" || true + diff -u "$sum" "${sum}T" || { + echo "$sum has changed" + rm -f "$sum" "$STAMPS/yarn-built" lazy_yarn install - date > "$stamp" + mv "${sum}T" "$sum" } + rm -f "${sum}T" stamp=$STAMPS/yarn-built test -e "$stamp" || { @@ -143,18 +137,15 @@ fi } fi - stamp=$GOLANG_DAEMON - if test -e "$stamp"; then - print=( -newer "$stamp" ) - else - print=() - fi - print+=( -print ) - src=$(find "$GOLANG_DIR" \( ! -name '*_test.go' -name '*.go' -o -name '*.cc' -o -name 'go.*' \) "${print[@]}" | head -1 || true) - test -z "$src" || { - echo "At least $src is newer than $stamp" - ls -l "$src" "$stamp" || true - + sum=$STAMPS/golang-built.sum + find "$GOLANG_DIR" \( \ + ! -name '*_test.go' -name '*.go' \ + -o -name '*.cc' \ + -o -name 'go.*' \) \ + -print0 | xargs -0 sha1sum | sort +1 > "${sum}T" || true + diff -u "$sum" "${sum}T" || { + echo "$GOLANG_DIR $sum has changed" + rm -f "$sum" ( # Run this build in another subshell in case we had to modify the path. case $(go version 2>/dev/null) in @@ -184,7 +175,9 @@ fi cd "$GOLANG_DIR" make ) + mv "${sum}T" "$sum" } + rm -f "${sum}T" ) # the xsnap binary lives in a platform-specific directory