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 2022-01-20 00:12:01
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/obs-service-kiwi_metainfo_helper (Old)
 and      /work/SRC/openSUSE:Factory/.obs-service-kiwi_metainfo_helper.new.1892 
(New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "obs-service-kiwi_metainfo_helper"

Thu Jan 20 00:12:01 2022 rev:10 rq:946926 version:0.4

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/obs-service-kiwi_metainfo_helper/obs-service-kiwi_metainfo_helper.changes
        2021-06-24 18:22:35.800917714 +0200
+++ 
/work/SRC/openSUSE:Factory/.obs-service-kiwi_metainfo_helper.new.1892/obs-service-kiwi_metainfo_helper.changes
      2022-01-20 00:12:33.690590157 +0100
@@ -1,0 +2,13 @@
+Mon Jan 17 09:57:02 UTC 2022 - Fabian Vogt <fv...@suse.com>
+
+- Add test suite (test.sh, sles-release-15.4-150400.32.2.x86_64.rpm)
+- Fix SOURCEURL for multibuild DISTURLs
+- Set SOURCEURL also in chroot builds
+
+-------------------------------------------------------------------
+Thu Jan 13 09:32:09 UTC 2022 - Frederic Crozat <fcro...@suse.com>
+
+- Generate SOURCEURL based on DISTURL.
+- Bump version to 0.4
+
+-------------------------------------------------------------------

New:
----
  sles-release-15.4-150400.32.2.x86_64.rpm
  test.sh

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

Other differences:
------------------
++++++ obs-service-kiwi_metainfo_helper.spec ++++++
--- /var/tmp/diff_new_pack.xrRAk4/_old  2022-01-20 00:12:34.234590597 +0100
+++ /var/tmp/diff_new_pack.xrRAk4/_new  2022-01-20 00:12:34.242590603 +0100
@@ -1,7 +1,7 @@
 #
 # 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
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
 
 
 Name:           obs-service-kiwi_metainfo_helper
-Version:        0.3
+Version:        0.4
 Release:        0
 Summary:        Service for substituting various variables in build recipes
 License:        GPL-2.0-or-later
@@ -26,6 +26,10 @@
 Source0:        kiwi_metainfo_helper.service
 Source1:        kiwi_metainfo_helper
 Source2:        README
+# For %%check
+Source3:        test.sh
+Source4:        sles-release-15.4-150400.32.2.x86_64.rpm
+BuildRequires:  diffutils
 Requires:       /usr/bin/find
 Requires:       /usr/bin/grep
 Requires:       /usr/bin/sed
@@ -42,10 +46,12 @@
 %build
 
 %install
+mkdir -p %{buildroot}%{_prefix}/lib/obs/service/
+install -m 0644 %{SOURCE0} %{buildroot}%{_prefix}/lib/obs/service/
+install -m 0755 %{SOURCE1} %{buildroot}%{_prefix}/lib/obs/service/
 
-mkdir -p %{buildroot}%{_prefix}/lib/obs/service
-install -m 0644 %{SOURCE0} %{buildroot}%{_prefix}/lib/obs/service
-install -m 0755 %{SOURCE1} %{buildroot}%{_prefix}/lib/obs/service
+%check
+sh %{SOURCE3}
 
 %files
 %doc README

++++++ README ++++++
--- /var/tmp/diff_new_pack.xrRAk4/_old  2022-01-20 00:12:34.306590655 +0100
+++ /var/tmp/diff_new_pack.xrRAk4/_new  2022-01-20 00:12:34.314590661 +0100
@@ -5,16 +5,18 @@
 build recipe (.kiwi, Dockerfile, Chart.yaml) to replace placeholders with
 build-specific metainfo.
 
-| Placeholder                          | Value                                 
         | Example                                                              
                          |
-|--------------------------------------|-----------------------------------------------
 
|------------------------------------------------------------------------------------------------|
-| %DISTURL%                            | The OBS dist url                      
         | 
obs://build.suse.de/SUSE:SLE-15:Update:CR/images/2951b67133dd6384cacb28203174e030-sles15-image
 |
-| %RELEASE%                            | The OBS release number 
(<cicnt\>.<bldcnt\>)    | 4.2                                                   
                                         |
-| %BUILDTIME%                          | $(date --utc +%FT%T.%NZ)              
         | 2018-10-30T09:19:02.074934628Z                                       
                          |
-| %OS_VERSION_ID%                      | VERSION_ID in the os-release file     
         | 15                                                                   
                          |
-| %OS_VERSION_ID_SP%                   | Like VERSION_ID, but with SP (SLE 
only)        | 15.0                                                             
                              |
-| %OS_PRETTY_NAME%                     | PRETTY_NAME in the os-release file    
         | SUSE Linux Enterprise Server 15 SP3 (Snapshot16)                     
                          |
-| %OS_VENDOR%                          | PRETTY_NAME up to first space 
character        | SUSE                                                         
                                  |
-| %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                               
                             |
+| Placeholder                          | Value                                 
         | Example                                                              
                                                   |
+|--------------------------------------|-----------------------------------------------
 
|-------------------------------------------------------------------------------------------------------------------------|
+| %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 (IBS) 
         | 
https://sources.suse.com/SUSE:SLE-15:Update:CR/sles15-image/2951b67133dd6384cacb28203174e030/
                           |
+| %RELEASE%                            | The OBS release number 
(<cicnt\>.<bldcnt\>)    | 4.2                                                   
                                                                  |
+| %BUILDTIME%                          | $(date --utc +%FT%T.%NZ)              
         | 2018-10-30T09:19:02.074934628Z                                       
                                                   |
+| %OS_VERSION_ID%                      | VERSION_ID in the os-release file     
         | 15                                                                   
                                                   |
+| %OS_VERSION_ID_SP%                   | Like VERSION_ID, but with SP (SLE 
only)        | 15.0                                                             
                                                       |
+| %OS_PRETTY_NAME%                     | PRETTY_NAME in the os-release file    
         | SUSE Linux Enterprise Server 15 SP3 (Snapshot16)                     
                                                   |
+| %OS_VENDOR%                          | PRETTY_NAME up to first space 
character        | SUSE                                                         
                                                           |
+| %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                               
                                                      |
 

++++++ kiwi_metainfo_helper ++++++
--- /var/tmp/diff_new_pack.xrRAk4/_old  2022-01-20 00:12:34.334590678 +0100
+++ /var/tmp/diff_new_pack.xrRAk4/_new  2022-01-20 00:12:34.338590680 +0100
@@ -34,6 +34,17 @@
        fi
 fi
 
+# 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- | cut -d: -f1)
+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
+
 # Print all rpm files which contain os-release
 find_release_rpms() {
        find ./repos -name \*-release\*.rpm | while read rpm; do
@@ -112,6 +123,7 @@
 
 sed -i"" \
     -e "s#%DISTURL%#${DISTURL}#g" \
+    -e "s#%SOURCEURL%#${SOURCEURL}#g" \
     -e "s/%RELEASE%/${RELEASE}/g" \
     -e "s/%BUILDTIME%/$(date --utc +%FT%T.%NZ)/g" "${files[@]}"
 

++++++ test.sh ++++++
#!/bin/sh
set -eu
tmpdir=$(mktemp -d)
trap 'rm -rf ${tmpdir}' EXIT

sourcedir="$(realpath "$(dirname $0)")"
script="${sourcedir}/kiwi_metainfo_helper"

cd $tmpdir

# Setup environment

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'
#!/bin/sh
exec /usr/bin/date -d "2018-10-30T09:19:02.074934628Z" "$@"
EOF
chmod a+x ${tmpdir}/date

cat >.data <<EOF
DISTURL="obs://build.opensuse.org/openSUSE:Factory/images/0f40c57dd619e1dff9e512949b6bca09-opensuse-tumbleweed-image:docker"
RELEASE=4.2
RECIPEFILE=_service:foobar:Dockerfile
EOF
export BUILD_DIST=.dist

cat >Dockerfile <<EOF
DISTURL=%DISTURL%
SOURCEURL=%SOURCEURL%
RELEASE=%RELEASE%
BUILDTIME=%BUILDTIME%
OS_VERSION_ID=%OS_VERSION_ID%
OS_VERSION_ID_SP=%OS_VERSION_ID_SP%
OS_PRETTY_NAME=%OS_PRETTY_NAME%
OS_VENDOR=%OS_VENDOR%
OS_PRETTY_NAME_DASHED=%OS_PRETTY_NAME_DASHED%
OS_PRETTY_NAME_BEFORE_PAREN=%OS_PRETTY_NAME_BEFORE_PAREN%
OS_PRETTY_NAME_BEFORE_PAREN_DASHED=%OS_PRETTY_NAME_BEFORE_PAREN_DASHED%
EOF

bash "${script}"

diff -u Dockerfile - <<EOF
DISTURL=obs://build.opensuse.org/openSUSE:Factory/images/0f40c57dd619e1dff9e512949b6bca09-opensuse-tumbleweed-image:docker
SOURCEURL=https://build.opensuse.org/package/show/openSUSE:Factory/opensuse-tumbleweed-image?rev=0f40c57dd619e1dff9e512949b6bca09
RELEASE=4.2
BUILDTIME=2018-10-30T09:19:02.074934628Z
OS_VERSION_ID=15.4
OS_VERSION_ID_SP=15.4
OS_PRETTY_NAME=SUSE Linux Enterprise Server 15 SP4
OS_VENDOR=SUSE
OS_PRETTY_NAME_DASHED=SUSE-Linux-Enterprise-Server-15-SP4
OS_PRETTY_NAME_BEFORE_PAREN=SUSE Linux Enterprise Server 15 SP4
OS_PRETTY_NAME_BEFORE_PAREN_DASHED=SUSE-Linux-Enterprise-Server-15-SP4
EOF

# Now with a build.suse.de DISTURL
cat >.data <<EOF
DISTURL="obs://build.suse.de/SUSE:SLE-15-SP3:Update:CR/images/5f0a221b7877396cbf977205e64690d2-sles15-image"
RELEASE=4.2
RECIPEFILE=_service:foobar:Dockerfile
EOF

cat >Dockerfile <<EOF
DISTURL=%DISTURL%
SOURCEURL=%SOURCEURL%
EOF

bash "${script}"

diff -u Dockerfile - <<EOF
DISTURL=obs://build.suse.de/SUSE:SLE-15-SP3:Update:CR/images/5f0a221b7877396cbf977205e64690d2-sles15-image
SOURCEURL=https://sources.suse.com/SUSE:SLE-15-SP3:Update:CR/sles15-image/5f0a221b7877396cbf977205e64690d2/
EOF

# Now test without build data (osc chroot build) and that without %OS_*% it 
doesn't need a release RPM
rm -r ./.data ./repos/

cat >Dockerfile <<EOF
DISTURL=%DISTURL%
SOURCEURL=%SOURCEURL%
RELEASE=%RELEASE%
BUILDTIME=%BUILDTIME%
EOF

bash "${script}"

diff -u Dockerfile - <<EOF
DISTURL=local
SOURCEURL=https://local/package/show/local/local?rev=local
RELEASE=0
BUILDTIME=2018-10-30T09:19:02.074934628Z
EOF

Reply via email to