From 39b56204ae6744fd7f2a926cb5b678e48d570c88 Mon Sep 17 00:00:00 2001 From: EnumDev Date: Mon, 9 Sep 2024 09:23:46 +0000 Subject: [PATCH] Fixed 'skip check' flag and added .compilation-options files that can alter the metadata of the output binary bpm file --- bpm-convert | 10 +++++++++- bpm-package | 10 +++++++--- create-repository-data | 17 +++++++++++++---- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/bpm-convert b/bpm-convert index 99d7383..fc4b5ae 100755 --- a/bpm-convert +++ b/bpm-convert @@ -1,5 +1,11 @@ #!/bin/bash +if [ -f .compilation-options ]; then + source ./.compilation-options +fi + +echo "$ARCH" + while getopts "ksa:" o; do case "${o}" in a) ARCH="$OPTARG";; @@ -118,7 +124,9 @@ cd "$BPM_SOURCE" RunPkgFunction build cd "$BPM_SOURCE" -RunPkgFunction check +if [ -z "$SKIPCHECK" ]; then + RunPkgFunction check +fi # Packaging all packages for func in $(typeset -F | awk '{print $3}' | grep '^package'); do diff --git a/bpm-package b/bpm-package index 9c02a09..5f4125b 100755 --- a/bpm-package +++ b/bpm-package @@ -5,12 +5,16 @@ then exit 1 fi +if [ -f .compilation-options ]; then + source ./.compilation-options +fi + while getopts "cska:" flag; do case "$flag" in c) CONVERT=true;; k) KEEP=true;; s) SKIPCHECK=true;; - a) ARCHITECTURE="${OPTARG}";; + a) ARCH="${OPTARG}";; *) exit 1;; esac done @@ -86,10 +90,10 @@ 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" "$ARCHITECTURE") + args+=("-a" "$ARCH") fi if ! [ -z "$SKIPCHECK" ]; then args+=("-s") fi - bpm-convert "${args[@]}" -a "$ARCHITECTURE" "$output" + bpm-convert "${args[@]}" -a "$ARCH" "$output" fi diff --git a/create-repository-data b/create-repository-data index 14ce4cb..f554aa1 100755 --- a/create-repository-data +++ b/create-repository-data @@ -1,5 +1,12 @@ #!/bin/bash +containsElement () { + local e match="$1" + shift + for e; do [[ "$e" == "$match" ]] && return 0; done + return 1 +} + SCRIPT_PATH=$(realpath "$0") SCRIPT_DIR=$(dirname "$SCRIPT_PATH") @@ -33,14 +40,16 @@ shopt -s nullglob if ! $DEEP; then for arch in "$REPO"/*/; do for pkg in "$arch"/*.bpm; do - info=$(tar -xf "$pkg" pkg.info -O) - package=$(echo "$info" | grep 'name: ' | awk '{print $2}') - if [[ ${PKGS[@]} =~ "$package" ]]; then + info="info:"$'\n' + info+=$(tar -xf "$pkg" pkg.info -O | sed 's/^/ /g') + package=$(echo "$info" | grep 'name: ' | xargs | awk '{print $2}') + if containsElement "$package" "${PKGS[@]}"; then echo "The following package was found in more than 1 package archives: ${package}" + exit 1 fi PKGS+=("$package") file="$(realpath -s --relative-to="$REPO" "$pkg")" - info+=$'\n'"file: ${file}" + info+=$'\n'"download: ${file}" info+=$'\n---' echo "$info" done