Pmodules/modbuild

- libpbuild.bash is sourced after parsing command line arguments
- use-flags implemented
This commit is contained in:
2018-10-11 17:40:40 +02:00
parent b450e72555
commit 9360296bb5
+17 -9
View File
@@ -9,7 +9,6 @@ declare -r prog=$(basename "$0")
# The libs are found via PATH
PATH="/usr/bin:/bin:/usr/sbin:/sbin:${mydir}:${mydir}/../lib:${mydir}/../config"
source libstd.bash || { echo "Oops: library '$_' cannot be loaded!" 1>&2; exit 3; }
source libpbuild.bash || std::die 3 "Oops: library '$_' cannot be loaded!"
#.............................................................................
# constants
@@ -281,7 +280,7 @@ set_full_module_name_and_prefix() {
# $2: version
initialize_module_vars() {
local -r script_name="$1"
local -r v="$2"
local v="$2"
# split path of build script into components
local -a fname
@@ -307,24 +306,32 @@ initialize_module_vars() {
V_MAJOR='' # first number in version string
V_MINOR='' # second number in version string (or empty)
V_PATCHLVL='' # third number in version string (or empty)
V_RELEASE='' # module release (or empty)
USE_FLAGS='' # architectures (or empty)
local tmp=''
if [[ "$v" =~ "_" ]]; then
tmp="${v#*_}"
USE_FLAGS=":${tmp//_/:}:"
v="${v%%_*}"
fi
V_PKG="${v%%-*}" # version without the release number
V_RELEASE="${v#*-}" # release number
local tmp="${V_PKG}"
case "${tmp}" in
case "${V_PKG}" in
*.*.* )
V_MAJOR="${tmp%%.*}"
tmp="${tmp#*.}"
V_MAJOR="${V_PKG%%.*}"
tmp="${V_PKG%%.*#*.}"
V_MINOR="${tmp%%.*}"
V_PATCHLVL="${tmp#*.}"
;;
*.* )
V_MAJOR="${tmp%.*}"
V_MINOR="${tmp#*.}"
V_MAJOR="${V_PKG%.*}"
V_MINOR="${V_PKG#*.}"
;;
* )
V_MAJOR="${tmp}"
V_MAJOR="${V_PKG}"
;;
esac
}
@@ -407,6 +414,7 @@ declare -r ARGS="$@"
#.............................................................................
# main
parse_args "$@"
source libpbuild.bash || std::die 3 "Oops: library '$_' cannot be loaded!"
declare -r BUILD_SCRIPT
declare -r BUILDBLOCK_DIR