check-updates.sh: filter version numbers from tags by using regexp where needed

This commit is contained in:
Leonid Pliushch 2020-12-17 21:52:46 +02:00
parent f79c5170fd
commit 1ee961c420
No known key found for this signature in database
GPG Key ID: 45F2964132545795
2 changed files with 21 additions and 12 deletions

View File

@ -9,8 +9,10 @@ fi
if [ -f "${BASEDIR}/github-projects.txt" ]; then
while read -r line; do
unset package project version_regexp
package=$(echo "$line" | cut -d'|' -f1)
project=$(echo "$line" | cut -d'|' -f2-)
project=$(echo "$line" | cut -d'|' -f2)
version_regexp=$(echo "$line" | cut -d'|' -f3-)
if [ ! -d "${BASEDIR}/../../packages/${package}" ]; then
echo "Package '$package' is not available, skipping."
@ -25,6 +27,11 @@ if [ -f "${BASEDIR}/github-projects.txt" ]; then
# Remove leading 'v' which is common in version tag.
latest_version=${latest_version#v}
# If needed, filter version numbers from tag by using regexp.
if [ -n "$version_regexp" ]; then
latest_version=$(grep -oP "$version_regexp" <<< "$latest_version")
fi
# We have no better choice for comparing versions.
if [ "$(echo -e "${termux_version}\n${latest_version}" | sort -V | head -n 1)" != "$latest_version" ] ;then
echo "Package '${package}' needs update to '${latest_version}'."

View File

@ -4,9 +4,10 @@
##
## Each entry has a following format:
##
## {package name}|{project path on Github}
## {package name}|{project path on Github}|{optionally: version regexp}
##
## Example: acr|radare/acr
## cronie|cronie-crond/cronie|\d+.\d+.\d+
##
## Lines starting with "#" are comments.
##
@ -59,7 +60,7 @@ cmatrix|abishekvashok/cmatrix
#cpulimit|opsengine/cpulimit
croc|schollz/croc
cronie|cronie-crond/cronie
cronie|cronie-crond/cronie|\d+\.\d+\.\d+
ctypes-sh|taviso/ctypes.sh
delve|go-delve/delve
deutex|Doom-Utils/deutex
@ -107,9 +108,9 @@ gh|cli/cli
git-delta|dandavison/delta
git-lfs|git-lfs/git-lfs
google-glog|google/glog
googletest|google/googletest
googletest|google/googletest|\d+\.\d+\.\d+
gotty|yudai/gotty
gping|orf/gping
gping|orf/gping|\d+\.\d+\.\d+
gumbo-parser|google/gumbo-parser
hexcurse|LonnyGomes/hexcurse
hexyl|sharkdp/hexyl
@ -142,14 +143,14 @@ jftui|Aanok/jftui
jsoncpp|open-source-parsers/jsoncpp
kakoune|mawww/kakoune
kibi|ilai-deutel/kibi
kona|kevinlawler/kona
kona|kevinlawler/kona|\d{8}
lazygit|jesseduffield/lazygit
## Complex package - no auto updates.
#ldc|ldc-developers/ldc
leveldb|google/leveldb
lf|gokcehan/lf
lf|gokcehan/lf|\d+
## Belongs to @termux - no auto updates.
#libandroid-shmem|termux/libandroid-shmem
@ -177,13 +178,14 @@ libgraphite|silnrsi/graphite
## Returns 'null' in latest tag.
#libmesode|boothj5/libmesode
libmsgpack|msgpack/msgpack-c
libmsgpack|msgpack/msgpack-c|\d+\.\d+\.\d+
libnet|libnet/libnet
## Returns 'null' in latest tag.
#libnfs|sahlberg/libnfs
libnl|thom311/libnl
## Bad tag.
#libnl|thom311/libnl
## Getting sources from archive.mozilla.org
#libopusenc|xiph/libopusenc
@ -208,7 +210,7 @@ libunibilium|neovim/unibilium
#libvidstab|georgmartius/vid.stab
#libwebp|webmproject/libwebp
libzopfli|google/zopfli
libzopfli|google/zopfli|\d+\.\d+\.\d+
## Part of Swift - disable auto updates.
#libuild|apple/swift-llbuild
@ -350,7 +352,7 @@ tokei|XAMPPRocky/tokei
#torsocks|dgoulet/torsocks
toxic|JFreegman/toxic
tracepath|iputils/iputils
tracepath|iputils/iputils|\d+
## No auto updates currently.
#tsu|cswl/tsu
@ -397,7 +399,7 @@ wuzz|asciimoo/wuzz
#yadm|TheLocehiliosan/yadm
youtubedr|kkdai/youtube
z3|Z3Prover/z3
z3|Z3Prover/z3|\d+\.\d+\.\d+
## Returns 'null' in latest tag.
#zbar|mchehab/zbar