From aa0d7cd11f17df7104c5e0f22608338b0d6502a80d2f38007c992c15a85fa9d0 Mon Sep 17 00:00:00 2001 From: Fabian Vogt Date: Mon, 10 Jun 2024 13:49:14 +0000 Subject: [PATCH] Accepting request 1179155 from isv:Rancher:Elemental:Dev - Support Docker.FLAVOR in _multibuild (boo#1225985) OBS-URL: https://build.opensuse.org/request/show/1179155 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Tools/obs-service-docker_label_helper?expand=0&rev=13 --- docker_label_helper | 10 ++++--- obs-service-docker_label_helper.changes | 5 ++++ test.sh | 39 +++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 4 deletions(-) diff --git a/docker_label_helper b/docker_label_helper index 7ee51d1..3f98753 100644 --- a/docker_label_helper +++ b/docker_label_helper @@ -1,6 +1,8 @@ #!/bin/bash set -eu +file="Dockerfile" + if [ "${BUILD_DIST+x}" != "x" ]; then echo "Not running in an OBS build container" exit 1 @@ -11,10 +13,10 @@ if [ -e "${BUILD_DATA}" ]; then . "${BUILD_DATA}" # The build script renames the recipe (to strip _service:foo:), but doesn't update .data - RECIPEFILE="${RECIPEFILE##*:}" + file="${RECIPEFILE##*:}" - if [ "${RECIPEFILE}" != "Dockerfile" ]; then - echo "Recipe is not a Dockerfile - exiting" + if [[ ! "${file}" =~ ^Dockerfile.* ]]; then + echo "Recipe ${file} is not a Dockerfile - exiting" exit 0 fi fi @@ -24,4 +26,4 @@ gawk -i inplace ' match($0, /^# labelprefix=(.*)$/, m) { labelprefix=m[1]; next } labelprefix != "" && match($0, /^(PREFIXED)?LABEL[[:space:]]+[^=]*\.([^.=]*)=(.*)$/, m) { printf "LABEL %s.%s=%s\n", labelprefix, m[2], m[3]; gsub(/^PREFIXEDLABEL/, "LABEL") } match($0, /^# endlabelprefix/) { labelprefix=""; next } - 1' Dockerfile + 1' "${file}" \ No newline at end of file diff --git a/obs-service-docker_label_helper.changes b/obs-service-docker_label_helper.changes index 3e7d118..52c5d49 100644 --- a/obs-service-docker_label_helper.changes +++ b/obs-service-docker_label_helper.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Fri Jun 7 08:31:35 UTC 2024 - Andrea Mazzotti + +- Support Docker.FLAVOR in _multibuild (boo#1225985) + ------------------------------------------------------------------- Wed Mar 1 07:54:19 UTC 2023 - Fabian Vogt diff --git a/test.sh b/test.sh index ea207c9..d747abb 100644 --- a/test.sh +++ b/test.sh @@ -57,3 +57,42 @@ LABEL org.opensuse.nano.whitespace="Two spaces. One tab." LABEL test.whitespace="Two spaces. One tab." LABEL not.expanded.label="example" EOF + +# Test _multibuild +cat >Dockerfile.FLAVOR <"$tmpdir/test_multibuild/.build/build.data" <NotADockerfile <"$tmpdir/test_multibuild/.build/build.data" <