Added make dependency detection for bpm-convert

This commit is contained in:
EnumDev 2024-09-18 11:39:22 +00:00
parent c2de62c343
commit 9ef4699c0d
2 changed files with 25 additions and 9 deletions

View File

@ -6,11 +6,12 @@ fi
echo "$ARCH"
while getopts "ksa:" o; do
while getopts "ksfa:" o; do
case "${o}" in
a) ARCH="$OPTARG";;
k) KEEP=true;;
s) SKIPCHECK=true;;
f) FORCE=true;;
*) exit 1;;
esac
done
@ -61,6 +62,23 @@ function ReadPkgInfo() {
}
ReadPkgInfo
if [ -z "$FORCE" ] && command -v bpm &> /dev/null && [ -n "$PKGINFO[make_depends]" ]; then
MISSING=()
for depend in $(echo "${PKGINFO[make_depends]}" | tr -d '[]' | tr ',' '\n' ); do
if ! bpm info "$depend" &> /dev/null; then
MISSING+=("$depend")
fi
done
if [ "${#MISSING[@]}" -ne 0 ]; then
echo "The following make dependencies could not be resolved: ${MISSING[@]}"
exit 1
fi
elif ! command -v bpm &> /dev/null; then
echo "BPM not in PATH. Skipping make dependency resolution"
elif [ -n "$FORCE" ]; then
echo "Force compilation enabled. Skipping make dependency resolution"
fi
# Creating temporary compilation directory structure
TEMPDIR="/var/tmp/bpm_source_${PKGINFO[name]}"
if [ -d "$TEMPDIR" ] && [ -z "$KEEP" ]; then

View File

@ -9,11 +9,12 @@ if [ -f .compilation-options ]; then
source ./.compilation-options
fi
while getopts "cska:" flag; do
while getopts "cskfa:" flag; do
case "$flag" in
c) CONVERT=true;;
k) KEEP=true;;
s) SKIPCHECK=true;;
f) FORCE=true;;
a) ARCH="${OPTARG}";;
*) exit 1;;
esac
@ -89,11 +90,8 @@ tar -c --owner=0 --group=0 --no-same-owner -zf "$output" "${toCompress[@]}"
if [ ! -z "$CONVERT" ] && "$CONVERT" && [[ "$type" == "source" ]]; then
args=()
if ! [ -z "$KEEP" ]; then
args+=("-a" "$ARCH")
fi
if ! [ -z "$SKIPCHECK" ]; then
args+=("-s")
fi
bpm-convert "${args[@]}" -a "$ARCH" "$output"
[ -n "$KEEP" ] && args+=("-k")
[ -n "$SKIPCHECK" ] && args+=("-s")
[ -n "$FORCE" ] && args+=("-f")
bpm-convert "${args[@]}" -a "$ARCH" "$output"
fi