summaryrefslogtreecommitdiffstats
path: root/scripts/libptxdist.sh
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2018-07-24 09:07:33 +0200
committerMichael Olbrich <m.olbrich@pengutronix.de>2018-09-20 11:03:54 +0200
commit717e122dbeeded5cf80953cb7225da25ddd98891 (patch)
tree42bdaec1d5e8615e0d87c771bf24b160b4156d75 /scripts/libptxdist.sh
parent6e17c59dc2235189b1d57d94a37d42b0c37a3fb5 (diff)
downloadptxdist-717e122dbeeded5cf80953cb7225da25ddd98891.tar.gz
ptxdist-717e122dbeeded5cf80953cb7225da25ddd98891.tar.xz
ptxd_in_path: expand relative paths with PTXDIST_PATH_LAYERS
This is needed to support layers in custom search paths, e.g. in PTXCONF_DTC_OFTREE_DTS_PATH. Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'scripts/libptxdist.sh')
-rw-r--r--scripts/libptxdist.sh22
1 files changed, 20 insertions, 2 deletions
diff --git a/scripts/libptxdist.sh b/scripts/libptxdist.sh
index aa23530b2..ea186540e 100644
--- a/scripts/libptxdist.sh
+++ b/scripts/libptxdist.sh
@@ -583,10 +583,28 @@ export -f ptxd_get_path
#
ptxd_in_path() {
local orig_IFS="${IFS}"
+ local -a paths tmp
+ local path
+ local relative
IFS=:
- local -a paths
- paths=( ${!1} )
+ tmp=( ${!1} )
IFS="${orig_IFS}"
+ for path in "${tmp[@]}"; do
+ local search
+ case "${path}" in
+ /*)
+ paths=( "${paths[@]}" "${path}" )
+ ;;
+ *)
+ if [ -n "${relative}" ]; then
+ ptxd_bailout "More than one relative path found in ${1}"
+ fi
+ relative=true
+ ptxd_in_path PTXDIST_PATH_LAYERS "${path}" || continue
+ paths=( "${paths[@]}" "${ptxd_reply[@]}" )
+ ;;
+ esac
+ done
paths=( "${paths[@]/%/${2:+/}${2}}" )
ptxd_get_path "${paths[@]}"
}