fix bug get new version

This commit is contained in:
Fioren 2026-02-06 19:32:49 +07:00 committed by GitHub
parent 2a77c37df5
commit d41562b2e0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -196,11 +196,12 @@ get_apk() {
if [ "$num" -ge "$min_major" ]; then
version=$(java -jar *cli*.jar list-patches --with-packages --with-versions $patch_glob | awk -v pkg="$1" '
BEGIN { found = 0 }
/^Index:/ { found = 0 }
/Package name: / { if ($3 == pkg) { found = 1 } }
/Compatible versions:/ { if (found) { getline; latest_version = $1; while (getline && $1 ~ /^[0-9]+\./) { latest_version = $1 } print latest_version; exit } }
')
BEGIN { found = 0; printing = 0 }
/^Index:/ { if (printing) exit; found = 0 }
/Package name: / { if ($3 == pkg) found = 1 }
/Compatible versions:/ { if (found) printing = 1; next }
printing && $1 ~ /^[0-9]+\./ { print $1 }
' | sort -V | tail -n1)
else
version=$(jq -r '[.. | objects | select(.name == "'"$1"'" and .versions != null) | .versions[]] | reverse | .[0] // ""' *.json 2>/dev/null | uniq)
fi
@ -293,11 +294,12 @@ get_apkpure() {
if [ "$num" -ge "$min_major" ]; then
version=$(java -jar *cli*.jar list-patches --with-packages --with-versions $patch_glob | awk -v pkg="$1" '
BEGIN { found = 0 }
/^Index:/ { found = 0 }
/Package name: / { if ($3 == pkg) { found = 1 } }
/Compatible versions:/ { if (found) { getline; latest_version = $1; while (getline && $1 ~ /^[0-9]+\./) { latest_version = $1 } print latest_version; exit } }
')
BEGIN { found = 0; printing = 0 }
/^Index:/ { if (printing) exit; found = 0 }
/Package name: / { if ($3 == pkg) found = 1 }
/Compatible versions:/ { if (found) printing = 1; next }
printing && $1 ~ /^[0-9]+\./ { print $1 }
' | sort -V | tail -n1)
else
version=$(jq -r '[.. | objects | select(.name == "'"$1"'" and .versions != null) | .versions[]] | reverse | .[0] // ""' *.json 2>/dev/null | uniq)
fi