summaryrefslogtreecommitdiffstats
path: root/scripts/libptxdist.sh
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2018-07-20 14:24:16 +0200
committerMichael Olbrich <m.olbrich@pengutronix.de>2018-09-20 11:03:54 +0200
commit4726f38b3cbb3ab857fabf9e273f84df3d7d04e9 (patch)
tree8332cf075a650193d9feecdffcfc500e900b664e /scripts/libptxdist.sh
parent01e7418d4aa4ea2550ed1638157205b9d866b959 (diff)
downloadptxdist-4726f38b3cbb3ab857fabf9e273f84df3d7d04e9.tar.gz
ptxdist-4726f38b3cbb3ab857fabf9e273f84df3d7d04e9.tar.xz
ptxd_get_alternative: add layer support
This just extends the search list to include all layers. Each layer has the usual BSP search paths. If a file is not found on one layer, then the previous layer is checked. Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'scripts/libptxdist.sh')
-rw-r--r--scripts/libptxdist.sh39
1 files changed, 25 insertions, 14 deletions
diff --git a/scripts/libptxdist.sh b/scripts/libptxdist.sh
index cd59e5dd8..aa23530b2 100644
--- a/scripts/libptxdist.sh
+++ b/scripts/libptxdist.sh
@@ -510,6 +510,29 @@ ptxd_replace_link() {
}
export -f ptxd_replace_link
+ptxd_get_alternative_list() {
+ local prefix="${1%/}"
+ local file="${2#/}"
+ local -a layers
+ [ -n "${prefix}" -a -n "${file}" ] || return
+
+ ptxd_in_path PTXDIST_PATH_LAYERS
+ layers=( "${ptxd_reply[@]}" )
+
+ ptxd_reply=()
+ for layer in "${layers[@]}"; do
+ ptxd_reply=( \
+ "${ptxd_reply[@]}" \
+ "${layer}/${prefix}${PTXDIST_PLATFORMSUFFIX}/${file}" \
+ "${layer}/${prefix}/${file}${PTXDIST_PLATFORMSUFFIX}" \
+ "${layer}/${PTXDIST_PLATFORMCONFIG_SUBDIR}/${prefix}/${file}${PTXDIST_PLATFORMSUFFIX}" \
+ "${layer}/${prefix}/${file}" \
+ "${layer}/${PTXDIST_PLATFORMCONFIG_SUBDIR}/${prefix}/${file}" \
+ )
+ done
+}
+export -f ptxd_get_alternative_list
+
#
# ptxd_get_alternative - look for files in platform, BSP and ptxdist
#
@@ -523,20 +546,8 @@ export -f ptxd_replace_link
# array "ptxd_reply" containing the found files
#
ptxd_get_alternative() {
- local prefix="${1%/}"
- local file="${2}"
- [ -n "${prefix}" -a -n "${file}" ] || return
-
- list=( \
- "${PTXDIST_WORKSPACE}/${prefix}${PTXDIST_PLATFORMSUFFIX}/${file}" \
- "${PTXDIST_WORKSPACE}/${prefix}/${file}${PTXDIST_PLATFORMSUFFIX}" \
- "${PTXDIST_PLATFORMCONFIGDIR}/${prefix}/${file}${PTXDIST_PLATFORMSUFFIX}" \
- "${PTXDIST_WORKSPACE}/${prefix}/${file}" \
- "${PTXDIST_PLATFORMCONFIGDIR}/${prefix}/${file}" \
- "${PTXDIST_TOPDIR}/${prefix}/${file}" \
- )
-
- ptxd_get_path "${list[@]}"
+ ptxd_get_alternative_list "${@}" &&
+ ptxd_get_path "${ptxd_reply[@]}"
}
export -f ptxd_get_alternative