diff --git a/build.sh b/build.sh index e96db88..a8734a1 100755 --- a/build.sh +++ b/build.sh @@ -84,7 +84,7 @@ for table_name in $(toml_get_table_names); do app_args[dl_from]=apkmirror } || app_args[apkmirror_dlurl]="" if [ -z "${app_args[dl_from]:-}" ]; then - abort "ERROR: no 'apkmirror_dlurl', 'uptodown_dlurl', 'apkmonk_dlurl' were set for '$table_name'." + abort "ERROR: no 'apkmirror_dlurl', 'uptodown_dlurl' or 'apkmonk_dlurl' option was set for '$table_name'." fi app_args[arch]=$(toml_get "$t" arch) && { if ! isoneof "${app_args[arch]}" all arm64-v8a arm-v7a; then diff --git a/utils.sh b/utils.sh index 3a26a5a..9691169 100755 --- a/utils.sh +++ b/utils.sh @@ -35,10 +35,13 @@ toml_get() { pr() { echo -e "\033[0;32m[+] ${1}\033[0m"; } epr() { - echo -e "\033[0;31m[-] ${1}\033[0m" + echo >&2 -e "\033[0;31m[-] ${1}\033[0m" if [ "${GITHUB_REPOSITORY:-}" ]; then echo -e "::error::utils.sh [-] ${1}\n"; fi } -abort() { echo >&2 -e "\033[0;31mABORT: $1\033[0m" && exit 1; } +abort() { + epr "ABORT: ${1:-}" + exit 1 +} get_prebuilts() { pr "Getting prebuilts" @@ -147,11 +150,16 @@ semver_validate() { [ ${#ac} = 0 ] } get_patch_last_supported_ver() { - local inc_sel exc_sel - inc_sel=$(list_args "$2" | sed 's/.*/\.name == "&"/; N;s/\n/ and /' || :) - exc_sel=$(list_args "$3" | sed 's/.*/\.name != "&"/; N;s/\n/ and /' || :) + local inc_sel exc_sel exclus_sel + inc_sel=$(list_args "$2" | sed 's/.*/\.name == "&"/' | sed 'N;s/\n/ or /' || :) + exc_sel=$(list_args "$3" | sed 's/.*/\.name != "&"/' | sed 'N;s/\n/ and /' || :) + if [ "$4" = false ]; then exclus_sel=".excluded==false"; else + exclus_sel="true" + inc_sel=${inc_sel:-false} + fi jq -r ".[] - | select(.compatiblePackages[].name==\"${1}\" and .excluded==false) + | select(.compatiblePackages[].name==\"${1}\") + | select(${exclus_sel}) | select(${inc_sel:-true}) | select(${exc_sel:-true}) | .compatiblePackages[].versions" "$RV_PATCHES_JSON" | @@ -291,7 +299,10 @@ build_rv() { local get_latest_ver=false if [ "$version_mode" = auto ]; then - version=$(get_patch_last_supported_ver "$pkg_name" "${args[included_patches]}" "${args[excluded_patches]}") || get_latest_ver=true + version=$( + get_patch_last_supported_ver "$pkg_name" \ + "${args[included_patches]}" "${args[excluded_patches]}" "${args[exclusive_patches]}" + ) || get_latest_ver=true elif isoneof "$version_mode" latest beta; then get_latest_ver=true p_patcher_args+=("--experimental")