Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package obs-service-kiwi_metainfo_helper for 
openSUSE:Factory checked in at 2025-04-24 17:25:20
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/obs-service-kiwi_metainfo_helper (Old)
 and      
/work/SRC/openSUSE:Factory/.obs-service-kiwi_metainfo_helper.new.30101 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "obs-service-kiwi_metainfo_helper"

Thu Apr 24 17:25:20 2025 rev:20 rq:1272309 version:0.6

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/obs-service-kiwi_metainfo_helper/obs-service-kiwi_metainfo_helper.changes
        2024-11-08 11:58:48.216020181 +0100
+++ 
/work/SRC/openSUSE:Factory/.obs-service-kiwi_metainfo_helper.new.30101/obs-service-kiwi_metainfo_helper.changes
     2025-04-24 17:25:41.053764177 +0200
@@ -1,0 +2,6 @@
+Mon Apr  7 11:54:26 UTC 2025 - Ladislav Slezák <lsle...@suse.com>
+
+- Do the replacements also in the "config.sh" file in Kiwi builds
+  (bsc#1240886)
+
+-------------------------------------------------------------------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ obs-service-kiwi_metainfo_helper.spec ++++++
--- /var/tmp/diff_new_pack.hZj0jk/_old  2025-04-24 17:25:41.673790195 +0200
+++ /var/tmp/diff_new_pack.hZj0jk/_new  2025-04-24 17:25:41.673790195 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package obs-service-kiwi_metainfo_helper
 #
-# Copyright (c) 2024 SUSE LLC
+# Copyright (c) 2025 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed

++++++ README ++++++
--- /var/tmp/diff_new_pack.hZj0jk/_old  2025-04-24 17:25:41.709791706 +0200
+++ /var/tmp/diff_new_pack.hZj0jk/_new  2025-04-24 17:25:41.713791873 +0200
@@ -3,7 +3,8 @@
 
 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-specific metainfo.
+build-specific metainfo. In Kiwi builds it processes also the config.sh
+script.
 
 | Placeholder                          | Value                                 
                                               | Example                        
                                                                                
         |
 
|--------------------------------------|--------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------|

++++++ kiwi_metainfo_helper ++++++
--- /var/tmp/diff_new_pack.hZj0jk/_old  2025-04-24 17:25:41.729792545 +0200
+++ /var/tmp/diff_new_pack.hZj0jk/_new  2025-04-24 17:25:41.729792545 +0200
@@ -22,6 +22,11 @@
        fi
 
        files=("${RECIPEFILE}")
+
+       # process also the config.sh script in Kiwi builds
+       if [ "${RECIPEFILE##*.}" == "kiwi" ] && [ -f "config.sh" ]; then
+               files+=("config.sh")
+       fi
 else
        echo "Warning: No build data found - chroot build?"
        DISTURL="local"
@@ -34,6 +39,16 @@
                echo "No kiwi recipe, Dockerfile or helm chart found - exiting"
                exit 0
        fi
+
+       # process also the config.sh script in Kiwi builds
+       for kiwi_file in *.kiwi; do 
+               if [ -f "$kiwi_file" ]; then
+                       if [ -f "config.sh" ]; then
+                               files+=("config.sh")
+                       fi
+                       break
+               fi
+       done
 fi
 
 # generate %SOURCEURL% based on DISTURL with a special case for build.suse.de

++++++ test.sh ++++++
--- /var/tmp/diff_new_pack.hZj0jk/_old  2025-04-24 17:25:41.761793888 +0200
+++ /var/tmp/diff_new_pack.hZj0jk/_new  2025-04-24 17:25:41.761793888 +0200
@@ -3,23 +3,23 @@
 tmpdir=$(mktemp -d)
 trap 'rm -rf ${tmpdir}' EXIT
 
-sourcedir="$(realpath "$(dirname $0)")"
+sourcedir="$(realpath "$(dirname "$0")")"
 script="${sourcedir}/kiwi_metainfo_helper"
 
-cd $tmpdir
+cd "$tmpdir"
 
 # Setup environment
 
-mkdir -p ${tmpdir}/repos/
-cp "${sourcedir}/sles-release-15.4-150400.32.2.x86_64.rpm" ${tmpdir}/repos/
+mkdir -p "${tmpdir}/repos/"
+cp "${sourcedir}/sles-release-15.4-150400.32.2.x86_64.rpm" "${tmpdir}/repos/"
 
 # Mock "date"
-export PATH=${tmpdir}:$PATH
-cat >${tmpdir}/date <<'EOF'
+export PATH="${tmpdir}:$PATH"
+cat >"${tmpdir}/date" <<'EOF'
 #!/bin/sh
 exec /usr/bin/date -d "2018-10-30T09:19:02.074934628Z" "$@"
 EOF
-chmod a+x ${tmpdir}/date
+chmod a+x "${tmpdir}/date"
 
 cat >.data <<EOF
 
DISTURL="obs://build.opensuse.org/openSUSE:Factory/images/0f40c57dd619e1dff9e512949b6bca09-opensuse-tumbleweed-image:docker"
@@ -175,3 +175,36 @@
 EOF
 rm -r containers/annotation
 
+# test processing .kiwi and config.sh in Kiwi builds
+cat >.data <<EOF
+RELEASE=42
+DISTURL="obs://build.opensuse.org/openSUSE:Factory/test/0f40c57dd619e1dff9e512949b6bca09-test"
+RECIPEFILE=_service:foobar:test.kiwi
+BUILD_ARCH=aarch64:aarch64_ilp32:armv8l
+EOF
+export BUILD_DIST=.dist
+
+cat >test.kiwi - <<EOF
+<?xml version="1.0" encoding="utf-8"?>
+<image schemaversion="8.0" name="test" displayname="Test (Build %RELEASE%)">
+</image>
+EOF
+
+cat >config.sh - <<EOF
+echo "Build: %RELEASE%" > /var/log/build
+EOF
+
+bash "${script}"
+
+diff -u test.kiwi - <<EOF
+<?xml version="1.0" encoding="utf-8"?>
+<image schemaversion="8.0" name="test" displayname="Test (Build 42)">
+</image>
+EOF
+
+diff -u config.sh - <<EOF
+echo "Build: 42" > /var/log/build
+EOF
+
+rm test.kiwi config.sh
+

Reply via email to