From c459c71c4a778eac007f7e541cc9831fadde2a3c Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 4 Oct 2026 23:25:25 +0200 Subject: [PATCH] scripts/ext-tools.sh: refresh the stamps with a sub-second timestamp The GitHub CI spends 10 to 18 minutes rebuilding all host tools in most "Check Kernel patches" jobs, although the tools container ships them prebuilt. Before, the "Build tools" step took about 10 seconds. The refresh sets all stamps to one time given to touch -t, which has a resolution of a full second, so the fraction is zero. The CI job runs the refresh about 0.2 seconds after actions/checkout finished, and git writes the tools directory last. Its files therefore often get a timestamp in the same second as the stamps, but after the full second. Since timestamp.pl compares the fraction of a second, these source files are newer than the stamps and every tool gets cleaned and built again. Take the time from a freshly created temporary file and set all stamps to it with touch -r. They still share one timestamp, but it now includes the fraction and is always later than the checkout. Fixes: 3cf47c5c17dc ("build: compare timestamps with a fraction of a second") Assisted-by: Claude:claude-opus-5-5 Link: https://github.com/openwrt/openwrt/pull/25626 Signed-off-by: Hauke Mehrtens --- scripts/ext-tools.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/ext-tools.sh b/scripts/ext-tools.sh index f290ae0c483..2d88758789b 100755 --- a/scripts/ext-tools.sh +++ b/scripts/ext-tools.sh @@ -19,10 +19,11 @@ refresh_prebuilt_tools() { exit 1 fi - local now - now=$(date +%Y%m%d%H%M.%S) + local ref + ref=$(mktemp) find -H "$HOST_BUILD_DIR" "$HOST_STAGING_DIR_STAMP" \ - -type f -empty -print0 | xargs -0 touch -t "$now" + -type f -empty -print0 | xargs -0 touch -r "$ref" + rm -f "$ref" return 0 }