diff options
author | Matt Jolly <kangie@gentoo.org> | 2024-10-23 13:47:39 +1000 |
---|---|---|
committer | Matt Jolly <kangie@gentoo.org> | 2024-10-23 13:48:04 +1000 |
commit | 8325458dc3fc907432f50d0710909cba9144834e (patch) | |
tree | 96e087cae24a53e1c74b162c30567cdb7cb8e36b | |
parent | Make sure we don't match substrings and loop forever (diff) | |
download | chromium-tools-8325458dc3fc907432f50d0710909cba9144834e.tar.gz chromium-tools-8325458dc3fc907432f50d0710909cba9144834e.tar.bz2 chromium-tools-8325458dc3fc907432f50d0710909cba9144834e.zip |
Fail after a (configurable) timeout
If we make it more than say 5 minutes we've probably gotten past
the point where GN would complain and any failures are likely to
require actual dev effort.
Just die with an error at that point to save on electricity.
Signed-off-by: Matt Jolly <kangie@gentoo.org>
-rwxr-xr-x | iterate-over-ebuild.sh | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/iterate-over-ebuild.sh b/iterate-over-ebuild.sh index 9d0d479..7cd0f64 100755 --- a/iterate-over-ebuild.sh +++ b/iterate-over-ebuild.sh @@ -9,6 +9,7 @@ package="${1%.ebuild}" tmpfile=$(mktemp) iter=0 added=() +timeout_secs=300 # Trap for Ctrl+C trap 'cleanup' INT @@ -20,6 +21,7 @@ cleanup() { } while true; do + start_time=$(date +%s) libs=() echo "[$(date)]: Processing $package; iteration $((++iter))" echo "So far, we've added:" @@ -54,6 +56,15 @@ while true; do rm "$tmpfile" break fi + + end_time=$(date +%s) + elapsed_time=$((end_time - start_time)) + if [ $elapsed_time -gt $timeout_secs ]; then + echo "[$(date)]: Ebuild execution took longer than the timeout. This is likely a build failure that requires patching. Exiting." + echo "$tmpfile" for this iteration\'s logs. + exit 1 + fi + # Start with a clean slate for the next iteration rm "$tmpfile" done |