Skip to content

Commit 44df997

Browse files
committed
scripts/ext-tools.sh: set all prebuilt tool files to same timestamp
The GitHub CI was sometimes still building some tools again even when the same version was already pre-built. This change fixes the problem and should improve the speed of the GitHub CI actions. The duration of the "Build tools" step will be reduced from 5 to 20 minutes down to 10 to 15 seconds. make also checks that dependencies are not more recent than the target it wants to build. Previously find returned files in an arbitrary order and touch set the current timestamp. Since touch is called per file the timestamps differ in fractional seconds, so not all files got the same time. make detected a more recent dependency and started to rebuild. Now all files are set to the same timestamp and make will assume everything is up to date. It is sufficient to only touch the stamp files to prevent rebuilding. Link: openwrt/openwrt#22888 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> (cherry picked from commit cd6cb9f)
1 parent c77f9c8 commit 44df997

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

scripts/ext-tools.sh

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ TOOLS_TAR=""
44
HOST_BUILD_DIR=$(pwd)/"build_dir/host"
55
HOST_STAGING_DIR_STAMP=$(pwd)/"staging_dir/host/stamp"
66

7-
refresh_timestamps() {
8-
find -H "$1" -not -type l -print0 | xargs -0 touch
9-
}
10-
117
extract_prebuilt_tar() {
128
tar -xf "$1"
139
}
@@ -18,15 +14,15 @@ refresh_prebuilt_tools() {
1814
exit 1
1915
fi
2016

21-
refresh_timestamps "$HOST_BUILD_DIR"
22-
sleep 1
23-
2417
if [ ! -d "$HOST_STAGING_DIR_STAMP" ]; then
2518
echo "Can't find Host Staging Dir Stamp "$HOST_STAGING_DIR_STAMP"" >&2
2619
exit 1
2720
fi
2821

29-
refresh_timestamps "$HOST_STAGING_DIR_STAMP"
22+
local now
23+
now=$(date +%Y%m%d%H%M.%S)
24+
find -H "$HOST_BUILD_DIR" "$HOST_STAGING_DIR_STAMP" \
25+
-type f -empty -print0 | xargs -0 touch -t "$now"
3026

3127
return 0
3228
}

0 commit comments

Comments
 (0)