Enable bond-cni to build with golang 1.17

This commit fixes an issue that was seen if golang 1.17
was chosen as the toolchain to build the CNI package.

The go 1.17.5 build complains that the following vendored
modules should be explicitly required in the go.mod file:

github.com/coreos/go-iptables v0.6.0
github.com/safchain/ethtool v0.0.0-20210803160452-9aa261dae9b1
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e

If these are added to the go.mod file, a further complaint
is given that it no longer matches the information in
vendor/modules.txt

The patch files were generated by running go mod tidy for
the go.mod file, and go mod vendor for the vendor/modules.txt.

Since the bond-cni uses go 1.17 in the go directive of its
go.mod file, this commit locks down on this version to attempt
to prevent other issues from arising from new or other golang
versions.

Testing:

- CentOS build
- Debian build
- Spot check of bond-cni functionality on CentOS

Closes-Bug: 1966728

Signed-off-by: Steven Webster <steven.webster@windriver.com>
Change-Id: I14638165db48cda9b89dd666b0c8b7c0a4e8e380
This commit is contained in:
Steven Webster 2022-04-07 20:13:38 -04:00
parent ce6e078c8f
commit d4c56d145f
7 changed files with 144 additions and 4 deletions

View File

@ -26,9 +26,10 @@ License: ASL 2.0
URL: https://%{provider_prefix}
Source0: %{repo}-%{commit}.tar.gz
Patch1: 0001-Add-explicit-vendor-module-dependencies.patch
ExclusiveArch: aarch64 %{arm} ppc64le s390x x86_64 %{ix86}
BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang >= 1.13}
BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang = 1.17.5}
Provides: bond-cni = %{version}-%{release}
%description
@ -37,7 +38,8 @@ bonding of containers and removing any allocated resources when the container
is deleted.
%prep
%autosetup -n %{repo}-%{commit}
%setup -n %{repo}-%{commit}
%patch1 -p1
%build
export ORG_PATH="%{provider}.%{provider_tld}/%{project}"

View File

@ -2,6 +2,6 @@ VERSION=bff6422d7089d988dc1548e6abe0543601f6e1c7
TAR_NAME=bond-cni
TAR="${TAR_NAME}-${VERSION}.tar.gz"
COPY_LIST="${CGCS_BASE}/downloads/${TAR}"
COPY_LIST="${CGCS_BASE}/downloads/${TAR} ${FILES_BASE}/*"
TIS_PATCH_VER=PKG_GITREVCOUNT

View File

@ -0,0 +1,68 @@
From 76ac4271502d6356f5150f6047d9dc05eb2470bd Mon Sep 17 00:00:00 2001
From: Steven Webster <steven.webster@windriver.com>
Date: Fri, 8 Apr 2022 16:01:58 -0400
Subject: [PATCH] Add explicit vendor module dependencies
Signed-off-by: Steven Webster <steven.webster@windriver.com>
---
go.mod | 6 ++++++
vendor/modules.txt | 11 +++++++----
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/go.mod b/go.mod
index c334299..385a70f 100644
--- a/go.mod
+++ b/go.mod
@@ -8,3 +8,9 @@ require (
github.com/vishvananda/netlink v1.1.1-0.20210330154013-f5de75959ad5
github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74
)
+
+require (
+ github.com/coreos/go-iptables v0.6.0 // indirect
+ github.com/safchain/ethtool v0.0.0-20210803160452-9aa261dae9b1 // indirect
+ golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e // indirect
+)
diff --git a/vendor/modules.txt b/vendor/modules.txt
index ac4b3f5..d684960 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -1,5 +1,5 @@
# github.com/containernetworking/cni v1.0.1
-## explicit
+## explicit; go 1.14
github.com/containernetworking/cni/pkg/invoke
github.com/containernetworking/cni/pkg/skel
github.com/containernetworking/cni/pkg/types
@@ -11,22 +11,25 @@ github.com/containernetworking/cni/pkg/types/internal
github.com/containernetworking/cni/pkg/utils
github.com/containernetworking/cni/pkg/version
# github.com/containernetworking/plugins v1.0.1
-## explicit
+## explicit; go 1.16
github.com/containernetworking/plugins/pkg/ip
github.com/containernetworking/plugins/pkg/ipam
github.com/containernetworking/plugins/pkg/ns
github.com/containernetworking/plugins/pkg/utils/sysctl
# github.com/coreos/go-iptables v0.6.0
+## explicit; go 1.16
github.com/coreos/go-iptables/iptables
# github.com/safchain/ethtool v0.0.0-20210803160452-9aa261dae9b1
+## explicit
github.com/safchain/ethtool
# github.com/vishvananda/netlink v1.1.1-0.20210330154013-f5de75959ad5
-## explicit
+## explicit; go 1.12
github.com/vishvananda/netlink
github.com/vishvananda/netlink/nl
# github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74
-## explicit
+## explicit; go 1.12
github.com/vishvananda/netns
# golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e
+## explicit; go 1.17
golang.org/x/sys/internal/unsafeheader
golang.org/x/sys/unix
--
2.29.2

