update: add --out option to mp-build

This commit is contained in:
ngn
2024-08-12 01:53:08 +03:00
parent aa5fbb82d6
commit ff3245979e
4 changed files with 78 additions and 33 deletions

View File

@ -95,6 +95,8 @@ for pkg in "${srcpath}/"*; do
files+=("${NAME}_${VERSION}.mpf")
files+=("${NAME}_${VERSION}.mpf.sig")
clean_pkg_vars
pi=$((pi+1))
done

View File

@ -64,7 +64,7 @@ list_to_str(){
for el in "${list[@]}"; do
if [ -z "${str}" ]; then
str="${el}"
else
else
printf -v str "${str}\n ${el}"
fi
done
@ -72,20 +72,20 @@ list_to_str(){
# run mp-build with options
mp_build_opts(){
local opts=("${1}" "--no-opts")
local opts=("${1}" "--no-opts" "--out='${2}'")
if [ $OPT_NO_DEPEND -eq 1 ]; then
opts+=("--no-depend")
fi
if [ $OPT_NO_STDOUT -eq 1 ]; then
opts+=("--no-stdout")
fi
if [ $OPT_NO_CACHE -eq 1 ]; then
opts+=("--no-cache")
fi
mp-build ${opts[@]}
return "$?"
}
@ -94,16 +94,16 @@ mp_build_opts(){
## main script ##
#################
OPT_SKIP_FAIL=0 # stop build when a package build fails
OPT_NO_DEPEND=0 # checking depends is ENABLED
OPT_NO_DEPEND=0 # checking depends is ENABLED
OPT_NO_STDOUT=0 # build() function output is ENABLED
OPT_NO_CACHE=0 # cache is ENABLED
OPT_NO_OPTS=0 # showing/listing options is ENABLED
OPT_NO_CACHE=0 # cache is ENABLED
OPT_NO_OPTS=0 # showing/listing options is ENABLED
OPT_NO_SIGN=0 # sign all the built packages
OPT_CORES=$(nproc) # use ALL CPU cores
# parses all the options
for arg in "$@"; do
case $arg in
for arg in "$@"; do
case $arg in
"--help")
help_cmd
exit 0
@ -114,26 +114,26 @@ for arg in "$@"; do
OPT_NO_DEPEND=1 ;;
"--no-stdout")
OPT_NO_STDOUT=1 ;;
"--no-cache")
"--no-cache")
OPT_NO_CACHE=1 ;;
"--no-opts")
OPT_NO_OPTS=1 ;;
"--no-sign")
OPT_NO_SIGN=1 ;;
"--cores"*)
"--cores"*)
OPT_CORES=$(echo "${arg}" | cut -d "=" -f2) ;;
--*)
error "Unknown option: ${arg}"
exit 1 ;;
*)
if [ -z "${TARGET}" ]; then
*)
if [ -z "${TARGET}" ]; then
TARGET="${arg}"
else
error "Unknown argument: ${arg}"
exit 1
fi
;;
esac
esac
done
if [ -z "${TARGET}" ]; then
@ -156,7 +156,7 @@ fi
# print the options
if [ $OPT_NO_OPTS -eq 0 ]; then
info "Running mp-pool with the options:"
info "Running mp-pool with the options:"
print " $BOLD SKIP_FAIL = $(itoyn $OPT_SKIP_FAIL)"
print " $BOLD NO_DEPEND = $(itoyn $OPT_NO_DEPEND)"
print " $BOLD NO_SDTOUT = $(itoyn $OPT_NO_STDOUT)"
@ -203,14 +203,14 @@ for pkg in "${srcpath}/"*; do
info "(${pi}/${pc}) Building \"${package}\""
if [ $OPT_SKIP_FAIL -eq 1 ]; then
mp_build_opts "${pkg}"
mp_build_opts "${pkg}" "${distpath}"
if [ $? -ne "0" ]; then
error "(${pi}/${pc}) Build failed for \"${package}\", skipping"
pi=$((pi+1))
continue
fi
else
mp_build_opts "${pkg}"
else
mp_build_opts "${pkg}" "${distpath}"
check_ret "(${pi}/${pc}) Build failed for \"${package}\""
fi
@ -222,7 +222,7 @@ for pkg in "${srcpath}/"*; do
mv "${archive}" "${distpath}"
check_ret "(${pi}/${pc}) Moving package archive failed for \"${package}\""
fi
success "(${pi}/${pc}) Build was successful for \"${package}\""
pi=$((pi+1))
done
@ -242,8 +242,8 @@ if [ "$OPT_NO_SIGN" -eq 0 ]; then
check_ret "Failed to sign package archive: \"$(basename "${pkg}")\""
success "Signed archive: $(basename "${pkg}")"
done
success "Signing process was completed"
success "Signing process was completed"
unset_indent
fi
@ -281,7 +281,7 @@ for pkg in "${distpath}/"*".mpf"; do
done
pushd "${distpath}/list" > /dev/null
tar czf "${distpath}/LIST" *
tar czf "${distpath}/LIST" *
check_ret "(2/2) Failed to create list archive (LIST)"
popd > /dev/null