diff --git a/cdi_containers_meta b/cdi_containers_meta index 4177cdf..420ea2d 100644 --- a/cdi_containers_meta +++ b/cdi_containers_meta @@ -1,23 +1,10 @@ #!/bin/bash -distro=$(rpm --eval '%{?sle_version}:%{?is_opensuse}%{!?is_opensuse:0}') -case "${distro}" in -150200:0) - TAGPREFIX=suse/sles/15.2 - LABELPREFIX=com.suse.kubevirt - REGISTRY=registry.suse.com - ;; -150300:0) - TAGPREFIX=suse/sles/15.3 - LABELPREFIX=com.suse.kubevirt - REGISTRY=registry.suse.com - ;; -*) - TAGPREFIX=kubevirt - LABELPREFIX=org.opensuse.kubevirt - REGISTRY=registry.opensuse.org - ;; -esac +TAGPREFIX=_TAGPREFIX_ +LABELPREFIX=_LABELPREFIX_ +REGISTRY=_REGISTRY_ +PKG_VERSION=_PKG_VERSION_ +PKG_RELEASE=_PKG_RELEASE_ if [ -n "${pkg}" ]; then if rpm -q ${pkg}; then diff --git a/containerized-data-importer.changes b/containerized-data-importer.changes index 6607465..ec2cc00 100644 --- a/containerized-data-importer.changes +++ b/containerized-data-importer.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Wed Jun 30 05:36:37 UTC 2021 - Vasily Ulyanov + +- Generate meta info for containers during rpm build + ------------------------------------------------------------------- Mon Jun 14 06:05:08 UTC 2021 - Vasily Ulyanov diff --git a/containerized-data-importer.spec b/containerized-data-importer.spec index 83628ba..3e109e3 100644 --- a/containerized-data-importer.spec +++ b/containerized-data-importer.spec @@ -133,20 +133,39 @@ tar --strip-components=1 -xf %{S:0} # If 'kubevirt_registry_path' is not specified, the standard publish location for # SLE and openSUSE-based containers is used. # -%if "%{?kubevirt_registry_path}" == "" -distro='%{?sle_version}:%{is_opensuse}' +distro='%{?sle_version}:%{?is_opensuse}%{!?is_opensuse:0}' case "${distro}" in 150200:0) - reg_path='registry.suse.com/suse/sles/15.2' ;; + tagprefix=suse/sles/15.2 + labelprefix=com.suse.kubevirt + registry=registry.suse.com + ;; 150300:0) - reg_path='registry.suse.com/suse/sles/15.3' ;; + tagprefix=suse/sles/15.3 + labelprefix=com.suse.kubevirt + registry=registry.suse.com + ;; *) - reg_path='registry.opensuse.org/kubevirt' ;; + tagprefix=kubevirt + labelprefix=org.opensuse.kubevirt + registry=registry.opensuse.org + ;; esac + +%if "%{?kubevirt_registry_path}" == "" + reg_path="${registry}/${tagprefix}" %else -reg_path='%{kubevirt_registry_path}' + reg_path='%{kubevirt_registry_path}' %endif +sed -i"" \ + -e "s#_TAGPREFIX_#${tagprefix}#g" \ + -e "s#_LABELPREFIX_#${labelprefix}#g" \ + -e "s#_REGISTRY_#${registry}#g" \ + -e "s#_PKG_VERSION_#%{version}#g" \ + -e "s#_PKG_RELEASE_#%{release}#g" \ + %{S:1} + export GOPATH=%{_builddir}/go export GOFLAGS="-buildmode=pie -mod=vendor" env \