mirror of
https://github.com/Pmodules/Pmodules.git
synced 2026-07-01 19:50:49 +02:00
modbuild: fix in parsing arguments (issue #238)
This commit is contained in:
+11
-8
@@ -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+=( '.*' )
|
||||
|
||||
|
||||
Reference in New Issue
Block a user