View File

@ -6,7 +6,7 @@ Standards-Version: 4.6.0
Homepage: https://www.starlingx.io
Build-Depends: debhelper-compat (= 13),
dh-golang,
golang-any,
golang-1.17,
golang-github-appc-cni-dev,
golang-github-containernetworking-plugins-dev,
golang-github-vishvananda-netlink-dev,

View File

@ -0,0 +1,68 @@
From 76ac4271502d6356f5150f6047d9dc05eb2470bd Mon Sep 17 00:00:00 2001
From: Steven Webster <steven.webster@windriver.com>
Date: Fri, 8 Apr 2022 16:01:58 -0400
Subject: [PATCH] Add explicit vendor module dependencies
Signed-off-by: Steven Webster <steven.webster@windriver.com>
---
go.mod | 6 ++++++
vendor/modules.txt | 11 +++++++----
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/go.mod b/go.mod
index c334299..385a70f 100644
--- a/go.mod
+++ b/go.mod
@@ -8,3 +8,9 @@ require (
github.com/vishvananda/netlink v1.1.1-0.20210330154013-f5de75959ad5
github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74
)
+
+require (
+ github.com/coreos/go-iptables v0.6.0 // indirect
+ github.com/safchain/ethtool v0.0.0-20210803160452-9aa261dae9b1 // indirect
+ golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e // indirect
+)
diff --git a/vendor/modules.txt b/vendor/modules.txt
index ac4b3f5..d684960 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -1,5 +1,5 @@
# github.com/containernetworking/cni v1.0.1
-## explicit
+## explicit; go 1.14
github.com/containernetworking/cni/pkg/invoke
github.com/containernetworking/cni/pkg/skel
github.com/containernetworking/cni/pkg/types
@@ -11,22 +11,25 @@ github.com/containernetworking/cni/pkg/types/internal
github.com/containernetworking/cni/pkg/utils
github.com/containernetworking/cni/pkg/version
# github.com/containernetworking/plugins v1.0.1
-## explicit
+## explicit; go 1.16
github.com/containernetworking/plugins/pkg/ip
github.com/containernetworking/plugins/pkg/ipam
github.com/containernetworking/plugins/pkg/ns
github.com/containernetworking/plugins/pkg/utils/sysctl
# github.com/coreos/go-iptables v0.6.0
+## explicit; go 1.16
github.com/coreos/go-iptables/iptables
# github.com/safchain/ethtool v0.0.0-20210803160452-9aa261dae9b1
+## explicit
github.com/safchain/ethtool
# github.com/vishvananda/netlink v1.1.1-0.20210330154013-f5de75959ad5
-## explicit
+## explicit; go 1.12
github.com/vishvananda/netlink
github.com/vishvananda/netlink/nl
# github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74
-## explicit
+## explicit; go 1.12
github.com/vishvananda/netns
# golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e
+## explicit; go 1.17
golang.org/x/sys/internal/unsafeheader
golang.org/x/sys/unix
--
2.29.2

View File

@ -0,0 +1 @@
0001-Add-explicit-vendor-module-dependencies.patch

View File

@ -1,5 +1,6 @@
#!/usr/bin/make -f
export PATH := /usr/lib/go-1.17/bin:$(PATH)
export DH_VERBOSE = 1
export DH_GOLANG_GO_GENERATE := 1