From 94d90edf12603bde659db011c5fc4ae26162f04bcb237a93774f95849737dba4 Mon Sep 17 00:00:00 2001 From: Fabian Vogt Date: Wed, 8 Jul 2020 15:10:36 +0000 Subject: [PATCH] Accepting request 819504 from home:favogt:chrootservices OBS-URL: https://build.opensuse.org/request/show/819504 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Tools/obs-service-kiwi_label_helper?expand=0&rev=6 --- kiwi_label_helper | 44 +++++++++++++++++++-------- obs-service-kiwi_label_helper.changes | 5 +++ 2 files changed, 36 insertions(+), 13 deletions(-) diff --git a/kiwi_label_helper b/kiwi_label_helper index 86c89f9..63698b2 100644 --- a/kiwi_label_helper +++ b/kiwi_label_helper @@ -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,21 +8,38 @@ if [ "${BUILD_DIST+x}" != "x" ]; then 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" ]; then + echo "Recipe is not a kiwi file - 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) + if [ "${#files}" -eq 0 ]; then + echo "No kiwi recipe - exiting" + exit 0 + fi fi -tmp=$(mktemp) -if ! xsltproc /usr/lib/kiwi_label_helper/label_helper.xsl "${RECIPEFILE}" >> "${tmp}"; then - rm "${tmp}" - echo "xsltproc failed" - exit 1 -fi +for file in "${files[@]}"; do + tmp="$(mktemp)" + if ! xsltproc /usr/lib/kiwi_label_helper/label_helper.xsl "${file}" >> "${tmp}"; then + rm "${tmp}" + echo "xsltproc failed" + exit 1 + fi -mv -f "${tmp}" "${RECIPEFILE}" + mv -f "${tmp}" "${file}" +done diff --git a/obs-service-kiwi_label_helper.changes b/obs-service-kiwi_label_helper.changes index 6ff7653..e0b81a7 100644 --- a/obs-service-kiwi_label_helper.changes +++ b/obs-service-kiwi_label_helper.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Tue Jul 7 14:42:29 UTC 2020 - Fabian Vogt + +- Add explicit fallback for chroot builds + ------------------------------------------------------------------- Mon May 4 13:42:18 UTC 2020 - Fabian Vogt