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 2021-01-30 13:56:06
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/obs-service-kiwi_metainfo_helper (Old)
 and      
/work/SRC/openSUSE:Factory/.obs-service-kiwi_metainfo_helper.new.28504 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "obs-service-kiwi_metainfo_helper"

Sat Jan 30 13:56:06 2021 rev:7 rq:867218 version:0.2

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/obs-service-kiwi_metainfo_helper/obs-service-kiwi_metainfo_helper.changes
        2020-09-05 23:59:59.379181347 +0200
+++ 
/work/SRC/openSUSE:Factory/.obs-service-kiwi_metainfo_helper.new.28504/obs-service-kiwi_metainfo_helper.changes
     2021-01-30 13:56:06.742002309 +0100
@@ -1,0 +2,6 @@
+Wed Jan 27 11:25:26 UTC 2021 - Fabian Vogt <[email protected]>
+
+- Read os-release from the to be installed RPMs. This avoids pulling
+  in distribution-release when not necessary (boo#1180263)
+
+-------------------------------------------------------------------

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

Other differences:
------------------
++++++ obs-service-kiwi_metainfo_helper.spec ++++++
--- /var/tmp/diff_new_pack.UDuHGY/_old  2021-01-30 13:56:07.286003385 +0100
+++ /var/tmp/diff_new_pack.UDuHGY/_new  2021-01-30 13:56:07.290003393 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package obs-service-kiwi_metainfo_helper
 #
-# Copyright (c) 2020 SUSE LLC
+# Copyright (c) 2021 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.1
+Version:        0.2
 Release:        0
 Summary:        Service for substituting various variables in build recipes
 License:        GPL-2.0-or-later
@@ -26,12 +26,9 @@
 Source0:        kiwi_metainfo_helper.service
 Source1:        kiwi_metainfo_helper
 Source2:        README
-Requires:       sed
-# Technically, this should read os-release inside the built image, but doing
-# that is much more complex. As obsrepositories:// has to be used anyway,
-# using the system's os-release is fine for now.
-Requires:       (sles-release or openSUSE-release)
-Conflicts:      dummy-release
+Requires:       /usr/bin/find
+Requires:       /usr/bin/grep
+Requires:       /usr/bin/sed
 BuildArch:      noarch
 
 %description

++++++ kiwi_metainfo_helper ++++++
--- /var/tmp/diff_new_pack.UDuHGY/_old  2021-01-30 13:56:07.330003472 +0100
+++ /var/tmp/diff_new_pack.UDuHGY/_new  2021-01-30 13:56:07.330003472 +0100
@@ -1,5 +1,5 @@
 #!/bin/bash
-set -eu
+set -euo pipefail
 shopt -s nullglob
 
 if [ "${BUILD_DIST+x}" != "x" ]; then
@@ -33,17 +33,49 @@
        fi
 fi
 
-[ -f /usr/lib/os-release ] && . /usr/lib/os-release
-[ -f /etc/os-release ] && . /etc/os-release
+# Print all rpm files which contain os-release
+find_release_rpms() {
+       find ./repos -name \*-release\*.rpm | while read rpm; do
+               if rpm -qlp "${rpm}" | grep -qE 
"^(/etc/os-release|/usr/lib/os-release)$"; then
+                       echo "${rpm}"
+               fi
+       done
+}
+
+if grep -q "%OS_" ${files[@]}; then
+       # Needs os-release, search for RPMs
+       relpkgs=($(find_release_rpms))
+
+       if [ ${#relpkgs[@]} -lt 1 ]; then
+               echo "No release package found, but recipe uses %OS_*% 
placeholders"
+               exit 1
+       fi
+
+       if [ ${#relpkgs[@]} -gt 1 ]; then
+               echo "Multiple release packages found, don't know which 
os-release to use"
+               exit 1
+       fi
 
-# Special case for SLE X "SP 0", make sure it has .0
-VERSION_ID_SP="${VERSION_ID}"
-[[ "${VERSION_ID_SP%}" == *"."* ]] || VERSION_ID_SP="${VERSION_ID}.0"
+       # Extract the content
+       tempdir=$(mktemp -d)
+       trap "rm -r ${tempdir}" EXIT
+       rpm2cpio "${relpkgs[0]}" | cpio -idD "${tempdir}"
+
+       # And source it
+       [ -f "${tempdir}/usr/lib/os-release" ] && . 
"${tempdir}/usr/lib/os-release"
+       [ -f "${tempdir}/etc/os-release" ] && . "${tempdir}/etc/os-release"
+
+       # Special case for SLE X "SP 0", make sure it has .0
+       VERSION_ID_SP="${VERSION_ID}"
+       [[ "${VERSION_ID_SP%}" == *"."* ]] || VERSION_ID_SP="${VERSION_ID}.0"
+
+       sed -i"" \
+           -e "s/%OS_VERSION_ID%/${VERSION_ID}/g" \
+           -e "s/%OS_PRETTY_NAME%/${PRETTY_NAME}/g" \
+           -e "s/%OS_VERSION_ID_SP%/${VERSION_ID_SP}/g" "${files[@]}"
+fi
 
 sed -i"" \
     -e "s#%DISTURL%#${DISTURL}#g" \
     -e "s/%RELEASE%/${RELEASE}/g" \
-    -e "s/%BUILDTIME%/$(date --utc +%FT%T.%NZ)/g" \
-    -e "s/%OS_VERSION_ID%/${VERSION_ID}/g" \
-    -e "s/%OS_PRETTY_NAME%/${PRETTY_NAME}/g" \
-    -e "s/%OS_VERSION_ID_SP%/${VERSION_ID_SP}/g" "${files[@]}"
+    -e "s/%BUILDTIME%/$(date --utc +%FT%T.%NZ)/g" "${files[@]}"

Reply via email to