When rebuilding a package, OpenWRT build system uses a complex set of
routines to check weither it must rebuild the dependent packages or skip
them and only rebuild the package. This smartly optimizes the build
time.
To do so, each dependent package calls the macro Build/Autoclean
(defined in include/package.mk).
This macro calls twice the `rdep` macro (defined in include/depends.mk):
1. To check if a reconfiguration is needed:
* if one of its files have changed (handled by .deps_file hash)
* if timestamp of any of its files is newer than the stamp .configured_<hash>
When this check is done, a new stamp file ".configured_<hash>_check is
created. If a configuration should take place, the timestamp of the
stamp check file becomes newer than the .configured_<hash> file: it
triggers a new package reconfiguration.
2. To check if a rebuild is needed:
* if timestamp of any of its files is newer than the stamp .built
When this check is done, a new stamp file ".built_check is created. If a
rebuild should take place, the timestamp of the stamp check file becomes
newer than .built triggering anew package build.
The rdep check already excludes a set of files that are generated after
the .built stamp file (like ipkg*).
When the 'security' profiles is loaded,
CONFIG_JSON_CHECKSEC_MITIGATIONS_REPORT is set and make all
packages generate a checksec report in their package build di (e.g.
<pkg_build_dir>/CHECKSEC).
This folder and its children files are generated after the .built file.
On next build, OpenWRT detects that checksec reports are newer than
.built file and trigger a rebuild of that component. This should not be
the case since this is not a file generated by the package itself!
Let's exclude the files of the CHECKSEC folder from the build check
mechanism to avoid unecessary rebuilds.
References: PPW-1414
Signed-off-by: Cedric CHEDALEUX <cedric.chedaleux@orange.com>