summaryrefslogtreecommitdiff
path: root/automated/lib
diff options
context:
space:
mode:
authorNicolas Dechesne <nicolas.dechesne@linaro.org>2017-01-25 12:07:08 +0100
committerNicolas Dechesne <nicolas.dechesne@linaro.org>2017-01-25 12:35:23 +0100
commitb7e3876bb33cdd55f645c2f55f5c9bb57d051eac (patch)
treed864d552f426abed427b568c7f4288e37f9a9dd0 /automated/lib
parent14c77d935aa059e9cad906f996885c163ed17f3f (diff)
automated: switch to using ID field for distro
Let's standardadize all test cases to use lowercase distro ID field from /etc/os-release, instead of the 'pretty' (capitalized) name that we used so far. This is an invasive change, all test scripts were modified with this command: $ sed -i -e 's|Debian\(.*\))|debian\1)|g' \ -e 's|Ubuntu\(.*\))|ubuntu\1)|g' \ -e 's|CentOS\(.*\))|centos\1)|g' \ -e 's|Fedora\(.*\))|fedora\1)|g' \ -e 's|Unknown\(.*\))|unknown\1)|g' And the remaining instances were fixed manually. dist_name() function was updated to always report lowercase distro name. Also when /etc/os-release is not available and that we use lsb_release output, we convert the old capitalized name into the new lowercase ones. Change-Id: I1f1ce0932ab04476567f0338e902656470267a74 Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>
Diffstat (limited to 'automated/lib')
-rwxr-xr-xautomated/lib/sh-test-lib36
1 files changed, 18 insertions, 18 deletions
diff --git a/automated/lib/sh-test-lib b/automated/lib/sh-test-lib
index 32c481f..6aac8a7 100755
--- a/automated/lib/sh-test-lib
+++ b/automated/lib/sh-test-lib
@@ -160,21 +160,21 @@ dist_name() {
# shellcheck disable=SC1091
dist="$(. /etc/lsb-release && echo "${DISTRIB_ID}")"
elif [ -f /etc/debian_version ]; then
- dist="Debian"
+ dist="debian"
elif [ -f /etc/fedora-release ]; then
- dist="Fedora"
+ dist="fedora"
elif [ -f /etc/centos-release ]; then
- dist="CentOS"
+ dist="centos"
else
- dist="Unknown"
+ dist="unknown"
warn_msg "Unsupported distro: cannot determine distribution name"
fi
case "${dist}" in
- debian) dist="Debian" ;;
- ubuntu) dist="Ubuntu" ;;
- fedora) dist="Fedora" ;;
- centos) dist="CentOS" ;;
+ Debian) dist="debian" ;;
+ Ubuntu) dist="ubuntu" ;;
+ Fedora) dist="fedora" ;;
+ CentOS) dist="centos" ;;
rpb|rpb-wayland|rpb-eglfs) dist="oe-based" ;;
esac
}
@@ -191,21 +191,21 @@ install_deps() {
info_msg "Installing ${pkgs}"
dist_name
case "${dist}" in
- Debian|Ubuntu)
+ debian|ubuntu)
# Use the default answers for all questions.
DEBIAN_FRONTEND=noninteractive apt-get update -q -y
# shellcheck disable=SC2086
DEBIAN_FRONTEND=noninteractive apt-get install -q -y ${pkgs}
;;
- CentOS)
+ centos)
# shellcheck disable=SC2086
yum -e 0 -y install ${pkgs}
;;
- Fedora)
+ fedora)
# shellcheck disable=SC2086
dnf -e 0 -y install ${pkgs}
;;
- Unknown)
+ unknown)
warn_msg "Unsupported distro: package install skipped"
;;
esac
@@ -268,8 +268,8 @@ dist_info() {
if ! command -v lsb_release > /dev/null; then
dist_name
case "${dist}" in
- Debian|Ubuntu) install_deps "lsb-release" ;;
- CentOS|Fedora) install_deps "redhat-lsb-core" ;;
+ debian|ubuntu) install_deps "lsb-release" ;;
+ centos|fedora) install_deps "redhat-lsb-core" ;;
*) warn_msg "Unsupported distro: dist_info skipped"
esac
fi
@@ -285,8 +285,8 @@ add_key() {
dist_name
case "${dist}" in
- Debian|Ubuntu) wget -O - "${url}" | apt-key add - ;;
- CentOS|Fedora) infor_msg "add_key isn't needed on ${dist}" ;;
+ debian|ubuntu) wget -O - "${url}" | apt-key add - ;;
+ centos|fedora) infor_msg "add_key isn't needed on ${dist}" ;;
*) warn_msg "Unsupported distro: add_key skipped"
esac
}
@@ -299,7 +299,7 @@ add_repo() {
case "${dist}" in
# Detect Debian/Ubuntu codename and add repo automatically. The same url
# should work on all distributions supported by the repo.
- Debian|Ubuntu)
+ debian|ubuntu)
dist_info
if [ -z "$2" ]; then
backports=""
@@ -314,7 +314,7 @@ add_repo() {
;;
# It is not easy to amend url with distro version as its format may vary
# by repo. Test definition/plan should provide a correct repo url.
- CentOS|Fedora)
+ centos|fedora)
wget -O - "${url}" >> "/etc/yum.repos.d/3rd-party.repo"
;;
*)