summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2020-04-04 12:10:14 +0200
committerMichael Olbrich <m.olbrich@pengutronix.de>2020-04-04 14:34:43 +0200
commit8353ef2b77d0004d6e898929927d82185ce595ef (patch)
treefaaa746d62887e03e08de456c35f86a4f7c0d894 /scripts
parentc87d9ee321177188f291fe16450284af8cc7dc19 (diff)
downloadptxdist-8353ef2b77d0004d6e898929927d82185ce595ef.tar.gz
ptxdist-8353ef2b77d0004d6e898929927d82185ce595ef.tar.xz
ptxd_make_pkghash: improve hash creation
The are some subtle issues with the code that are fixed here. If multiple packages have the same patches, e.g. host and target, then the patches where added twice. Deduplicate the directories to to avoid searching twice. Search with '-L' to follow any symlinks. We want the real content here. Use the correct way to iterate over the list. Otherwise the order depends on the awk version. Don't search the current directory if no patches are found. Don't sort the config files. The order is stable and sorting may changes depending on the paths for PTXdist and BSP. Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/lib/ptxd_make_pkghash.awk28
1 files changed, 19 insertions, 9 deletions
diff --git a/scripts/lib/ptxd_make_pkghash.awk b/scripts/lib/ptxd_make_pkghash.awk
index d694c9868..2ecae47b4 100755
--- a/scripts/lib/ptxd_make_pkghash.awk
+++ b/scripts/lib/ptxd_make_pkghash.awk
@@ -46,8 +46,8 @@ function dump_file(src, dst, tmp) {
END {
for (pkg in rules) {
f1 = PTXDIST_TEMPDIR "/pkghash-" pkg
- split(rules[pkg], cfgs)
- for (rule in cfgs) {
+ n = split(rules[pkg], cfgs)
+ for (rule = 1; rule <= n; rule++) {
dump_file(cfgs[rule], f1)
printf "\n" >> f1
}
@@ -55,25 +55,35 @@ END {
for (pkg in configs) {
config = configs[pkg]
f1 = PTXDIST_TEMPDIR "/pkghash-" pkg
- split(configs[pkg], cfgs)
- asort(cfgs, cfgs)
- for (config in cfgs)
+ n = split(configs[pkg], cfgs)
+ for (config = 1; config <= n; config++)
dump_file(cfgs[config], f1)
}
- command = "find " dirs " -type f ! -name '.*' -printf '%H %P\\n'"
+ if (dirs == "")
+ exit;
+ n = split(dirs, dir_array, " ");
+ asort(dir_array, dir_array);
+ dirs = ""
+ last = ""
+ for (i = 1; i <= n; i++) {
+ if (dir_array[i] != last)
+ dirs = dirs " " dir_array[i]
+ last = dir_array[i]
+ }
+ command = "find -L " dirs " -type f ! -name '.*' -printf '%H %P\\n'"
while (command | getline)
files[$1] = files[$1] " " $2
close(command)
for (dir in pkgs) {
split(pkgs[dir], list, " ")
- split(files[dir], file_list, " ")
+ n = split(files[dir], file_list, " ")
asort(file_list, file_list)
for (pkg in list) {
pkg = list[pkg]
f1 = PTXDIST_TEMPDIR "/pkghash-" pkg
f2 = PTXDIST_TEMPDIR "/pkghash-" pkg "_EXTRACT"
- for (file in file_list) {
- file = dir "/" file_list[file]
+ for (i = 1; i <= n; i++) {
+ file = dir "/" file_list[i]
dump_file(file, f1)
dump_file(file, f2)
}