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