Commit Graph
10 Commits
Author SHA1 Message Date
John Crispin b5c4b58764 build: let find answer the rebuild question
The -n caller of timestamp.pl only needs to know whether the stamp is the
newest file. The script reads the timestamp of every file to answer that,
which costs 0.09 s for the build directory of U-Boot with its 44000 files.
The rebuild check runs the script twice per package and per build.

Collect the paths first, and for -n ask find for the first file that is
newer than the stamp. find stops at that file, so the walk ends early when
there is work to do. The other modes keep the old code, and so does -n with
-follow, because find and the script treat a symbolic link to a file
differently there.

The check over the U-Boot build directory now takes 0.02 s. The result is
the same for all 44 build directories of the OpenWrt One. The time of a full
no-op build does not change on a machine with 24 cores, where the package
step waits for the dependency chain rather than for the checks.

Signed-off-by: John Crispin <john@phrozen.org>
2026-09-22 18:18:58 +02:00
John Crispin 3cf47c5c17 build: compare timestamps with a fraction of a second
timestamp.pl decides whether a subdir has work to do. It scans the stamp
file and the source directories, keeps the newest, and reports that the
work is done when the newest one is the stamp. The scan reads the mtime
through the core stat of perl, which truncates it to whole seconds, and
the comparison is strict with the stamp scanned first. Two files that
share a second therefore count as a tie, and a tie says that the work is
done.

include/subdir.mk touches tmp/.build at the start of a build and the
stamp of a subdir at the end, so the two land in the same second once a
build takes less than a second between them. The target install stamp is
the last one of a build, roughly 0.4 s before the build ends, so it is
the one that ties first: the next build then skips target/install and
ships the images of the previous build. Around one build in five was
affected once the build became fast enough.

Read the mtime through Time::HiRes, which reports the fraction as well.
Two touches around a fork no longer share a timestamp. Keep the core
stat where the module is missing, which restores the old behaviour
rather than failing.

Signed-off-by: John Crispin <john@phrozen.org>
2026-09-22 18:18:58 +02:00
Felix Fietkau 091934e7fb fix timestamp checks for build system paths which have '.svn' in their directory name
SVN-Revision: 20856
2010-04-14 22:21:15 +00:00
Ralph Hempel f9d0fb8a16 ensure that the timestamp script will follow the path even if it is link ( in our case the build directory might be a link to a ClearCase dynamic view )
SVN-Revision: 14728
2009-03-02 17:38:08 +00:00
Felix Fietkau 625b692c1f use #!/usr/bin/env perl instead of #!/usr/bin/perl in openwrt scripts (fixes #2998)
SVN-Revision: 12674
2008-09-23 18:29:44 +00:00
Nicolas Thill 916e33b59e change case of conflicting option
SVN-Revision: 8579
2007-09-03 05:02:05 +00:00
Felix Fietkau 5f748a6c24 clean up recursive dependency handling, use timestamp.pl again, because it saves memory and execution time
SVN-Revision: 8558
2007-08-30 21:12:39 +00:00
Felix Fietkau d475d94aab avoid rdep in the top level make process (subdir.mk) - it leaks too much memory and increases the startup time for regular make commands. timestamp.pl is more lightweight here
SVN-Revision: 8533
2007-08-29 03:51:49 +00:00
Felix Fietkau 0e3a29c270 Fix the annoying base-files autorebuild bug. When checking file mtimes in directories, timestamp.pl was following symlinks. This broke on base-files, because there are symlinks to /tmp and to /proc/mounts in the build directory.
SVN-Revision: 6084
2007-01-12 11:09:05 +00:00
Felix Fietkau 60c1f0f64d finally move buildroot-ng to trunk 2016-03-20 17:29:15 +01:00