Projects
home:Eustace:branches:Eulaceura:Factory
beakerlib
_service:obs_scm:beakerlib-adapt-product-featur...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:obs_scm:beakerlib-adapt-product-feature-to-local-release-version.patch of Package beakerlib
From dcd5f6b38e895134bb24df4c8fa4a0fba3e0f381 Mon Sep 17 00:00:00 2001 From: yixiangzhike <yixiangzhike007@163.com> Date: Mon, 29 May 2023 11:22:03 +0800 Subject: [PATCH] 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 62ce983..8ae06e6 100644 --- a/src/journal.sh +++ b/src/journal.sh @@ -874,7 +874,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 738bef0..96455c7 100644 --- a/src/logging.sh +++ b/src/logging.sh @@ -881,7 +881,9 @@ on the RHEL-5-Client you will get release 5 and variant Client. __INTERNAL_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 ) @@ -905,6 +907,12 @@ rlGetDistroRelease() { } rlGetDistroVariant() { local VARIANT + # openEuler has no Variant + if rpm -q openEuler-release &>/dev/null; then + echo $VARIANT + return 0 + fi + VARIANT=$(__INTERNAL_rlGetOSReleaseItem VARIANT) && { echo $VARIANT return 0 diff --git a/src/lsb_release b/src/lsb_release index 9d7afbc..8b04c75 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
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2