debian-forge-composer/test/cases/shared_lib.sh
Jakub Rusz 306772aafa tests/CI: additional scheduling and loggin updates
Do not schedule gcp.sh on rhel-10 and centos-stream-10. Also improve
loggin for aws.sh and azure.sh as the cloud-image-val testing is
currently not preformed there.
2024-08-12 08:39:05 +03:00

47 lines
1 KiB
Bash
Executable file

#!/usr/bin/bash
function nvrGreaterOrEqual {
local rpm_name=$1
local min_version=$2
set +e
rpm_version=$(rpm -q --qf "%{version}" "${rpm_name}")
rpmdev-vercmp "${rpm_version}" "${min_version}" 1>&2
if [ "$?" != "12" ]; then
# 0 - rpm_version == min_version
# 11 - rpm_version > min_version
# 12 - rpm_version < min_version
echo "DEBUG: ${rpm_version} >= ${min_version}" 1>&2
set -e
return
fi
set -e
false
}
function get_build_info() {
local key="$1"
local fname="$2"
if rpm -q --quiet weldr-client; then
key=".body${key}"
if nvrGreaterOrEqual "weldr-client" "35.6" 2> /dev/null; then
key=".[0]${key}"
fi
fi
jq -r "${key}" "${fname}"
}
# Colorful timestamped output.
function greenprint {
echo -e "\033[1;32m[$(date -Isecond)] ${1}\033[0m"
}
function yellowprint {
echo -e "\033[1;33m[$(date -Isecond)] ${1}\033[0m"
}
function redprint {
echo -e "\033[1;31m[$(date -Isecond)] ${1}\033[0m"
}