1
0

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

- Generate SOURCEURL based on DISTURL.
- Bump version to 0.4

OBS-URL: https://build.opensuse.org/request/show/946447
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Tools/obs-service-kiwi_metainfo_helper?expand=0&rev=25
This commit is contained in:
Fabian Vogt 2022-01-14 15:12:10 +00:00 committed by Git OBS Bridge
parent 4024e35a8e
commit 0c9465faa1
4 changed files with 33 additions and 14 deletions

26
README
View File

@ -5,15 +5,17 @@ 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.suse.de/SUSE:SLE-15:Update:CR/images/2951b67133dd6384cacb28203174e030-sles15-image | | %DISTURL% | The OBS dist url | obs://build.opensuse.org/openSUSE:Factory/images/0f40c57dd619e1dff9e512949b6bca09obs-opensuse-tumbleweed-image |
| %RELEASE% | The OBS release number (<cicnt\>.<bldcnt\>) | 4.2 | | %SOURCEURL% | Source url for container recipe (OBS) | https://build.opensuse.org/package/show/openSUSE:Factory/opensuse-tumbleweed-image?rev=0f40c57dd619e1dff9e512949b6bca09 |
| %BUILDTIME% | $(date --utc +%FT%T.%NZ) | 2018-10-30T09:19:02.074934628Z | | %SOURCEURL% | Source url for container recipe (IBS) | https://sources.suse.com/SUSE:SLE-15:Update:CR/sles15-image/2951b67133dd6384cacb28203174e030/ |
| %OS_VERSION_ID% | VERSION_ID in the os-release file | 15 | | %RELEASE% | The OBS release number (<cicnt\>.<bldcnt\>) | 4.2 |
| %OS_VERSION_ID_SP% | Like VERSION_ID, but with SP (SLE only) | 15.0 | | %BUILDTIME% | $(date --utc +%FT%T.%NZ) | 2018-10-30T09:19:02.074934628Z |
| %OS_PRETTY_NAME% | PRETTY_NAME in the os-release file | SUSE Linux Enterprise Server 15 SP3 (Snapshot16) | | %OS_VERSION_ID% | VERSION_ID in the os-release file | 15 |
| %OS_VENDOR% | PRETTY_NAME up to first space character | SUSE | | %OS_VERSION_ID_SP% | Like VERSION_ID, but with SP (SLE only) | 15.0 |
| %OS_PRETTY_NAME_DASHED% | PRETTY_NAME with dashes in place of spaces | SUSE-Linux-Enterprise-Server-15-SP3-Snapshot-16 | | %OS_PRETTY_NAME% | PRETTY_NAME in the os-release file | SUSE Linux Enterprise Server 15 SP3 (Snapshot16) |
| %OS_PRETTY_NAME_BEFORE_PAREN% | PRETTY_NAME up to the first open parentheses | SUSE Linux Enterprise Server 15 SP3 | | %OS_VENDOR% | PRETTY_NAME up to first space character | SUSE |
| %OS_PRETTY_NAME_BEFORE_PAREN_DASHED% | PRETTY_NAME up to first open paren with dashes | 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% | 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

@ -21,6 +21,16 @@ if [ -e "${BUILD_DATA}" ]; then
fi fi
files=("${RECIPEFILE}") files=("${RECIPEFILE}")
# generate %SOURCEURL% based on DISTURL with a special case for build.suse.de
prj=$(echo ${DISTURL} | cut -d/ -f4)
localpath=$(echo ${DISTURL} | cut -d/ -f6-)
rev=$(echo ${localpath} | cut -d- -f1)
packagename=$(echo ${localpath} | cut -d- -f2-)
if [[ "${DISTURL}" == obs://build.suse.de/* ]]; then
SOURCEURL="https://sources.suse.com/${prj}/${packagename}/${rev}/"
else
SOURCEURL="https://$(echo ${DISTURL} | cut -d/ -f3)/package/show/${prj}/${packagename}?rev=${rev}"
fi
else else
echo "Warning: No build data found - chroot build?" echo "Warning: No build data found - chroot build?"
DISTURL="local" DISTURL="local"
@ -112,5 +122,6 @@ fi
sed -i"" \ sed -i"" \
-e "s#%DISTURL%#${DISTURL}#g" \ -e "s#%DISTURL%#${DISTURL}#g" \
-e "s#%SOURCEURL%#${SOURCEURL}#g" \
-e "s/%RELEASE%/${RELEASE}/g" \ -e "s/%RELEASE%/${RELEASE}/g" \
-e "s/%BUILDTIME%/$(date --utc +%FT%T.%NZ)/g" "${files[@]}" -e "s/%BUILDTIME%/$(date --utc +%FT%T.%NZ)/g" "${files[@]}"

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu Jan 13 09:32:09 UTC 2022 - Frederic Crozat <fcrozat@suse.com>
- Generate SOURCEURL based on DISTURL.
- Bump version to 0.4
------------------------------------------------------------------- -------------------------------------------------------------------
Wed Jun 2 14:23:53 UTC 2021 - Jeff Kowalczyk <jkowalczyk@suse.com> Wed Jun 2 14:23:53 UTC 2021 - Jeff Kowalczyk <jkowalczyk@suse.com>

View File

@ -1,7 +1,7 @@
# #
# spec file for package obs-service-kiwi_metainfo_helper # spec file for package obs-service-kiwi_metainfo_helper
# #
# Copyright (c) 2021 SUSE LLC # Copyright (c) 2022 SUSE LLC
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -17,7 +17,7 @@
Name: obs-service-kiwi_metainfo_helper Name: obs-service-kiwi_metainfo_helper
Version: 0.3 Version: 0.4
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