Skip to content

Commit

Permalink
ci,build: add version checker helpers
Browse files Browse the repository at this point in the history
These version helpers were first introduced in Scopy's build.
But we'll need them in libiio to check for Ubuntu 20.04.

Also, centralizing them will make them useful for later.

Signed-off-by: Alexandru Ardelean <[email protected]>
  • Loading branch information
commodo committed Apr 2, 2020
1 parent 4ccfb5b commit e47caad
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions CI/travis/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,28 @@ ensure_command_exists() {
return 1
}

version_gt() { test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" != "$1"; }
version_le() { test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" = "$1"; }
version_lt() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" != "$1"; }
version_ge() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" = "$1"; }

get_codename() {
lsb_release -c -s
}

get_dist_id() {
lsb_release -i -s
}

get_version() {
lsb_release -r -s
}

is_ubuntu_at_least_ver() {
[ "$(get_dist_id)" = "Ubuntu" ] || return 1
version_ge "$(get_version)" "$1"
}

print_github_api_rate_limits() {
# See https://developer.github.com/v3/rate_limit/
# Note: Accessing this endpoint does not count against your REST API rate limit.
Expand Down

0 comments on commit e47caad

Please sign in to comment.