93d6f7
%global with_debug 1
95181b
%global with_check 0
95181b
95181b
%if 0%{?with_debug}
95181b
%global _dwz_low_mem_die_limit 0
95181b
%else
95181b
%global debug_package   %{nil}
95181b
%endif
95181b
95181b
%if ! 0%{?gobuild:1}
93d6f7
%define gobuild(o:) go build -buildmode pie -compiler gc -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '-Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld '" -a -v -x %{?**};
95181b
%endif
95181b
95181b
%global provider        github
95181b
%global provider_tld    com
95181b
%global project         containernetworking
95181b
%global repo            plugins
95181b
# https://github.com/containernetworking/plugins
95181b
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
95181b
%global import_path     %{provider_prefix}
e8edef
%global commit          fe60fcddb897079746ec1523fd1837ab05b1e689
95181b
%global shortcommit     %(c=%{commit}; echo ${c:0:7})
95181b
e8edef
Name: containernetworking-plugins
e8edef
Version: 0.8.1
e8edef
Release: 1%{?dist}
e8edef
Summary: CNI network plugins
e8edef
License: ASL 2.0
e8edef
URL: https://%{provider_prefix}
e8edef
Source0: https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
e8edef
ExclusiveArch: aarch64 %{arm} ppc64le s390x x86_64
93d6f7
93d6f7
%if 0%{?fedora} || 0%{?centos}
93d6f7
BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
93d6f7
%else
93d6f7
BuildRequires: go-toolset-1.10
93d6f7
BuildRequires: openssl-devel
93d6f7
%endif #fedora
95181b
93d6f7
Provides: containernetworking-cni = %{version}-%{release}
95181b
95181b
%description
95181b
The CNI (Container Network Interface) project consists of a specification
95181b
and libraries for writing plugins to configure network interfaces in Linux
95181b
containers, along with a number of supported plugins. CNI concerns itself
95181b
only with network connectivity of containers and removing allocated resources
95181b
when the container is deleted.
95181b
93d6f7
%{?enable_gotoolset110}
95181b
95181b
%prep
93d6f7
%autosetup -Sgit -n %{repo}-%{commit}
e8edef
rm -rf plugins/main/windows
95181b
95181b
%build
93d6f7
export ORG_PATH="%{provider}.%{provider_tld}/%{project}"
93d6f7
export REPO_PATH="$ORG_PATH/%{repo}"
93d6f7
93d6f7
if [ ! -h gopath/src/${REPO_PATH} ]; then
93d6f7
   mkdir -p gopath/src/${ORG_PATH}
93d6f7
   ln -s ../../../.. gopath/src/${REPO_PATH} || exit 255
93d6f7
fi
93d6f7
93d6f7
export GOPATH=$(pwd)/gopath
93d6f7
mkdir -p $(pwd)/bin
93d6f7
93d6f7
echo "Building plugins"
93d6f7
export PLUGINS="plugins/meta/* plugins/main/* plugins/ipam/* plugins/sample"
93d6f7
for d in $PLUGINS; do
e8edef
        if [ -d "$d" ]; then
e8edef
                plugin="$(basename "$d")"
e8edef
                echo "  $plugin"
e8edef
                %gobuild -o "${PWD}/bin/$plugin" "$@" "$REPO_PATH"/$d
e8edef
        fi
