0e246a
%global with_debug 1
eae678
%global with_check 0
eae678
eae678
%if 0%{?with_debug}
ad85a8
%global _find_debuginfo_dwz_opts %{nil}
eae678
%global _dwz_low_mem_die_limit 0
eae678
%else
eae678
%global debug_package   %{nil}
eae678
%endif
eae678
eae678
%if ! 0%{?gobuild:1}
ad85a8
%define gobuild(o:) \
ad85a8
scl enable go-toolset-1.12 -- go build -buildmode pie -compiler gc -tags="rpm_crashtraceback no_openssl ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags'" -a -v -x %{?**};
eae678
%endif
eae678
ad85a8
%global provider github
ad85a8
%global provider_tld com
ad85a8
%global project containernetworking
ad85a8
%global repo plugins
eae678
# https://github.com/containernetworking/plugins
eae678
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
ad85a8
%global import_path %{provider_prefix}
ad85a8
%global commit d5efdfe1f6d6e8e9e9494e3f43be54f76c0f8fd6
ad85a8
%global shortcommit %(c=%{commit}; echo ${c:0:7})
eae678
3c9b48
Name: containernetworking-plugins
ad85a8
Version: 0.8.3
b5ae5b
Release: 3%{?dist}
3c9b48
Summary: CNI network plugins
3c9b48
License: ASL 2.0
3c9b48
URL: https://%{provider_prefix}
3c9b48
Source0: https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
b5ae5b
# related bug: https://bugzilla.redhat.com/show_bug.cgi?id=1833220
b5ae5b
# patch:       https://github.com/containernetworking/plugins/pull/484.patch
b5ae5b
Patch0: containernetworking-plugins-1833220.patch
f94c8e
ExcludeArch: s390 ppc ppc64
ad85a8
BuildRequires: go-toolset-1.12
ad85a8
BuildRequires: git
ad85a8
BuildRequires: go-md2man
0e246a
Provides: containernetworking-cni = %{version}-%{release}
eae678
eae678
%description
eae678
The CNI (Container Network Interface) project consists of a specification
eae678
and libraries for writing plugins to configure network interfaces in Linux
eae678
containers, along with a number of supported plugins. CNI concerns itself
eae678
only with network connectivity of containers and removing allocated resources
eae678
when the container is deleted.
eae678
eae678
%prep
ad85a8
%autosetup -n %{repo}-%{commit} -p1
3c9b48
rm -rf plugins/main/windows
eae678
eae678
%build
0e246a
export ORG_PATH="%{provider}.%{provider_tld}/%{project}"
0e246a
export REPO_PATH="$ORG_PATH/%{repo}"
0e246a
0e246a
if [ ! -h gopath/src/${REPO_PATH} ]; then
ad85a8
	mkdir -p gopath/src/${ORG_PATH}
ad85a8
	ln -s ../../../.. gopath/src/${REPO_PATH} || exit 255
0e246a
fi
0e246a
0e246a
export GOPATH=$(pwd)/gopath
ad85a8
export GO111MODULE=off
0e246a
mkdir -p $(pwd)/bin
0e246a
0e246a
echo "Building plugins"
0e246a
export PLUGINS="plugins/meta/* plugins/main/* plugins/ipam/* plugins/sample"
0e246a
for d in $PLUGINS; do
ad85a8
	if [ -d "$d" ]; then
ad85a8
		plugin="$(basename "$d")"
ad85a8
		echo "  $plugin"
ad85a8
		%gobuild -o "${PWD}/bin/$plugin" "$@" "$REPO_PATH"/$d
ad85a8
	fi
