diff options
author | Michael Olbrich <m.olbrich@pengutronix.de> | 2018-07-20 14:24:16 +0200 |
---|---|---|
committer | Michael Olbrich <m.olbrich@pengutronix.de> | 2018-09-20 11:03:54 +0200 |
commit | 4726f38b3cbb3ab857fabf9e273f84df3d7d04e9 (patch) | |
tree | 8332cf075a650193d9feecdffcfc500e900b664e /scripts/libptxdist.sh | |
parent | 01e7418d4aa4ea2550ed1638157205b9d866b959 (diff) | |
download | ptxdist-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.sh | 39 |
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 |