Skip to content

Commit

Permalink
even better version selection
Browse files Browse the repository at this point in the history
  • Loading branch information
j-hc committed Mar 15, 2023
1 parent 38f901a commit 011198c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 18 additions & 7 deletions utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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" |
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 011198c

Please sign in to comment.