aboutsummaryrefslogtreecommitdiffstats
path: root/include/depends.mk
diff options
context:
space:
mode:
authorChristian Marangi <ansuelsmth@gmail.com>2022-09-06 16:48:37 +0200
committerChristian Marangi <ansuelsmth@gmail.com>2022-12-04 16:07:33 +0100
commit360d756fbf01e0a051ff47223523deffae647afa (patch)
tree64693c83db65a8ec93e3381212ba0c7120524e47 /include/depends.mk
parent1392bec7de92888af06d98d11d306241b2e1f68f (diff)
downloadupstream-360d756fbf01e0a051ff47223523deffae647afa.tar.gz
upstream-360d756fbf01e0a051ff47223523deffae647afa.tar.bz2
upstream-360d756fbf01e0a051ff47223523deffae647afa.zip
build: make find_md5 reproducible with AUTOREMOVE
While experimenting with the AUTOREMOVE option in search of a way to use prebuilt host tools in different buildroot, it was discovered that the md5 generated by find_md5 in depends.mk is not reproducible. Currently the hash is generated by the path of the file in addition to the file mod time. Out of confusion, probably, there was an idea that such command was used on the package build_dir. Reality is that this command is run on the package files. (Makefile, patches, src) This is problematic because the package Makefile (for example) change at each git clone and base the hash on the Makefile mtime doesn't really reflect if the Makefile actually changes across a buildroot or not. A better approach is to generate an hash of each file and then generate an hash on the sort hash list. This way we remove the problem of git clone setting a wrong mtime while keeping the integrity of checking if a file changed for the package as any change will result in a different hash. Introduce a new kind of find_md5 function, find_md5_reproducible that apply this new logic and limit it only with AUTOREMOVE option set to prevent any kind of slowdown due to additional hash generation. (cherry picked from commit 53a08e37437972ba0a8fbf953a93a70a6b784ef4) [ reworked mkhash to old implementation ] Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Diffstat (limited to 'include/depends.mk')
-rw-r--r--include/depends.mk1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/depends.mk b/include/depends.mk
index 0080b97876..7b87f2643f 100644
--- a/include/depends.mk
+++ b/include/depends.mk
@@ -12,6 +12,7 @@
DEP_FINDPARAMS := -x "*/.svn*" -x ".*" -x "*:*" -x "*\!*" -x "* *" -x "*\\\#*" -x "*/.*_check" -x "*/.*.swp" -x "*/.pkgdir*"
find_md5=find $(wildcard $(1)) -type f $(patsubst -x,-and -not -path,$(DEP_FINDPARAMS) $(2)) -printf "%p%T@\n" | sort | mkhash md5
+find_md5_reproducible=find $(wildcard $(1)) -type f $(patsubst -x,-and -not -path,$(DEP_FINDPARAMS) $(2)) -print0 | xargs -0 mkhash md5 | sort | mkhash md5
define rdep
.PRECIOUS: $(2)