[PATCH v2 lkp-tests] tests/cci-makepkg: simplify centos7 test

Signed-off-by: Lin Jiaxin <ljx.joe@qq.com> --- tests/cci-makepkg | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/cci-makepkg b/tests/cci-makepkg index 905ad689..e49f6699 100755 --- a/tests/cci-makepkg +++ b/tests/cci-makepkg @@ -90,20 +90,20 @@ update_shared_pkg() centos_update_gcc() { - if grep -sqF "CentOS Linux release 7" /etc/centos-release; then - [ "$os_mount" = "initramfs" ] && { - yum install -y centos-release-scl-rh - yum install -y "devtoolset-8-gcc*" - } - source /opt/rh/devtoolset-8/enable - fi + grep -sqF "CentOS Linux release 7" /etc/centos-release || return + + [ "$os_mount" = "initramfs" ] && { + yum install -y centos-release-scl-rh + yum install -y "devtoolset-8-gcc*" + } + source /opt/rh/devtoolset-8/enable } [ -n "$PKGBUILD_TAG" ] && download_pkgfile distro_install_depends lkp-dev -[ "$os" = "centos" ] && centos_update_gcc +centos_update_gcc distro_install_depends ${benchmark}-dev -- 2.23.0

On Thu, Nov 19, 2020 at 03:19:38PM +0800, Lin Jiaxin wrote:
Signed-off-by: Lin Jiaxin <ljx.joe@qq.com> --- tests/cci-makepkg | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/tests/cci-makepkg b/tests/cci-makepkg index 905ad689..e49f6699 100755 --- a/tests/cci-makepkg +++ b/tests/cci-makepkg @@ -90,20 +90,20 @@ update_shared_pkg()
centos_update_gcc() { - if grep -sqF "CentOS Linux release 7" /etc/centos-release; then - [ "$os_mount" = "initramfs" ] && { - yum install -y centos-release-scl-rh - yum install -y "devtoolset-8-gcc*" - } - source /opt/rh/devtoolset-8/enable - fi + grep -sqF "CentOS Linux release 7" /etc/centos-release || return + + [ "$os_mount" = "initramfs" ] && { ^ should be "=="
thanks dewan
+ yum install -y centos-release-scl-rh + yum install -y "devtoolset-8-gcc*" + } + source /opt/rh/devtoolset-8/enable }
[ -n "$PKGBUILD_TAG" ] && download_pkgfile
distro_install_depends lkp-dev
-[ "$os" = "centos" ] && centos_update_gcc +centos_update_gcc
distro_install_depends ${benchmark}-dev
-- 2.23.0

On Thu, Nov 19, 2020 at 03:28:06PM +0800, Zhang Dewan wrote:
On Thu, Nov 19, 2020 at 03:19:38PM +0800, Lin Jiaxin wrote:
Signed-off-by: Lin Jiaxin <ljx.joe@qq.com> --- tests/cci-makepkg | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/tests/cci-makepkg b/tests/cci-makepkg index 905ad689..e49f6699 100755 --- a/tests/cci-makepkg +++ b/tests/cci-makepkg @@ -90,20 +90,20 @@ update_shared_pkg()
centos_update_gcc() { - if grep -sqF "CentOS Linux release 7" /etc/centos-release; then - [ "$os_mount" = "initramfs" ] && { - yum install -y centos-release-scl-rh - yum install -y "devtoolset-8-gcc*" - } - source /opt/rh/devtoolset-8/enable - fi + grep -sqF "CentOS Linux release 7" /etc/centos-release || return + + [ "$os_mount" = "initramfs" ] && { ^ should be "=="
thanks dewan
In shell, it is ok to use "=" to judge equation too. Thanks, Xijian

On Thu, Nov 19, 2020 at 03:19:38PM +0800, Lin Jiaxin wrote:
Signed-off-by: Lin Jiaxin <ljx.joe@qq.com> --- tests/cci-makepkg | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/tests/cci-makepkg b/tests/cci-makepkg index 905ad689..e49f6699 100755 --- a/tests/cci-makepkg +++ b/tests/cci-makepkg @@ -90,20 +90,20 @@ update_shared_pkg()
centos_update_gcc() { - if grep -sqF "CentOS Linux release 7" /etc/centos-release; then - [ "$os_mount" = "initramfs" ] && { - yum install -y centos-release-scl-rh - yum install -y "devtoolset-8-gcc*" - } - source /opt/rh/devtoolset-8/enable - fi + grep -sqF "CentOS Linux release 7" /etc/centos-release || return + + [ "$os_mount" = "initramfs" ] && { + yum install -y centos-release-scl-rh + yum install -y "devtoolset-8-gcc*"
If you want to install several packages once, please add --skip-broken for yum install: yum install -y --skip-broken "devtoolset-8-gcc*" Thanks, Xijian
participants (3)
-
Lin Jiaxin
-
Xu Xijian
-
Zhang Dewan