summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--subr/build_init.subr52
-rw-r--r--subr/pkgtool_init.subr28
2 files changed, 34 insertions, 46 deletions
diff --git a/subr/build_init.subr b/subr/build_init.subr
index c876919b..2f66a9ff 100644
--- a/subr/build_init.subr
+++ b/subr/build_init.subr
@@ -176,13 +176,7 @@ buildp_init_getopts() {
R) ARG_RELAXED=1; ;;
*) cat etc/build.usage; exit 1; ;;
esac; shift $((${OPTIND}-1)); OPTIND=1;
- else
- break;
- fi;
- done;
- if [ "${_rc:-0}" -eq 0 ]; then
- while [ ${#} -gt 0 ]; do
- if [ "${1#=}" != "${1}" ]; then
+ else if rtl_match "${1}" "=*"; then
BUILD_GROUPS_INHIBIT_DEPS=1; _arg="${1#=}";
else
_arg="${1}";
@@ -193,30 +187,30 @@ buildp_init_getopts() {
*[^_a-zA-Z]*) _rc=1; _status="Error: build group names must not contain [^_a-zA-Z] (in argument \`${_arg}'.)"; ;;
*) BUILD_GROUPS="$(rtl_lconcat "${BUILD_GROUPS}" "${_arg}")"; ;;
esac; shift;
- done;
+ fi;
+ done;
+ if [ "${_rc:-0}" -eq 0 ]; then
+ case "${ARG_PARALLEL}" in
+ auto) if ! ARG_PARALLEL="$(rtl_get_cpu_count)"; then
+ _rc=1; _status="Error: failed to get CPU count.";
+ else
+ ARG_PARALLEL=$((${ARG_PARALLEL}/2));
+ fi; ;;
+ "") ARG_PARALLEL=1; ;;
+ *) if ! rtl_isnumber "${ARG_PARALLEL}"; then
+ _rc=1; _status="Error: invalid jobs count \`${ARG_PARALLEL}'.";
+ fi; ;;
+ esac;
if [ "${_rc:-0}" -eq 0 ]; then
- case "${ARG_PARALLEL}" in
- auto) if ! ARG_PARALLEL="$(rtl_get_cpu_count)"; then
- _rc=1; _status="Error: failed to get CPU count.";
- else
- ARG_PARALLEL=$((${ARG_PARALLEL}/2));
- fi; ;;
- "") ARG_PARALLEL=1; ;;
- *) if ! rtl_isnumber "${ARG_PARALLEL}"; then
- _rc=1; _status="Error: invalid jobs count \`${ARG_PARALLEL}'.";
- fi; ;;
+ DEFAULT_BUILD_CPUS="${ARG_PARALLEL}";
+ case "${ARG_VERBOSE:-0}" in
+ 0) rtl_fileop_set_log 0; rtl_log_set_lvl 0; ;;
+ 1) rtl_fileop_set_log 0; rtl_log_set_lvl 2; ;;
+ 2) rtl_fileop_set_log 0; rtl_log_set_lvl 2; ;;
+ 3) rtl_fileop_set_log 0; rtl_log_set_lvl 2; ;;
+ 4) rtl_fileop_set_log 1; rtl_log_set_lvl 3; ;;
+ *) _rc=1; _status="Error: invalid verbosity level (max. -vvvv)"; ;;
esac;
- if [ "${_rc:-0}" -eq 0 ]; then
- DEFAULT_BUILD_CPUS="${ARG_PARALLEL}";
- case "${ARG_VERBOSE:-0}" in
- 0) rtl_fileop_set_log 0; rtl_log_set_lvl 0; ;;
- 1) rtl_fileop_set_log 0; rtl_log_set_lvl 2; ;;
- 2) rtl_fileop_set_log 0; rtl_log_set_lvl 2; ;;
- 3) rtl_fileop_set_log 0; rtl_log_set_lvl 2; ;;
- 4) rtl_fileop_set_log 1; rtl_log_set_lvl 3; ;;
- *) _rc=1; _status="Error: invalid verbosity level (max. -vvvv)"; ;;
- esac;
- fi;
fi;
fi;
return "${_rc}";
diff --git a/subr/pkgtool_init.subr b/subr/pkgtool_init.subr
index 10650b41..bcbe455e 100644
--- a/subr/pkgtool_init.subr
+++ b/subr/pkgtool_init.subr
@@ -59,26 +59,20 @@ pkgtoolp_init_getopts() {
t) ARG_TARBALL=1; ;;
*) cat etc/pkgtool.usage; exit 1; ;;
esac; shift $((${OPTIND}-1)); OPTIND=1;
- else
- break;
+ else case "${1}" in
+ *=*) rtl_set_var_unsafe "${1%%=*}" "${1#*=}"; ;;
+ *) if [ -n "${PKGTOOL_PKG_NAME:-}" ]; then
+ _rc=1; _status="Error: more than one package name specified.";
+ else
+ PKGTOOL_PKG_NAME="${1}";
+ fi; ;;
+ esac; shift;
fi;
done;
if [ "${_rc}" -eq 0 ]; then
- while [ "${#}" -gt 0 ]; do
- case "${1}" in
- *=*) rtl_set_var_unsafe "${1%%=*}" "${1#*=}"; ;;
- *) if [ "${#}" -ne 1 ]; then
- _rc=1; _status="Error: invalid command line \`${*}'.";
- fi; break; ;;
- esac; shift;
- done;
- if [ "${_rc:-0}" -eq 0 ]; then
- if [ "${#}" -ne 1 ]\
- && [ -z "${PKGTOOL_PKG_NAME:-}" ]; then
- _rc=1; _status="Error: missing package name.";
- elif [ "${#}" -eq 1 ]; then
- PKGTOOL_PKG_NAME="${1}"; export PKGTOOL_PKG_NAME;
- fi;
+ if [ -z "${PKGTOOL_PKG_NAME:-}" ]; then
+ _rc=1; _status="Error: missing package name.";
+ else export PKGTOOL_PKG_NAME;
fi;
fi; return "${_rc}";
};