Hello community,

here is the log from the commit of package obs-service-kiwi_metainfo_helper for 
openSUSE:Factory checked in at 2020-07-15 11:11:47
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/obs-service-kiwi_metainfo_helper (Old)
 and      /work/SRC/openSUSE:Factory/.obs-service-kiwi_metainfo_helper.new.3060 
(New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "obs-service-kiwi_metainfo_helper"

Wed Jul 15 11:11:47 2020 rev:4 rq:819507 version:0.0

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/obs-service-kiwi_metainfo_helper/obs-service-kiwi_metainfo_helper.changes
        2020-05-07 17:49:46.509177626 +0200
+++ 
/work/SRC/openSUSE:Factory/.obs-service-kiwi_metainfo_helper.new.3060/obs-service-kiwi_metainfo_helper.changes
      2020-07-15 11:11:58.688819180 +0200
@@ -1,0 +2,11 @@
+Tue Jul  7 13:53:33 UTC 2020 - Fabian Vogt <[email protected]>
+
+- Add explicit fallback for chroot builds
+- Refactor into a single sed call
+
+-------------------------------------------------------------------
+Tue May  5 09:19:56 UTC 2020 - Fabian Vogt <[email protected]>
+
+- Also allow working on Dockerfile
+
+-------------------------------------------------------------------

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

Other differences:
------------------
++++++ kiwi_metainfo_helper ++++++
--- /var/tmp/diff_new_pack.ZPtKHc/_old  2020-07-15 11:11:59.140819647 +0200
+++ /var/tmp/diff_new_pack.ZPtKHc/_new  2020-07-15 11:11:59.140819647 +0200
@@ -1,5 +1,6 @@
 #!/bin/bash
 set -eu
+shopt -s nullglob
 
 if [ "${BUILD_DIST+x}" != "x" ]; then
        echo "Not running in an OBS build container"
@@ -7,28 +8,42 @@
 fi
 
 BUILD_DATA="${BUILD_DIST/.dist/.data}"
-. "${BUILD_DATA}"
+if [ -e "${BUILD_DATA}" ]; then
+       . "${BUILD_DATA}"
 
-# The build script renames the recipe (to strip _service:foo:), but doesn't 
update .data
-RECIPEFILE="${RECIPEFILE##*:}"
+       # The build script renames the recipe (to strip _service:foo:), but 
doesn't update .data
+       RECIPEFILE="${RECIPEFILE##*:}"
 
-if [ "${RECIPEFILE##*.}" != "kiwi" ]; then
-       echo "Recipe is not a kiwi file - exiting"
-       exit 0
+       if [ "${RECIPEFILE##*.}" != "kiwi" ] && [ "${RECIPEFILE}" != 
"Dockerfile" ]; then
+               echo "Recipe is neither Dockerfile nor kiwi - exiting"
+               exit 0
+       fi
+
+       files=("${RECIPEFILE}")
+else
+       echo "Warning: No build data found - chroot build?"
+       DISTURL="local"
+       RELEASE=0
+
+       # Guess the build recipe
+       files=(*.kiwi Dockerfile*)
+       if [ "${#files}" -eq 0 ]; then
+               echo "No kiwi or Dockerfile found - exiting"
+               exit 0
+       fi
 fi
 
-sed -i"" "s#%DISTURL%#${DISTURL}#g" "${RECIPEFILE}"
-sed -i"" "s/%RELEASE%/${RELEASE}/g" "${RECIPEFILE}"
-sed -i"" "s/%BUILDTIME%/$(date --utc +%FT%T.%NZ)/g" "${RECIPEFILE}"
-
 [ -f /usr/lib/os-release ] && . /usr/lib/os-release
 [ -f /etc/os-release ] && . /etc/os-release
 
-sed -i"" "s/%OS_VERSION_ID%/${VERSION_ID}/g" "${RECIPEFILE}"
-sed -i"" "s/%OS_PRETTY_NAME%/${PRETTY_NAME}/g" "${RECIPEFILE}"
-
 # 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"" "s/%OS_VERSION_ID_SP%/${VERSION_ID_SP}/g" "${RECIPEFILE}"
+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[@]}"


Reply via email to