1
0

Accepting request 962099 from home:fcrozat:branches:openSUSE:Tools

- Generate OS_VERSION_NO_DASH based on os-release VERSION,
  as workaround to replace dash with space in OS name
  (bsc#1195061).
- Bump version to 0.6

OBS-URL: https://build.opensuse.org/request/show/962099
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Tools/obs-service-kiwi_metainfo_helper?expand=0&rev=30
This commit is contained in:
Fabian Vogt 2022-03-16 09:26:39 +00:00 committed by Git OBS Bridge
parent 34a9416822
commit 0e214541cb
5 changed files with 29 additions and 16 deletions

31
README
View File

@ -5,18 +5,19 @@ This service can be enabled to run during buildtime, when it will edit the
build recipe (.kiwi, Dockerfile, Chart.yaml) to replace placeholders with build recipe (.kiwi, Dockerfile, Chart.yaml) to replace placeholders with
build-specific metainfo. build-specific metainfo.
| Placeholder | Value | Example | | Placeholder | Value | Example |
|--------------------------------------|----------------------------------------------- |-------------------------------------------------------------------------------------------------------------------------| |--------------------------------------|-------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------|
| %DISTURL% | The OBS dist url | obs://build.opensuse.org/openSUSE:Factory/images/0f40c57dd619e1dff9e512949b6bca09-opensuse-tumbleweed-image | | %DISTURL% | The OBS dist url | obs://build.opensuse.org/openSUSE:Factory/images/0f40c57dd619e1dff9e512949b6bca09-opensuse-tumbleweed-image |
| %SOURCEURL% | Source url for container recipe (OBS) | https://build.opensuse.org/package/show/openSUSE:Factory/opensuse-tumbleweed-image?rev=0f40c57dd619e1dff9e512949b6bca09 | | %SOURCEURL% | Source url for container recipe (OBS) | https://build.opensuse.org/package/show/openSUSE:Factory/opensuse-tumbleweed-image?rev=0f40c57dd619e1dff9e512949b6bca09 |
| %SOURCEURL% | Source url for container recipe (IBS) | https://sources.suse.com/SUSE:SLE-15:Update:CR/sles15-image/2951b67133dd6384cacb28203174e030/ | | %SOURCEURL% | Source url for container recipe (IBS) | https://sources.suse.com/SUSE:SLE-15:Update:CR/sles15-image/2951b67133dd6384cacb28203174e030/ |
| %RELEASE% | The OBS release number (<cicnt\>.<bldcnt\>) | 4.2 | | %RELEASE% | The OBS release number (<cicnt\>.<bldcnt\>) | 4.2 |
| %BUILDTIME% | $(date --utc +%FT%T.%NZ) | 2018-10-30T09:19:02.074934628Z | | %BUILDTIME% | $(date --utc +%FT%T.%NZ) | 2018-10-30T09:19:02.074934628Z |
| %OS_VERSION% | VERSION in the os-release file | 15-SP3 | | %OS_VERSION% | VERSION in the os-release file | 15-SP3 |
| %OS_VERSION_ID% | VERSION_ID in the os-release file | 15 | | %OS_VERSION_NO_DASH% | VERSION in the os-release file, with space (SLE only) | 15 SP3 |
| %OS_VERSION_ID_SP% | Like VERSION_ID, but with SP (SLE only) | 15.3 | | %OS_VERSION_ID% | VERSION_ID in the os-release file | 15 |
| %OS_PRETTY_NAME% | PRETTY_NAME in the os-release file | SUSE Linux Enterprise Server 15 SP3 (Snapshot16) | | %OS_VERSION_ID_SP% | Like VERSION_ID, but with SP (SLE only) | 15.3 |
| %OS_VENDOR% | PRETTY_NAME up to first space character | SUSE | | %OS_PRETTY_NAME% | PRETTY_NAME in the os-release file | SUSE Linux Enterprise Server 15 SP3 (Snapshot16) |
| %OS_PRETTY_NAME_DASHED% | PRETTY_NAME with dashes in place of spaces | SUSE-Linux-Enterprise-Server-15-SP3-Snapshot-16 | | %OS_VENDOR% | PRETTY_NAME up to first space character | SUSE |
| %OS_PRETTY_NAME_BEFORE_PAREN% | PRETTY_NAME up to the first open parentheses | SUSE Linux Enterprise Server 15 SP3 | | %OS_PRETTY_NAME_DASHED% | PRETTY_NAME with dashes in place of spaces | SUSE-Linux-Enterprise-Server-15-SP3-Snapshot-16 |
| %OS_PRETTY_NAME_BEFORE_PAREN_DASHED% | PRETTY_NAME up to first open paren with dashes | SUSE-Linux-Enterprise-Server-15-SP3 | | %OS_PRETTY_NAME_BEFORE_PAREN% | PRETTY_NAME up to the first open parentheses | SUSE Linux Enterprise Server 15 SP3 |
| %OS_PRETTY_NAME_BEFORE_PAREN_DASHED% | PRETTY_NAME up to first open paren with dashes | SUSE-Linux-Enterprise-Server-15-SP3 |

View File

@ -78,6 +78,7 @@ if grep -q "%OS_" ${files[@]}; then
[ -f "${tempdir}/etc/os-release" ] && . "${tempdir}/etc/os-release" [ -f "${tempdir}/etc/os-release" ] && . "${tempdir}/etc/os-release"
VERSION="${VERSION:-}" VERSION="${VERSION:-}"
VERSION_NO_DASH="${VERSION/-/ }"
# Special case for SLE X "SP 0", make sure it has .0 # Special case for SLE X "SP 0", make sure it has .0
VERSION_ID_SP="${VERSION_ID}" VERSION_ID_SP="${VERSION_ID}"
[[ "${VERSION_ID_SP%}" == *"."* ]] || VERSION_ID_SP="${VERSION_ID}.0" [[ "${VERSION_ID_SP%}" == *"."* ]] || VERSION_ID_SP="${VERSION_ID}.0"
@ -120,6 +121,7 @@ if grep -q "%OS_" ${files[@]}; then
-e "s/%OS_PRETTY_NAME_BEFORE_PAREN%/${PRETTY_NAME_BEFORE_PAREN}/g" \ -e "s/%OS_PRETTY_NAME_BEFORE_PAREN%/${PRETTY_NAME_BEFORE_PAREN}/g" \
-e "s/%OS_PRETTY_NAME_BEFORE_PAREN_DASHED%/${PRETTY_NAME_BEFORE_PAREN_DASHED}/g" \ -e "s/%OS_PRETTY_NAME_BEFORE_PAREN_DASHED%/${PRETTY_NAME_BEFORE_PAREN_DASHED}/g" \
-e "s/%OS_VERSION%/${VERSION}/g" \ -e "s/%OS_VERSION%/${VERSION}/g" \
-e "s/%OS_VERSION_NO_DASH%/${VERSION_NO_DASH}/g" \
-e "s/%OS_VERSION_ID_SP%/${VERSION_ID_SP}/g" "${files[@]}" -e "s/%OS_VERSION_ID_SP%/${VERSION_ID_SP}/g" "${files[@]}"
fi fi

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Tue Feb 15 11:03:50 UTC 2022 - Frederic Crozat <fcrozat@suse.com>
- Generate OS_VERSION_NO_DASH based on os-release VERSION,
as workaround to replace dash with space in OS name
(bsc#1195061).
- Bump version to 0.6
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Feb 8 16:10:01 UTC 2022 - Frederic Crozat <fcrozat@suse.com> Tue Feb 8 16:10:01 UTC 2022 - Frederic Crozat <fcrozat@suse.com>

View File

@ -17,7 +17,7 @@
Name: obs-service-kiwi_metainfo_helper Name: obs-service-kiwi_metainfo_helper
Version: 0.5 Version: 0.6
Release: 0 Release: 0
Summary: Service for substituting various variables in build recipes Summary: Service for substituting various variables in build recipes
License: GPL-2.0-or-later License: GPL-2.0-or-later

View File

@ -34,6 +34,7 @@ SOURCEURL=%SOURCEURL%
RELEASE=%RELEASE% RELEASE=%RELEASE%
BUILDTIME=%BUILDTIME% BUILDTIME=%BUILDTIME%
OS_VERSION=%OS_VERSION% OS_VERSION=%OS_VERSION%
OS_VERSION_NO_DASH=%OS_VERSION_NO_DASH%
OS_VERSION_ID=%OS_VERSION_ID% OS_VERSION_ID=%OS_VERSION_ID%
OS_VERSION_ID_SP=%OS_VERSION_ID_SP% OS_VERSION_ID_SP=%OS_VERSION_ID_SP%
OS_PRETTY_NAME=%OS_PRETTY_NAME% OS_PRETTY_NAME=%OS_PRETTY_NAME%
@ -51,6 +52,7 @@ SOURCEURL=https://build.opensuse.org/package/show/openSUSE:Factory/opensuse-tumb
RELEASE=4.2 RELEASE=4.2
BUILDTIME=2018-10-30T09:19:02.074934628Z BUILDTIME=2018-10-30T09:19:02.074934628Z
OS_VERSION=15-SP4 OS_VERSION=15-SP4
OS_VERSION_NO_DASH=15 SP4
OS_VERSION_ID=15.4 OS_VERSION_ID=15.4
OS_VERSION_ID_SP=15.4 OS_VERSION_ID_SP=15.4
OS_PRETTY_NAME=SUSE Linux Enterprise Server 15 SP4 OS_PRETTY_NAME=SUSE Linux Enterprise Server 15 SP4