From f1892e34f6a827c21e4bd19fddf5cbabecb36dbc Mon Sep 17 00:00:00 2001 From: Bruce Ashfield Date: Thu, 25 Jan 2024 14:44:26 +0000 Subject: cni: convert recipe to vendor fetched format The latest update to the CNI recipe brings in more vendor dependencies. To fix the build, we convert it to the same format as other vendored recipes in meta-virtualiation. The files in the udpated a recipe were created via: ./scripts/oe-go-mod-autogen.py --repo https://github.com/containernetworking/cni.git --rev b62753aa2bfa365c1ceaff6f25774a8047c896b5 Signed-off-by: Bruce Ashfield --- recipes-networking/cni/cni_git.bb | 19 ++++++++++ recipes-networking/cni/files/modules.txt | 26 +++++++++++++ recipes-networking/cni/relocation.inc | 30 +++++++++++++++ recipes-networking/cni/src_uri.inc | 65 ++++++++++++++++++++++++++++++++ 4 files changed, 140 insertions(+) create mode 100644 recipes-networking/cni/files/modules.txt create mode 100644 recipes-networking/cni/relocation.inc create mode 100644 recipes-networking/cni/src_uri.inc (limited to 'recipes-networking/cni') diff --git a/recipes-networking/cni/cni_git.bb b/recipes-networking/cni/cni_git.bb index 59b56f6e..fda7af60 100644 --- a/recipes-networking/cni/cni_git.bb +++ b/recipes-networking/cni/cni_git.bb @@ -17,7 +17,17 @@ SRC_URI = "\ git://github.com/containernetworking/cni.git;branch=main;name=cni;protocol=https \ git://github.com/containernetworking/plugins.git;branch=main;destsuffix=${S}/src/github.com/containernetworking/plugins;name=plugins;protocol=https \ git://github.com/flannel-io/cni-plugin;branch=main;name=flannel_plugin;protocol=https;destsuffix=${S}/src/github.com/containernetworking/plugins/plugins/meta/flannel \ + file://modules.txt \ " + +# generated via: +# ./scripts/oe-go-mod-autogen.py --repo https://github.com/containernetworking/cni.git --rev +include src_uri.inc + +DEPENDS = " \ + rsync-native \ + " + LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=fa818a259cbed7ce8bc2a22d35a464fc" @@ -31,10 +41,19 @@ inherit goarch # https://github.com/llvm/llvm-project/issues/53999 TOOLCHAIN = "gcc" +# sets the "sites" variable. +include relocation.inc + do_compile() { mkdir -p ${S}/src/github.com/containernetworking ln -sfr ${S}/src/import ${S}/src/github.com/containernetworking/cni + # our copied .go files are to be used for the build + ln -sf vendor.copy vendor + + # inform go that we know what we are doing + cp ${WORKDIR}/modules.txt vendor/ + export GO111MODULE=off cd ${B}/src/github.com/containernetworking/cni/libcni diff --git a/recipes-networking/cni/files/modules.txt b/recipes-networking/cni/files/modules.txt new file mode 100644 index 00000000..38217c96 --- /dev/null +++ b/recipes-networking/cni/files/modules.txt @@ -0,0 +1,26 @@ +# github.com/Masterminds/semver/v3 v3.2.1 +## explicit +# github.com/onsi/ginkgo/v2 v2.13.2 +## explicit +# github.com/onsi/gomega v1.30.0 +## explicit +# github.com/vishvananda/netns v0.0.4 +## explicit +# github.com/go-logr/logr v1.3.0 +## explicit +# github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 +## explicit +# github.com/google/go-cmp v0.6.0 +## explicit +# github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 +## explicit +# golang.org/x/net v0.17.0 +## explicit +# golang.org/x/sys v0.14.0 +## explicit +# golang.org/x/text v0.13.0 +## explicit +# golang.org/x/tools v0.14.0 +## explicit +# gopkg.in/yaml.v3 v3.0.1 +## explicit diff --git a/recipes-networking/cni/relocation.inc b/recipes-networking/cni/relocation.inc new file mode 100644 index 00000000..456e2c8a --- /dev/null +++ b/recipes-networking/cni/relocation.inc @@ -0,0 +1,30 @@ +export sites="golang.org/x/net:golang.org/x/net:force \ + golang.org/x/sys:golang.org/x/sys:force \ + gopkg.in/yaml.v3:gopkg.in/yaml.v3:force \ + golang.org/x/text:golang.org/x/text:force \ + golang.org/x/tools:golang.org/x/tools:force \ + github.com/onsi/gomega:github.com/onsi/gomega:force \ + github.com/go-logr/logr:github.com/go-logr/logr:force \ + github.com/google/pprof:github.com/google/pprof:force \ + github.com/google/go-cmp:github.com/google/go-cmp:force \ + github.com/onsi/ginkgo/v2:github.com/onsi/ginkgo/v2:force \ + github.com/vishvananda/netns:github.com/vishvananda/netns:force \ + github.com/go-task/slim-sprig:github.com/go-task/slim-sprig:force \ + github.com/Masterminds/semver/v3:github.com/Masterminds/semver/v3:force" + +do_compile:prepend() { + cd ${S}/src/import + for s in $sites; do + site_dest=$(echo $s | cut -d: -f1) + site_source=$(echo $s | cut -d: -f2) + force_flag=$(echo $s | cut -d: -f3) + mkdir -p vendor.copy/$site_dest + if [ -n "$force_flag" ]; then + echo "[INFO] $site_dest: force copying .go files" + rm -rf vendor.copy/$site_dest + rsync -a --exclude='vendor/' --exclude='.git/' vendor.fetch/$site_source/ vendor.copy/$site_dest + else + [ -n "$(ls -A vendor.copy/$site_dest/*.go 2> /dev/null)" ] && { echo "[INFO] vendor.fetch/$site_source -> $site_dest: go copy skipped (files present)" ; true ; } || { echo "[INFO] $site_dest: copying .go files" ; rsync -a --exclude='vendor/' --exclude='.git/' vendor.fetch/$site_source/ vendor.copy/$site_dest ; } + fi + done +} diff --git a/recipes-networking/cni/src_uri.inc b/recipes-networking/cni/src_uri.inc new file mode 100644 index 00000000..6cda91ab --- /dev/null +++ b/recipes-networking/cni/src_uri.inc @@ -0,0 +1,65 @@ +# golang.org/x/net v0.17.0 +# [1] git ls-remote https://go.googlesource.com/net b225e7ca6dde1ef5a5ae5ce922861bda011cfabd +SRCREV_net="b225e7ca6dde1ef5a5ae5ce922861bda011cfabd" +SRC_URI += "git://go.googlesource.com/net;name=net;protocol=https;nobranch=1;destsuffix=${WORKDIR}/${BP}/src/import/vendor.fetch/golang.org/x/net" + +# golang.org/x/sys v0.14.0 +# [1] git ls-remote https://go.googlesource.com/sys cb378ae1ff8cd45e69d4f172df8370bc844e1f86 +SRCREV_sys="cb378ae1ff8cd45e69d4f172df8370bc844e1f86" +SRC_URI += "git://go.googlesource.com/sys;name=sys;protocol=https;nobranch=1;destsuffix=${WORKDIR}/${BP}/src/import/vendor.fetch/golang.org/x/sys" + +# gopkg.in/yaml.v3 v3.0.1 +# [1] git ls-remote https://github.com/go-yaml/yaml f6f7691b1fdeb513f56608cd2c32c51f8194bf51 +SRCREV_yaml.v3="f6f7691b1fdeb513f56608cd2c32c51f8194bf51" +SRC_URI += "git://github.com/go-yaml/yaml;name=yaml.v3;protocol=https;nobranch=1;destsuffix=${WORKDIR}/${BP}/src/import/vendor.fetch/gopkg.in/yaml.v3" + +# golang.org/x/text v0.13.0 +# [1] git ls-remote https://go.googlesource.com/text f488e191e67ed95a5b9b7b39024e5a5f5f1ffd02 +SRCREV_text="f488e191e67ed95a5b9b7b39024e5a5f5f1ffd02" +SRC_URI += "git://go.googlesource.com/text;name=text;protocol=https;nobranch=1;destsuffix=${WORKDIR}/${BP}/src/import/vendor.fetch/golang.org/x/text" + +# golang.org/x/tools v0.14.0 +# [1] git ls-remote https://go.googlesource.com/tools 3f4194ee29d7db9b59757dfff729ef55cf89661c +SRCREV_tools="3f4194ee29d7db9b59757dfff729ef55cf89661c" +SRC_URI += "git://go.googlesource.com/tools;name=tools;protocol=https;nobranch=1;destsuffix=${WORKDIR}/${BP}/src/import/vendor.fetch/golang.org/x/tools" + +# github.com/onsi/gomega v1.30.0 +# [1] git ls-remote https://github.com/onsi/gomega f804ac6ada8d36164ecae0513295de8affce1245 +SRCREV_gomega="f804ac6ada8d36164ecae0513295de8affce1245" +SRC_URI += "git://github.com/onsi/gomega;name=gomega;protocol=https;nobranch=1;destsuffix=${WORKDIR}/${BP}/src/import/vendor.fetch/github.com/onsi/gomega" + +# github.com/go-logr/logr v1.3.0 +# [1] git ls-remote https://github.com/go-logr/logr 8adefbede0fe82bdee4fb8c9c9bdc7bc5d91388f +SRCREV_logr="8adefbede0fe82bdee4fb8c9c9bdc7bc5d91388f" +SRC_URI += "git://github.com/go-logr/logr;name=logr;protocol=https;nobranch=1;destsuffix=${WORKDIR}/${BP}/src/import/vendor.fetch/github.com/go-logr/logr" + +# github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 +# [1] git ls-remote https://github.com/google/pprof 94a9f03dee38882adc8bdfc42cdd6a04f8e7056e +SRCREV_pprof="94a9f03dee38882adc8bdfc42cdd6a04f8e7056e" +SRC_URI += "git://github.com/google/pprof;name=pprof;protocol=https;nobranch=1;destsuffix=${WORKDIR}/${BP}/src/import/vendor.fetch/github.com/google/pprof" + +# github.com/google/go-cmp v0.6.0 +# [1] git ls-remote https://github.com/google/go-cmp c3ad8435e7bef96af35732bc0789e5a2278c6d5f +SRCREV_go-cmp="c3ad8435e7bef96af35732bc0789e5a2278c6d5f" +SRC_URI += "git://github.com/google/go-cmp;name=go-cmp;protocol=https;nobranch=1;destsuffix=${WORKDIR}/${BP}/src/import/vendor.fetch/github.com/google/go-cmp" + +# github.com/onsi/ginkgo/v2 v2.13.2 +# [1] git ls-remote https://github.com/onsi/ginkgo 931dc0b144749710bd085d4eb7cd4192a22972d7 +SRCREV_v2="931dc0b144749710bd085d4eb7cd4192a22972d7" +SRC_URI += "git://github.com/onsi/ginkgo;name=v2;protocol=https;nobranch=1;destsuffix=${WORKDIR}/${BP}/src/import/vendor.fetch/github.com/onsi/ginkgo/v2" + +# github.com/vishvananda/netns v0.0.4 +# [1] git ls-remote https://github.com/vishvananda/netns 7a452d2d15292b2bfb2a2d88e6bdeac156a761b9 +SRCREV_netns="7a452d2d15292b2bfb2a2d88e6bdeac156a761b9" +SRC_URI += "git://github.com/vishvananda/netns;name=netns;protocol=https;nobranch=1;destsuffix=${WORKDIR}/${BP}/src/import/vendor.fetch/github.com/vishvananda/netns" + +# github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 +# [1] git ls-remote https://github.com/go-task/slim-sprig 52ccab3ef572c7e1a2c258be183f9a9296d60152 +SRCREV_slim-sprig="52ccab3ef572c7e1a2c258be183f9a9296d60152" +SRC_URI += "git://github.com/go-task/slim-sprig;name=slim-sprig;protocol=https;nobranch=1;destsuffix=${WORKDIR}/${BP}/src/import/vendor.fetch/github.com/go-task/slim-sprig" + +# github.com/Masterminds/semver/v3 v3.2.1 +# [1] git ls-remote https://github.com/Masterminds/semver e06051f8fcc4c8b4a4990c337b9862a2448722e5 +SRCREV_v3="e06051f8fcc4c8b4a4990c337b9862a2448722e5" +SRC_URI += "git://github.com/Masterminds/semver;name=v3;protocol=https;nobranch=1;destsuffix=${WORKDIR}/${BP}/src/import/vendor.fetch/github.com/Masterminds/semver/v3" + -- cgit v1.2.3-54-g00ecf