diff options
author | Michael Olbrich <m.olbrich@pengutronix.de> | 2018-10-10 06:48:34 +0200 |
---|---|---|
committer | Michael Olbrich <m.olbrich@pengutronix.de> | 2018-10-12 07:52:29 +0200 |
commit | 84877d8cc50ea8b9f55584638c36e2cb18260bf9 (patch) | |
tree | 4fac8c0b8155bb6c6c7b769ac8b4f051db7ad4dd /bin/ptxdist | |
parent | bfe764478c651c833a40ece0ef362eb3c2827aa3 (diff) | |
download | ptxdist-84877d8cc50ea8b9f55584638c36e2cb18260bf9.tar.gz ptxdist-84877d8cc50ea8b9f55584638c36e2cb18260bf9.tar.xz |
ptxdist: handle explicit ptxdist layer with --auto-version
If the last explicit layer is PTXdist then this exact version should be
used, regardless of the version in the config file.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'bin/ptxdist')
-rwxr-xr-x | bin/ptxdist | 54 |
1 files changed, 36 insertions, 18 deletions
diff --git a/bin/ptxdist b/bin/ptxdist index d063e3a33..9c0b739a7 100755 --- a/bin/ptxdist +++ b/bin/ptxdist @@ -1350,6 +1350,9 @@ setup_layers() echo exit 1 fi + if [ -n "${PTXDIST_AUTOVERSION}" -a -e "${layer}/bin/ptxdist" ]; then + PTXDIST_AUTOVERSION="$(realpath "${layer}")/bin/ptxdist" + fi if [ "$(realpath "${layer}")" = "${PTXDIST_TOPDIR}" ]; then break fi @@ -2416,34 +2419,49 @@ setup_parallel() { setup_auto_version() { - local configfile_version + local configfile_version next + local -a args if [ -z "${PTXDIST_AUTOVERSION}" ]; then return fi + + set -- "${PTXDIST_ARGS_FULL[@]}" + while [ ${#} -ne 0 ]; do + local arg="${1}" + shift + case "${arg}" in + --auto-version) ;; + *) args[${#args[@]}]="${arg}" ;; + esac + done + + case "${PTXDIST_AUTOVERSION}" in + "${PTXDIST_TOPDIR}/bin/ptxdist") + # this is already the correct ptxdist + return + ;; + /*) + # use ptxdist from the explicit PTXdist layer + exec "${PTXDIST_AUTOVERSION}" "${args[@]}" + ;; + esac + if [ ! -e "${PTXDIST_PTXCONFIG}" ]; then # no config yet, so this is either 'select' or fails later anyways return fi _get_config_ptx - if ! check_version "${configfile_version}"; then - local next - local -a args - set -- "${PTXDIST_ARGS_FULL[@]}" - while [ ${#} -ne 0 ]; do - local arg="${1}" - shift - case "${arg}" in - --auto-version) ;; - *) args[${#args[@]}]="${arg}" ;; - esac - done - if next="$(which ptxdist-${configfile_version})"; then - exec "${next}" "${args[@]}" - else - ptxd_bailout "ptxdist-${configfile_version} not found!" - fi + if check_version "${configfile_version}"; then + # this is already the correct version + return + fi + + if next="$(which ptxdist-${configfile_version})"; then + exec "${next}" "${args[@]}" + else + ptxd_bailout "ptxdist-${configfile_version} not found!" fi } |