%global with_debug 1 %global with_check 0 %if 0%{?with_debug} %global _find_debuginfo_dwz_opts %{nil} %global _dwz_low_mem_die_limit 0 %else %global debug_package %{nil} %endif %if 0%{?rhel} && ! 0%{?fedora} %define gobuild(o:) scl enable go-toolset-1.12 -- go build -buildmode pie -compiler gc -tags="rpm_crashtraceback no_openssl ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-} -compressdwarf=false -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags'" -a -v -x %{?**}; %define gotest(o:) scl enable go-toolset-1.12 -- go test %else %define gobuild(o:) go build -buildmode pie -compiler gc -tags="rpm_crashtraceback no_openssl ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-} -compressdwarf=false -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags'" -a -v -x %{?**}; %define gotest(o:) go test %endif %global provider github %global provider_tld com %global project containernetworking %global repo plugins # https://github.com/containernetworking/plugins %global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo} %global import_path %{provider_prefix} Name: containernetworking-plugins Version: 0.8.6 Release: 1.rhaos4.4%{?dist} Summary: CNI network plugins License: ASL 2.0 URL: https://%{provider_prefix} Source0: https://%{provider_prefix}/archive/v%{version}.tar.gz ExcludeArch: ppc64 i686 BuildRequires: go-toolset-1.12 BuildRequires: git BuildRequires: go-md2man Provides: containernetworking-cni = %{version}-%{release} %description The CNI (Container Network Interface) project consists of a specification and libraries for writing plugins to configure network interfaces in Linux containers, along with a number of supported plugins. CNI concerns itself only with network connectivity of containers and removing allocated resources when the container is deleted. %prep %autosetup -Sgit -n %{repo}-%{version} rm -rf plugins/main/windows %build export ORG_PATH="%{provider}.%{provider_tld}/%{project}" export REPO_PATH="$ORG_PATH/%{repo}" if [ ! -h gopath/src/${REPO_PATH} ]; then mkdir -p gopath/src/${ORG_PATH} ln -s ../../../.. gopath/src/${REPO_PATH} || exit 255 fi export GOPATH=$(pwd)/gopath export GO111MODULE=off mkdir -p $(pwd)/bin echo "Building plugins" export PLUGINS="plugins/meta/* plugins/main/* plugins/ipam/* plugins/sample" for d in $PLUGINS; do if [ -d "$d" ]; then plugin="$(basename "$d")" echo " $plugin" %gobuild -o "${PWD}/bin/$plugin" "$@" "$REPO_PATH"/$d fi done %install install -d -p %{buildroot}%{_libexecdir}/cni/ install -p -m 0755 bin/* %{buildroot}/%{_libexecdir}/cni %check %if 0%{?with_check} # Since we aren't packaging up the vendor directory we need to link # back to it somehow. Hack it up so that we can add the vendor # directory from BUILD dir as a gopath to be searched when executing # tests from the BUILDROOT dir. ln -s ./ ./vendor/src # ./vendor/src -> ./vendor export GOPATH=%{buildroot}/%{gopath}:$(pwd)/vendor:%{gopath} %gotest %{import_path}/libcni %gotest %{import_path}/pkg/invoke %gotest %{import_path}/pkg/ip %gotest %{import_path}/pkg/ipam %gotest %{import_path}/pkg/ns %gotest %{import_path}/pkg/skel %gotest %{import_path}/pkg/types %gotest %{import_path}/pkg/types/020 %gotest %{import_path}/pkg/types/current %gotest %{import_path}/pkg/utils %gotest %{import_path}/pkg/utils/hwaddr %gotest %{import_path}/pkg/version %gotest %{import_path}/pkg/version/legacy_examples %gotest %{import_path}/pkg/version/testhelpers %gotest %{import_path}/plugins/ipam/dhcp %gotest %{import_path}/plugins/ipam/host-local %gotest %{import_path}/plugins/ipam/host-local/backend/allocator %gotest %{import_path}/plugins/main/bridge %gotest %{import_path}/plugins/main/ipvlan %gotest %{import_path}/plugins/main/loopback %gotest %{import_path}/plugins/main/macvlan %gotest %{import_path}/plugins/main/ptp %gotest %{import_path}/plugins/meta/flannel %gotest %{import_path}/plugins/test/noop %endif #define license tag if not already defined %{!?_licensedir:%global license %doc} %files %license LICENSE %doc *.md %dir %{_libexecdir}/cni %{_libexecdir}/cni/* %changelog * Thu May 14 2020 Jindrich Novy - 0.8.6-1.rhaos4.4 - initial build for rhaos4.4 - update to https://github.com/containernetworking/plugins/releases/tag/v0.8.6 - Related: #1840465