1
0

Accepting request 877238 from home:vulyanov:branches:Virtualization

- Fix import of vendor dependencies
  * Arrange the directory layout in buildroot
  * Drop manifest-build-fix.patch
  * Switch to Go 1.14 (used for upstream builds)

OBS-URL: https://build.opensuse.org/request/show/877238
OBS-URL: https://build.opensuse.org/package/show/Virtualization/containerized-data-importer?expand=0&rev=9
This commit is contained in:
James Fehlig 2021-03-09 02:21:52 +00:00 committed by Git OBS Bridge
parent 31b446afb3
commit 4e10c4d5cd
3 changed files with 21 additions and 42 deletions

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Fri Mar 5 06:35:39 UTC 2021 - Vasily Ulyanov <vasily.ulyanov@suse.com>
- Fix import of vendor dependencies
* Arrange the directory layout in buildroot
* Drop manifest-build-fix.patch
* Switch to Go 1.14 (used for upstream builds)
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Feb 26 18:51:12 UTC 2021 - James Fehlig <jfehlig@suse.com> Fri Feb 26 18:51:12 UTC 2021 - James Fehlig <jfehlig@suse.com>

View File

@ -24,12 +24,11 @@ License: Apache-2.0
Group: System/Packages Group: System/Packages
URL: https://github.com/kubevirt/containerized-data-importer URL: https://github.com/kubevirt/containerized-data-importer
Source0: %{name}-%{version}.tar.gz Source0: %{name}-%{version}.tar.gz
Patch0: manifest-build-fix.patch
BuildRequires: golang-packaging BuildRequires: golang-packaging
BuildRequires: pkgconfig BuildRequires: pkgconfig
BuildRequires: rsync BuildRequires: rsync
BuildRequires: sed BuildRequires: sed
BuildRequires: golang(API) = 1.13 BuildRequires: golang(API) = 1.14
BuildRequires: libnbd-devel BuildRequires: libnbd-devel
ExclusiveArch: x86_64 ExclusiveArch: x86_64
@ -94,7 +93,17 @@ This contains the built YAML manifests used to install CDI into a
kubernetes installation with kubectl apply. kubernetes installation with kubectl apply.
%prep %prep
%autosetup -p1 # Unpack the sources respecting the GOPATH directory structure expected by the
# go imports resolver. I.e. if DIR is in GOPATH then DIR/src/foo/bar can be
# imported as "foo/bar". The same 'visibility' rules apply to the local copies
# of external dependencies placed in 'vendor' directory when imported from the
# 'parent' package.
#
# Note: having bar symlink'ed to DIR/src/foo/bar does not seem to work. Looks
# like symlinks in go path are not resolved correctly. Hence the sources need
# to be 'physically' placed into the proper location.
%setup -n go/src/kubevirt.io/%{name} -c -T
tar --strip-components=1 -xf %{S:0}
%build %build
# Hackery to determine which registry path to use in cdi-operator.yaml # Hackery to determine which registry path to use in cdi-operator.yaml
@ -132,9 +141,7 @@ esac
reg_path='%{registry_path}' reg_path='%{registry_path}'
%endif %endif
mkdir -p go/src/kubevirt.io export GOPATH=%{_builddir}/go
ln -s ../../../ go/src/kubevirt.io/containerized-data-importer
export GOPATH=${PWD}/go
export GOFLAGS="-buildmode=pie -mod=vendor" export GOFLAGS="-buildmode=pie -mod=vendor"
env \ env \
CDI_VERSION=%{version} \ CDI_VERSION=%{version} \

View File

@ -1,36 +0,0 @@
Fix build of tools/manifest-generator via build-manifests.sh
tools/manifest-generator/manifest-generator.go can be build with
build-go.sh, but fails when built with build-manifests.sh
./hack/build/build-manifests.sh
manifest-generator.go:22:2: cannot find package "k8s.io/apimachinery/pkg/runtime" in any of:
/usr/lib64/go/1.13/src/k8s.io/apimachinery/pkg/runtime (from $GOROOT)
/home/abuild/rpmbuild/BUILD/containerized-data-importer-1.30.0/go/src/k8s.io/apimachinery/pkg/runtime (from $GOPATH)
manifest-generator.go:23:2: cannot find package "k8s.io/klog/v2" in any of:
/usr/lib64/go/1.13/src/k8s.io/klog/v2 (from $GOROOT)
/home/abuild/rpmbuild/BUILD/containerized-data-importer-1.30.0/go/src/k8s.io/klog/v2 (from $GOPATH)
This hack fixes it by removing GO111MODULE=off. We'll need to verify if
this is a proper fix.
Index: containerized-data-importer-1.30.0/hack/build/build-manifests.sh
===================================================================
--- containerized-data-importer-1.30.0.orig/hack/build/build-manifests.sh
+++ containerized-data-importer-1.30.0/hack/build/build-manifests.sh
@@ -20,7 +20,7 @@ source "${script_dir}"/config.sh
generator="${BIN_DIR}/manifest-generator"
-(cd "${CDI_DIR}/tools/manifest-generator/" && GO111MODULE=off go build -o "${generator}" ./...)
+(cd "${CDI_DIR}/tools/manifest-generator/" && go build -o "${generator}" ./...)
echo "DOCKER_PREFIX=${DOCKER_PREFIX}"
echo "DOCKER_TAG=${DOCKER_TAG}"
@@ -41,4 +41,4 @@ processDirTemplates ${tempDir} ${OUT_DIR
processDirTemplates ${tempDir}/release ${OUT_DIR}/manifests/release ${OUT_DIR}/manifests/templates/release ${generator} ${MANIFEST_GENERATED_DIR}
testsManifestsDir=${CDI_DIR}/tests/manifests
-processDirTemplates ${testsManifestsDir}/templates ${testsManifestsDir}/out ${testsManifestsDir}/out/templates ${generator} ${MANIFEST_GENERATED_DIR}
\ No newline at end of file
+processDirTemplates ${testsManifestsDir}/templates ${testsManifestsDir}/out ${testsManifestsDir}/out/templates ${generator} ${MANIFEST_GENERATED_DIR}