!9 [sync] PR-7: 【openEuler-20.03-LTS-SP3】Adapt product feature to local release version
From: @openeuler-sync-bot Reviewed-by: @xujing99 Signed-off-by: @xujing99
This commit is contained in:
commit
7509745013
@ -0,0 +1,93 @@
|
||||
From e90f1c3909b7221a442b9df5f05258e2ace61143 Mon Sep 17 00:00:00 2001
|
||||
From: yixiangzhike <yixiangzhike007@163.com>
|
||||
Date: Mon, 12 Jun 2023 14:50:53 +0800
|
||||
Subject: [PATCH] beakerlib adapt product feature to local release version
|
||||
|
||||
---
|
||||
src/journal.sh | 6 +++++-
|
||||
src/logging.sh | 10 +++++++++-
|
||||
src/lsb_release | 4 ++++
|
||||
src/test/loggingTest.sh | 6 +++++-
|
||||
4 files changed, 23 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/journal.sh b/src/journal.sh
|
||||
index ce51c2e..5fa5570 100644
|
||||
--- a/src/journal.sh
|
||||
+++ b/src/journal.sh
|
||||
@@ -840,7 +840,11 @@ __INTERNAL_CreateHeader(){
|
||||
__INTERNAL_LogText " Test duration : " 2> /dev/null
|
||||
|
||||
# OS release
|
||||
- local release=$(cat /etc/redhat-release)
|
||||
+ if [ -e /etc/openEuler-release ];then
|
||||
+ local release=$(cat /etc/openEuler-release)
|
||||
+ else
|
||||
+ local release=$(cat /etc/redhat-release)
|
||||
+ fi
|
||||
[[ -n "$release" ]] && {
|
||||
__INTERNAL_WriteToMetafile release -- "$release"
|
||||
__INTERNAL_LogText " Distro : ${release}" 2> /dev/null
|
||||
diff --git a/src/logging.sh b/src/logging.sh
|
||||
index d63e95f..afd98ec 100644
|
||||
--- a/src/logging.sh
|
||||
+++ b/src/logging.sh
|
||||
@@ -851,7 +851,9 @@ on the RHEL-5-Client you will get release 5 and variant Client.
|
||||
|
||||
__rlGetDistroVersion() {
|
||||
local version=0
|
||||
- if rpm -q redhat-release &>/dev/null; then
|
||||
+ if rpm -q openEuler-release &>/dev/null; then
|
||||
+ version=$( rpm -q --qf="%{VERSION}" openEuler-release )
|
||||
+ elif rpm -q redhat-release &>/dev/null; then
|
||||
version=$( rpm -q --qf="%{VERSION}" redhat-release )
|
||||
elif rpm -q fedora-release &>/dev/null; then
|
||||
version=$( rpm -q --qf="%{VERSION}" fedora-release )
|
||||
@@ -869,6 +871,12 @@ rlGetDistroRelease() {
|
||||
__rlGetDistroVersion | sed "s/^\([0-9.]\+\)[^0-9.]\+.*$/\1/" | sed "s/6\.9[0-9]/7/" | cut -d '.' -f 1
|
||||
}
|
||||
rlGetDistroVariant() {
|
||||
+ # openEuler has no Variant
|
||||
+ if rpm -q openEuler-release &>/dev/null; then
|
||||
+ echo ""
|
||||
+ return 0
|
||||
+ fi
|
||||
+
|
||||
VARIANT="$(__rlGetDistroVersion | sed "s/^[0-9.]\+\(.*\)$/\1/")"
|
||||
if [ -z "$VARIANT" ]; then
|
||||
rpm -q --qf="%{NAME}" --whatprovides redhat-release | cut -c 16- | sed 's/.*/\u&/'
|
||||
diff --git a/src/lsb_release b/src/lsb_release
|
||||
index 9d7afbc..530e6b5 100755
|
||||
--- a/src/lsb_release
|
||||
+++ b/src/lsb_release
|
||||
@@ -72,7 +72,11 @@ INFO_LSB_DIR="lsb-release.d" # where to get LSB addon modules
|
||||
INFO_DISTRIB_SUFFIX="release" # <distrib>-<suffix>
|
||||
ALTERNATE_DISTRIB_FILE="/etc/debian_version" # for Debian [based distrib]
|
||||
ALTERNATE_DISTRIB_NAME="Debian" # "
|
||||
+if [ -e /etc/openEuler-release ];then
|
||||
+CHECKFIRST="/etc/openEuler-release" # check it before file search
|
||||
+else
|
||||
CHECKFIRST="/etc/redhat-release" # check it before file search
|
||||
+fi
|
||||
|
||||
# Defines our exit codes
|
||||
EXIT_STATUS="0" # default = Ok :)
|
||||
diff --git a/src/test/loggingTest.sh b/src/test/loggingTest.sh
|
||||
index a4bc588..a9de8f8 100644
|
||||
--- a/src/test/loggingTest.sh
|
||||
+++ b/src/test/loggingTest.sh
|
||||
@@ -237,7 +237,11 @@ test_rlGetArch() {
|
||||
test_rlGetDistroRelease() {
|
||||
local out=$(rlGetDistroRelease)
|
||||
assertTrue 'rlGetDistroRelease returns 0' "[ $? -eq 0 ]"
|
||||
- if [ -e /etc/redhat-release ]
|
||||
+ if [ -e /etc/openEuler-release ]
|
||||
+ then
|
||||
+ grep -q -i "$out" /etc/openEuler-release
|
||||
+ assertTrue 'rlGetDistroRelease returns release which is in the /etc/openEuler-release' "[ $? -eq 0 ]"
|
||||
+ elif [ -e /etc/redhat-release ]
|
||||
then
|
||||
grep -q -i "$out" /etc/redhat-release
|
||||
assertTrue 'rlGetDistroRelease returns release which is in the /etc/redhat-release' "[ $? -eq 0 ]"
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
Name: beakerlib
|
||||
Summary: A shell-level integration testing library
|
||||
Version: 1.18.1
|
||||
Release: 2
|
||||
Release: 3
|
||||
License: GPLv2
|
||||
BuildArch: noarch
|
||||
URL: https://github.com/%{name}/%{name}
|
||||
@ -28,6 +28,7 @@ Patch0: bugzilla-links.patch
|
||||
Patch1: python3.patch
|
||||
Patch2: Count-CPUs-optimization.patch
|
||||
Patch3: enahanced-library-search.patch
|
||||
Patch4: beakerlib-adapt-product-feature-to-local-release-version.patch
|
||||
|
||||
%package_help
|
||||
|
||||
@ -82,6 +83,9 @@ Files for syntax highlighting BeakerLib tests in VIM editor
|
||||
%doc %{_pkgdocdir}/*
|
||||
|
||||
%changelog
|
||||
* Mon Jun 12 2023 yixiangzhike <yixiangzhike007@163.com> - 1.18.1-3
|
||||
- beakerlib adapt product feature to local release version
|
||||
|
||||
* Tue Jan 5 2021 Ge Wang <wangge20@huawei.com> - 1.18.1-2
|
||||
- Modify Source file
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user