0e246a
done
eae678
eae678
%install
eae678
install -d -p %{buildroot}%{_libexecdir}/cni/
eae678
install -p -m 0755 bin/* %{buildroot}/%{_libexecdir}/cni
eae678
eae678
%check
0e246a
%if 0%{?with_check}
ad85a8
# Since we aren't packaging up the vendor directory we need to link
ad85a8
# back to it somehow. Hack it up so that we can add the vendor
ad85a8
# directory from BUILD dir as a gopath to be searched when executing
ad85a8
# tests from the BUILDROOT dir.
ad85a8
ln -s ./ ./vendor/src # ./vendor/src -> ./vendor
eae678
ad85a8
export GOPATH=%{buildroot}/%{gopath}:$(pwd)/vendor:%{gopath}
eae678
eae678
%gotest %{import_path}/libcni
eae678
%gotest %{import_path}/pkg/invoke
eae678
%gotest %{import_path}/pkg/ip
eae678
%gotest %{import_path}/pkg/ipam
eae678
%gotest %{import_path}/pkg/ns
eae678
%gotest %{import_path}/pkg/skel
eae678
%gotest %{import_path}/pkg/types
eae678
%gotest %{import_path}/pkg/types/020
eae678
%gotest %{import_path}/pkg/types/current
eae678
%gotest %{import_path}/pkg/utils
eae678
%gotest %{import_path}/pkg/utils/hwaddr
eae678
%gotest %{import_path}/pkg/version
eae678
%gotest %{import_path}/pkg/version/legacy_examples
eae678
%gotest %{import_path}/pkg/version/testhelpers
eae678
%gotest %{import_path}/plugins/ipam/dhcp
eae678
%gotest %{import_path}/plugins/ipam/host-local
eae678
%gotest %{import_path}/plugins/ipam/host-local/backend/allocator
eae678
%gotest %{import_path}/plugins/main/bridge
eae678
%gotest %{import_path}/plugins/main/ipvlan
eae678
%gotest %{import_path}/plugins/main/loopback
eae678
%gotest %{import_path}/plugins/main/macvlan
eae678
%gotest %{import_path}/plugins/main/ptp
eae678
%gotest %{import_path}/plugins/meta/flannel
eae678
%gotest %{import_path}/plugins/test/noop
eae678
%endif
eae678
eae678
#define license tag if not already defined
eae678
%{!?_licensedir:%global license %doc}
eae678
eae678
%files
eae678
%license LICENSE
eae678
%doc *.md
eae678
%dir %{_libexecdir}/cni
eae678
%{_libexecdir}/cni/*
eae678
0e246a
%changelog
b5ae5b
* Mon Jun 01 2020 Jindrich Novy <jnovy@redhat.com> - 0.8.3-3
b5ae5b
- fix "CVE-2020-10749 containernetworking/plugins: IPv6 router advertisements allow for MitM attacks on IPv4 clusters"
b5ae5b
- Resolves: #1842334
b5ae5b
ad85a8
* Thu Dec 12 2019 Jindrich Novy <jnovy@redhat.com> - 0.8.3-2
ad85a8
- build with no_openssl
ad85a8
ad85a8
* Wed Dec 11 2019 Jindrich Novy <jnovy@redhat.com> - 0.8.3-1
ad85a8
- update to 0.8.3
ad85a8
- compile in FIPS mode
ad85a8
ad85a8
* Thu Oct 17 2019 Jindrich Novy <jnovy@redhat.com> - 0.8.1-4
ad85a8
- rebuild against go-toolset-1.11
ad85a8
ad85a8
* Thu Oct 17 2019 Jindrich Novy <jnovy@redhat.com> - 0.8.1-3
ad85a8
- rebuild against extras-rhel-7.8-go-toolset-candidate
ad85a8
aa250a
* Fri Aug 02 2019 Jindrich Novy <jnovy@redhat.com> - 0.8.1-2
aa250a
- use 0.8.1 release for RHEL 7.7
aa250a
3c9b48
* Fri Jun 07 2019 Lokesh Mandvekar <lsm5@redhat.com> - 0.8.1-1
3c9b48
- Resolves: #1717915 - bump to v0.8.1
3c9b48
3c9b48
* Tue May 14 2019 Lokesh Mandvekar <lsm5@redhat.com> - 0.8.0-1
3c9b48
- Resolves: #1709630 - rebase to v0.8.0
ce06af
f854e9
* Wed Mar 27 2019 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.7.5-2
f854e9
- rebase
f854e9
0e246a
* Mon Jan 07 2019 Lokesh Mandvekar <lsm5@redhat.com> - 0.7.4-1
0e246a
- Resolves: #1664009 - bump to v0.7.4
0e246a
- remove unused devel and unit-test* packages
0e246a
- update go build env
eae678
0e246a
* Wed Nov 21 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.7.3-3
0e246a
- buildrequires for centos
0e246a
0e246a
* Wed Oct 03 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.7.3-2
0e246a
- rebase
0e246a
0e246a
* Wed Oct 03 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.7.1-2
0e246a
- scl go toolset
eae678
36e11c
* Mon Jul 23 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.7.1-1
36e11c
- rebase
36e11c
eae678
* Thu May 10 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.7.0-101
eae678
- rebase
eae678
- patches already upstream, removed
eae678
eae678
* Thu Apr 26 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.6.0-6
eae678
- Imported from Fedora
eae678
- Renamed CNI -> plugins
eae678
eae678
* Mon Apr  2 2018 Peter Robinson <pbrobinson@fedoraproject.org> 0.6.0-4
eae678
- Own the libexec cni directory
eae678
eae678
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.6.0-3
eae678
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
eae678
eae678
* Tue Jan 23 2018 Dan Williams <dcbw@redhat.com> - 0.6.0-2
eae678
- skip settling IPv4 addresses
eae678
eae678
* Mon Jan 08 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.6.0-1
eae678
- rebased to 7480240de9749f9a0a5c8614b17f1f03e0c06ab9
eae678
eae678
* Fri Oct 13 2017 Lokesh Mandvekar <lsm5@fedoraproject.org> - 0.5.2-7
eae678
- do not install to /opt (against Fedora Guidelines)
eae678
eae678
* Thu Aug 24 2017 Jan Chaloupka <jchaloup@redhat.com> - 0.5.2-6
eae678
- Enable devel subpackage
eae678
eae678
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.2-5
eae678
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
eae678
eae678
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.2-4
eae678
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
eae678
eae678
* Thu Jul 13 2017 Lokesh Mandvekar <lsm5@fedoraproject.org> - 0.5.2-3
eae678
- excludearch: ppc64 as it's not in goarches anymore
eae678
- re-enable s390x
eae678
eae678
* Fri Jun 30 2017 Lokesh Mandvekar <lsm5@fedoraproject.org> - 0.5.2-2
eae678
- upstream moved to github.com/containernetworking/plugins
eae678
- built commit dcf7368
eae678
- provides: containernetworking-plugins
eae678
- use vendored deps because they're a lot less of a PITA
eae678
- excludearch: s390x for now (rhbz#1466865)
eae678
eae678
* Mon Jun 12 2017 Timothy St. Clair <tstclair@heptio.com> - 0.5.2-1
eae678
- Update to 0.5.2 
eae678
- Softlink to default /opt/cni/bin directories
eae678
eae678
* Sun May 07 2017 Timothy St. Clair <tstclair@heptio.com> - 0.5.1-1
eae678
- Initial package
eae678