93d6f7
done
95181b
95181b
%install
95181b
install -d -p %{buildroot}%{_libexecdir}/cni/
95181b
install -p -m 0755 bin/* %{buildroot}/%{_libexecdir}/cni
95181b
95181b
%check
93d6f7
%if 0%{?with_check}
95181b
95181b
%if ! 0%{?gotest:1}
95181b
%global gotest go test
95181b
%endif
95181b
95181b
%gotest %{import_path}/libcni
95181b
%gotest %{import_path}/pkg/invoke
95181b
%gotest %{import_path}/pkg/ip
95181b
%gotest %{import_path}/pkg/ipam
95181b
%gotest %{import_path}/pkg/ns
95181b
%gotest %{import_path}/pkg/skel
95181b
%gotest %{import_path}/pkg/types
95181b
%gotest %{import_path}/pkg/types/020
95181b
%gotest %{import_path}/pkg/types/current
95181b
%gotest %{import_path}/pkg/utils
95181b
%gotest %{import_path}/pkg/utils/hwaddr
95181b
%gotest %{import_path}/pkg/version
95181b
%gotest %{import_path}/pkg/version/legacy_examples
95181b
%gotest %{import_path}/pkg/version/testhelpers
95181b
%gotest %{import_path}/plugins/ipam/dhcp
95181b
%gotest %{import_path}/plugins/ipam/host-local
95181b
%gotest %{import_path}/plugins/ipam/host-local/backend/allocator
95181b
%gotest %{import_path}/plugins/main/bridge
95181b
%gotest %{import_path}/plugins/main/ipvlan
95181b
%gotest %{import_path}/plugins/main/loopback
95181b
%gotest %{import_path}/plugins/main/macvlan
95181b
%gotest %{import_path}/plugins/main/ptp
95181b
%gotest %{import_path}/plugins/meta/flannel
95181b
%gotest %{import_path}/plugins/test/noop
95181b
%endif
95181b
95181b
#define license tag if not already defined
95181b
%{!?_licensedir:%global license %doc}
95181b
95181b
%files
95181b
%license LICENSE
95181b
%doc *.md
95181b
%dir %{_libexecdir}/cni
95181b
%{_libexecdir}/cni/*
95181b
93d6f7
%changelog
e8edef
* Fri Jun 07 2019 Lokesh Mandvekar <lsm5@redhat.com> - 0.8.1-1
e8edef
- Resolves: #1717915 - bump to v0.8.1
e8edef
e8edef
* Tue May 14 2019 Lokesh Mandvekar <lsm5@redhat.com> - 0.8.0-1
e8edef
- Resolves: #1709630 - rebase to v0.8.0
e8edef
577ae7
* Wed Mar 27 2019 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.7.5-2
577ae7
- rebase
577ae7
93d6f7
* Mon Jan 07 2019 Lokesh Mandvekar <lsm5@redhat.com> - 0.7.4-1
93d6f7
- Resolves: #1664009 - bump to v0.7.4
93d6f7
- remove unused devel and unit-test* packages
93d6f7
- update go build env
95181b
93d6f7
* Wed Nov 21 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.7.3-3
93d6f7
- buildrequires for centos
93d6f7
93d6f7
* Wed Oct 03 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.7.3-2
93d6f7
- rebase
93d6f7
93d6f7
* Wed Oct 03 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.7.1-2
93d6f7
- scl go toolset
95181b
ba6a76
* Mon Jul 23 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.7.1-1
ba6a76
- rebase
ba6a76
95181b
* Thu May 10 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.7.0-101
95181b
- rebase
95181b
- patches already upstream, removed
95181b
95181b
* Thu Apr 26 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.6.0-6
95181b
- Imported from Fedora
95181b
- Renamed CNI -> plugins
95181b
95181b
* Mon Apr  2 2018 Peter Robinson <pbrobinson@fedoraproject.org> 0.6.0-4
95181b
- Own the libexec cni directory
95181b
95181b
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.6.0-3
95181b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
95181b
95181b
* Tue Jan 23 2018 Dan Williams <dcbw@redhat.com> - 0.6.0-2
95181b
- skip settling IPv4 addresses
95181b
95181b
* Mon Jan 08 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.6.0-1
95181b
- rebased to 7480240de9749f9a0a5c8614b17f1f03e0c06ab9
95181b
95181b
* Fri Oct 13 2017 Lokesh Mandvekar <lsm5@fedoraproject.org> - 0.5.2-7
95181b
- do not install to /opt (against Fedora Guidelines)
95181b
95181b
* Thu Aug 24 2017 Jan Chaloupka <jchaloup@redhat.com> - 0.5.2-6
95181b
- Enable devel subpackage
95181b
95181b
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.2-5
95181b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
95181b
95181b
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.2-4
95181b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
95181b
95181b
* Thu Jul 13 2017 Lokesh Mandvekar <lsm5@fedoraproject.org> - 0.5.2-3
95181b
- excludearch: ppc64 as it's not in goarches anymore
95181b
- re-enable s390x
95181b
95181b
* Fri Jun 30 2017 Lokesh Mandvekar <lsm5@fedoraproject.org> - 0.5.2-2
95181b
- upstream moved to github.com/containernetworking/plugins
95181b
- built commit dcf7368
95181b
- provides: containernetworking-plugins
95181b
- use vendored deps because they're a lot less of a PITA
95181b
- excludearch: s390x for now (rhbz#1466865)
95181b
95181b
* Mon Jun 12 2017 Timothy St. Clair <tstclair@heptio.com> - 0.5.2-1
95181b
- Update to 0.5.2 
95181b
- Softlink to default /opt/cni/bin directories
95181b
95181b
* Sun May 07 2017 Timothy St. Clair <tstclair@heptio.com> - 0.5.1-1
95181b
- Initial package
95181b