auto-update: Use dpkg to compare versions
To avoid warnings like: ``` /usr/lib/python3/dist-packages/pkg_resources/__init__.py:116: PkgResourcesDeprecationWarning: 2:0.8.3 is an invalid version and will not be supported in a future release ``` Signed-off-by: Aditya Alok <alok@termux.dev>
This commit is contained in:
parent
119b8a83f2
commit
c626262307
|
@ -10,18 +10,7 @@ termux_pkg_is_update_needed() {
|
|||
|
||||
# Compare versions.
|
||||
# shellcheck disable=SC2091
|
||||
if $(
|
||||
cat <<-EOF | python3 -
|
||||
import sys
|
||||
|
||||
from pkg_resources import parse_version
|
||||
|
||||
if parse_version("${CURRENT_VERSION}") < parse_version("${LATEST_VERSION}"):
|
||||
sys.exit(0)
|
||||
else:
|
||||
sys.exit(1)
|
||||
EOF
|
||||
); then
|
||||
if dpkg --compare-versions "${LATEST_VERSION}" gt "${CURRENT_VERSION}"; then
|
||||
return 0 # true. Update needed.
|
||||
fi
|
||||
return 1 # false. Update not needed.
|
||||
|
|
Loading…
Reference in New Issue