From 52cdbfb21abfb0599cf1d2862d92bb552013e88dfc4ea6f8dc93e45cec9b955a Mon Sep 17 00:00:00 2001 From: Vasily Ulyanov Date: Thu, 1 Dec 2022 12:03:24 +0000 Subject: [PATCH] Accepting request 1039303 from home:vulyanov:branches:Virtualization - Ensure RPMs and containers are built against the same distro - Be more strict when discovering the registry path: error out if the distro is unknown, instead of falling through to 'opensuse' by default OBS-URL: https://build.opensuse.org/request/show/1039303 OBS-URL: https://build.opensuse.org/package/show/Virtualization/containerized-data-importer?expand=0&rev=61 --- cdi_containers_meta | 8 +++++++- containerized-data-importer.changes | 8 ++++++++ containerized-data-importer.spec | 7 ++++++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/cdi_containers_meta b/cdi_containers_meta index 420ea2d..e3b995a 100644 --- a/cdi_containers_meta +++ b/cdi_containers_meta @@ -1,10 +1,16 @@ -#!/bin/bash +#!/bin/bash -xe TAGPREFIX=_TAGPREFIX_ LABELPREFIX=_LABELPREFIX_ REGISTRY=_REGISTRY_ PKG_VERSION=_PKG_VERSION_ PKG_RELEASE=_PKG_RELEASE_ +DISTRO=_DISTRO_ + +# Set HOME=/root as a workaround for +# https://github.com/openSUSE/obs-build/issues/901 +_distro=$(HOME=/root rpm --eval '%{?sle_version}:%{?is_opensuse}%{!?is_opensuse:0}') +[ "${DISTRO}" == "${_distro}" ] || exit 1 if [ -n "${pkg}" ]; then if rpm -q ${pkg}; then diff --git a/containerized-data-importer.changes b/containerized-data-importer.changes index e3dfae9..21a621a 100644 --- a/containerized-data-importer.changes +++ b/containerized-data-importer.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Thu Dec 1 09:58:30 UTC 2022 - Vasily Ulyanov + +- Ensure RPMs and containers are built against the same distro +- Be more strict when discovering the registry path: error out if the + distro is unknown, instead of falling through to 'opensuse' by + default + ------------------------------------------------------------------- Sat Oct 15 13:41:00 UTC 2022 - Vasily Ulyanov diff --git a/containerized-data-importer.spec b/containerized-data-importer.spec index d3c568e..5c23bd3 100644 --- a/containerized-data-importer.spec +++ b/containerized-data-importer.spec @@ -156,11 +156,15 @@ case "${distro}" in labelprefix=com.suse.kubevirt registry=registry.suse.com ;; -*) +*:1) tagprefix=kubevirt labelprefix=org.opensuse.kubevirt registry=registry.opensuse.org ;; +*) + echo "Unsupported distro: ${distro}" >&2 + exit 1 + ;; esac %if "%{?kubevirt_registry_path}" == "" @@ -175,6 +179,7 @@ sed -i"" \ -e "s#_REGISTRY_#${registry}#g" \ -e "s#_PKG_VERSION_#%{version}#g" \ -e "s#_PKG_RELEASE_#%{release}#g" \ + -e "s#_DISTRO_#${distro}#g" \ %{S:1} export GOPATH=%{_builddir}/go