Merge branch '238-fix-parsing-of-arguments' into 'master'

Resolve "Fix parsing of arguments"

Closes #238

See merge request Pmodules/src!212
This commit is contained in:
2024-03-21 10:26:37 +01:00
2 changed files with 13 additions and 9 deletions
+2 -1
View File
@@ -4,9 +4,10 @@
### modulecmd
### build-system
* fix in parsing arguments issue (#238)
### Toolchain
* update to Tcl 8.6.14 (Issue #239)
* update to Tcl 8.6.14 (issue #239)
## Version 1.1.17
### build-system
+11 -8
View File
@@ -202,13 +202,7 @@ parse_args() {
# modbuild <build-script> [options]
# the build-script MUST be passed as first argument.
#
BUILD_SCRIPT=$(std::get_abspath "$1")
test -r ${BUILD_SCRIPT} || \
std::die 1 "%s " \
"Build script does not exist" \
"or is not readable -- '$_'"
BUILDBLOCK_DIR=$(dirname "${BUILD_SCRIPT}")
shift 1
(( $# == 0 )) && usage
while (( $# > 0 )); do
case $1 in
@@ -345,17 +339,26 @@ parse_args() {
;;
* )
local -- arg="$1"
if [[ "${arg}" == */* ]]; then
local -- tmpvar=$(std::get_abspath "${arg}")
if [[ -r ${tmpvar} ]]; then
BUILD_SCRIPT="${tmpvar}"
BUILDBLOCK_DIR=$(dirname "${BUILD_SCRIPT}")
elif [[ "${arg}" == */* ]]; then
module_name="${arg%/*}"
versions+=( {arg#*/} )
else
versions+=( "$1" )
fi
;;
esac
shift
done
[[ -z "${BUILD_SCRIPT}" ]] && \
std::die 1 "%s " \
"Build script argument missing?"
# if no version is specified on the cmd-line, build all versions
(( ${#versions[@]} > 0)) || versions+=( '.*' )