summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2021-06-27 11:14:58 +0200
committerMichael Olbrich <m.olbrich@pengutronix.de>2021-06-27 11:15:02 +0200
commit2a436470c1bf3fd70a075e10866bdb08ddcb2b36 (patch)
treebb417d159949538edad0926b9131e70483560f03
parent1caf75c2e258baeabf70bd3b08c8d4893b5653b6 (diff)
downloadptxdist-2a436470c1bf3fd70a075e10866bdb08ddcb2b36.tar.gz
ptxdist-2a436470c1bf3fd70a075e10866bdb08ddcb2b36.tar.xz
ptxdist: make --*config= layer aware
If the config is a relativ path, the search for it in all layers. This makes it possible to always use e.g. '--ptxconfig=configs/ptxconfig-foo' even if the current layer does not contain the config. Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
-rwxr-xr-xbin/ptxdist32
1 files changed, 26 insertions, 6 deletions
diff --git a/bin/ptxdist b/bin/ptxdist
index ed02bb1ce..503c2093e 100755
--- a/bin/ptxdist
+++ b/bin/ptxdist
@@ -1080,15 +1080,15 @@ parse_first()
PTX_SLEDGEHAMMER=true
;;
--ptxconfig=*)
- PTXDIST_PTXCONFIG="$(ptxd_abspath "${arg#*=}")" &&
+ PTXDIST_PTXCONFIG="${arg#*=}" &&
PTX_ptxconfig_SET=true
;;
--platformconfig=*)
- PTXDIST_PLATFORMCONFIG="$(ptxd_abspath "${arg#*=}")" &&
+ PTXDIST_PLATFORMCONFIG="${arg#*=}" &&
PTX_platformconfig_SET=true
;;
--collectionconfig=*)
- PTXDIST_COLLECTIONCONFIG="$(ptxd_abspath "${arg#*=}")" &&
+ PTXDIST_COLLECTIONCONFIG="${arg#*=}" &&
PTX_collectionconfig_SET=true
;;
--toolchain=*)
@@ -1171,6 +1171,7 @@ setup_layers()
{
export -a PTXDIST_LAYERS
local layer="${PTXDIST_WORKSPACE}"
+ local -a cfgs
while [ -e "${layer}" -o -h "${layer}" ]; do
if [ ! -d "${layer}" ]; then
@@ -1201,7 +1202,13 @@ setup_layers()
PTXDIST_LAYERS[${#PTXDIST_LAYERS[@]}]="${PTXDIST_TOPDIR}"
if [ "${PTX_ptxconfig_SET}" = "false" ]; then
- local -a cfgs=( "selected_ptxconfig" "configs/ptxconfig" )
+ cfgs=( "selected_ptxconfig" "configs/ptxconfig" )
+ elif ! [[ "${PTXDIST_PTXCONFIG}" =~ ^/.* ]]; then
+ cfgs=( "${PTXDIST_PTXCONFIG}" )
+ else
+ cfgs=()
+ fi
+ if [ "${#cfgs[*]}" -gt 0 ]; then
PTXDIST_PTXCONFIG="${PTXDIST_LAYERS[0]}/${cfgs[0]}"
for layer in "${PTXDIST_LAYERS[@]}"; do
local -a ptxd_reply
@@ -1212,7 +1219,13 @@ setup_layers()
fi
if [ "${PTX_platformconfig_SET}" = "false" ]; then
- local -a cfgs=( "selected_platformconfig" "configs/*/platformconfig" )
+ cfgs=( "selected_platformconfig" "configs/*/platformconfig" )
+ elif ! [[ "${PTXDIST_PLATFORMCONFIG}" =~ ^/.* ]]; then
+ cfgs=( "${PTXDIST_PLATFORMCONFIG}" )
+ else
+ cfgs=()
+ fi
+ if [ "${#cfgs[*]}" -gt 0 ]; then
PTXDIST_PLATFORMCONFIG="${PTXDIST_LAYERS[0]}/${cfgs[0]}"
for layer in "${PTXDIST_LAYERS[@]}"; do
local tmp=( ${cfgs[@]/#/${layer}/} )
@@ -1227,9 +1240,16 @@ setup_layers()
fi
if [ "${PTX_collectionconfig_SET}" = "false" ]; then
+ cfgs=( "selected_collectionconfig" )
+ elif ! [[ "${PTXDIST_COLLECTIONCONFIG}" =~ ^/.* ]]; then
+ cfgs=( "${PTXDIST_COLLECTIONCONFIG}" )
+ else
+ cfgs=()
+ fi
+ if [ "${#cfgs[*]}" -gt 0 ]; then
for layer in "${PTXDIST_LAYERS[@]}"; do
local -a ptxd_reply
- ptxd_get_path_filtered "${layer}/selected_collectionconfig" || continue
+ ptxd_get_path_filtered "${cfgs[@]/#/${layer}/}" || continue
PTXDIST_COLLECTIONCONFIG="${ptxd_reply[0]}"
break
done