a few checks

This commit is contained in:
j-hc 2023-10-08 23:30:27 +03:00
parent 6e9b089f54
commit 412b5ee3c5
No known key found for this signature in database
GPG Key ID: B69B8F690911EFCC
2 changed files with 18 additions and 11 deletions

View File

@ -113,7 +113,9 @@ for table_name in $(toml_get_table_names); do
app_args[rv_brand]=$(toml_get "$t" rv-brand) || app_args[rv_brand]="$DEF_RV_BRAND"
app_args[excluded_patches]=$(toml_get "$t" excluded-patches) || app_args[excluded_patches]=""
if [ -n "${app_args[excluded_patches]}" ] && [[ "${app_args[excluded_patches]}" != *'"'* ]]; then abort "patch names inside excluded-patches must be quoted"; fi
app_args[included_patches]=$(toml_get "$t" included-patches) || app_args[included_patches]=""
if [ -n "${app_args[included_patches]}" ] && [[ "${app_args[included_patches]}" != *'"'* ]]; then abort "patch names inside included-patches must be quoted"; fi
app_args[exclusive_patches]=$(toml_get "$t" exclusive-patches) && vtf "${app_args[exclusive_patches]}" "exclusive-patches" || app_args[exclusive_patches]=false
app_args[version]=$(toml_get "$t" version) || app_args[version]="auto"
app_args[app_name]=$(toml_get "$t" app-name) || app_args[app_name]=$table_name

View File

@ -175,17 +175,19 @@ semver_validate() {
[ ${#ac} = 0 ]
}
get_patch_last_supported_ver() {
local inc_sel exc_sel
local inc_sel exc_sel vs
inc_sel=$(list_args "$2" | sed 's/.*/\.name == &/' | paste -sd '~' | sed 's/~/ or /g' || :)
exc_sel=$(list_args "$3" | sed 's/.*/\.name != &/' | paste -sd '~' | sed 's/~/ and /g' || :)
inc_sel=${inc_sel:-false}
if [ "$4" = false ]; then inc_sel="${inc_sel} or .use==true"; fi
jq -r ".[]
if ! vs=$(jq -r ".[]
| select(.compatiblePackages // [] | .[] | .name==\"${1}\")
| select(${inc_sel})
| select(${exc_sel:-true})
| .compatiblePackages[].versions // []" "$5" |
tr -d ' ,\t[]"' | sort -u | grep -v '^$' | get_largest_ver || return 1
| .compatiblePackages[].versions // []" "$5"); then
abort "error in jq query"
fi
tr -d ' ,\t[]"' <<<"$vs" | sort -u | grep -v '^$' | get_largest_ver || :
}
dl_if_dne() {
@ -352,10 +354,12 @@ 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]}" "${args[exclusive_patches]}" "${args[ptjs]}"
) || get_latest_ver=true
if ! version=$(get_patch_last_supported_ver "$pkg_name" \
"${args[included_patches]}" "${args[excluded_patches]}" "${args[exclusive_patches]}" "${args[ptjs]}"); then
exit 1
elif [ -z "$version" ]; then
get_latest_ver=true
fi
elif isoneof "$version_mode" latest beta; then
get_latest_ver=true
p_patcher_args+=("-f")
@ -457,7 +461,8 @@ build_rv() {
if [ "${args[merge_integrations]}" = true ]; then p_patcher_args+=("-m ${args[integ]}"); fi
local microg_patch
microg_patch=$(jq -r ".[] | select(.compatiblePackages // [] | .[] | .name==\"${pkg_name}\") | .name" "${args[ptjs]}" | grep -iF microg || :)
if [ "$microg_patch" ]; then
if [ "$microg_patch" ] && [[ ${p_patcher_args[*]} =~ $microg_patch ]]; then
epr "You cant include/exclude microg patches as that's done by rvmm builder automatically."
p_patcher_args=("${p_patcher_args[@]//-[ei] ${microg_patch}/}")
fi
@ -505,9 +510,9 @@ build_rv() {
if [ "$microg_patch" ]; then
patched_apk="${TEMP_DIR}/${app_name_l}-${rv_brand_f}-${version_f}-${arch_f}-${build_mode}.apk"
if [ "$build_mode" = apk ]; then
patcher_args+=("-i '${microg_patch}'")
patcher_args+=("-i \"${microg_patch}\"")
elif [ "$build_mode" = module ]; then
patcher_args+=("-e '${microg_patch}'")
patcher_args+=("-e \"${microg_patch}\"")
fi
else
patched_apk="${TEMP_DIR}/${app_name_l}-${rv_brand_f}-${version_f}-${arch_f}.apk"