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:) \
9a23a6
go build -buildmode pie -compiler gc -tags="rpm_crashtraceback ${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}
9a23a6
%global commit fe60fcddb897079746ec1523fd1837ab05b1e689
63400d
%global shortcommit %(c=%{commit}; echo ${c:0:7})
63400d
63400d
Name: containernetworking-plugins
9a23a6
Version: 0.8.1
9a23a6
Release: 2%{?dist}
9a23a6
Summary: CNI network plugins
63400d
License: ASL 2.0
63400d
URL: https://%{provider_prefix}
63400d
Source0: https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
9a23a6
# https://github.com/coreos/go-iptables/pull/62/commits/a5f18ede385f8f348d876635c8483640d6446d65
9a23a6
# resolves https://bugzilla.redhat.com/show_bug.cgi?id=1627561
9a23a6
Patch0: remove-existsErr-workaround.patch
63400d
ExcludeArch: ppc64 i686
63400d
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
63400d
BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
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
9a23a6
%autosetup -n %{repo}-%{commit} -p1
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
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
9a23a6
* Thu Aug 01 2019 Jindrich Novy <jnovy@redhat.com> - 0.8.1-2
9a23a6
- backport https://github.com/coreos/go-iptables/pull/62
9a23a6
  from Michael Cambria
9a23a6
- Resolves: #1627561
9a23a6
9a23a6
* Thu Jun 13 2019 Lokesh Mandvekar <lsm5@redhat.com> - 0.8.1-1
9a23a6
- Resolves: #1720319 - bump to v0.8.1
9a23a6
9a23a6
* Sat Jun 01 2019 Lokesh Mandvekar <lsm5@redhat.com> - 0.7.5-1
9a23a6
- Resolves: #1616063
9a23a6
- bump to v0.7.5
9a23a6
63400d
* Tue Dec 18 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.7.4-3.git9ebe139
63400d
- re-enable debuginfo
63400d
63400d
* Mon Dec 17 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.7.4-2.git9ebe139
63400d
- rebase, removed patch that is already upstream
63400d
63400d
* Mon Dec 17 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.7.3-7.git19f2f28
63400d
- go tools not in scl anymore
63400d
63400d
* Mon Aug 27 2018 Lokesh Mandvekar <lsm5@redhat.com> - 0.7.3-6.git19f2f28
63400d
- correct tag specification format in %%gobuild macro
63400d
63400d
* Fri Aug 24 2018 Lokesh Mandvekar <lsm5@redhat.com> - 0.7.3-5.git19f2f28
63400d
- Resolves: #1616062 - patch to revert coreos/go-iptables bump
63400d
63400d
* Wed Aug 08 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.7.3-4.git19f2f28
63400d
- Resolves:#1603012
63400d
- fix versioning, upstream got it wrong at 7.2
63400d
63400d
* Tue Aug 07 2018 Lokesh Mandvekar <lsm5@redhat.com> - 0.7.2-3.git19f2f28
63400d
- disable i686 temporarily for appstream builds
63400d
- update golang deps and gobuild definition
63400d
63400d
* Mon Aug 06 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.7.2-2.git19f2f28
63400d
- rebase
63400d
63400d
* Thu Jul 12 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.7.0-103.gitdd8ff8a
63400d
- enable scl with the toolset
63400d
63400d
* Tue Jul 03 2018 Lokesh Mandvekar <lsm5@redhat.com> - 0.7.0-102.gitdd8ff8a
63400d
- remove devel and unittest subpackages
63400d
- use new go-toolset deps
63400d
 
63400d
* Thu May 10 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.7.0-101
63400d
- rebase
63400d
- patches already upstream, removed
63400d
63400d
* Thu Apr 26 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.6.0-6
63400d
- Imported from Fedora
63400d
- Renamed CNI -> plugins
63400d
63400d
* Mon Apr  2 2018 Peter Robinson <pbrobinson@fedoraproject.org> 0.6.0-4
63400d
- Own the libexec cni directory
63400d
63400d
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.6.0-3
63400d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
63400d
63400d
* Tue Jan 23 2018 Dan Williams <dcbw@redhat.com> - 0.6.0-2
63400d
- skip settling IPv4 addresses
63400d
63400d
* Mon Jan 08 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.6.0-1
63400d
- rebased to 7480240de9749f9a0a5c8614b17f1f03e0c06ab9
63400d
63400d
* Fri Oct 13 2017 Lokesh Mandvekar <lsm5@fedoraproject.org> - 0.5.2-7
63400d
- do not install to /opt (against Fedora Guidelines)
63400d
63400d
* Thu Aug 24 2017 Jan Chaloupka <jchaloup@redhat.com> - 0.5.2-6
63400d
- Enable devel subpackage
63400d
63400d
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.2-5
63400d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
63400d
63400d
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.2-4
63400d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
63400d
63400d
* Thu Jul 13 2017 Lokesh Mandvekar <lsm5@fedoraproject.org> - 0.5.2-3
63400d
- excludearch: ppc64 as it's not in goarches anymore
63400d
- re-enable s390x
63400d
63400d
* Fri Jun 30 2017 Lokesh Mandvekar <lsm5@fedoraproject.org> - 0.5.2-2
63400d
- upstream moved to github.com/containernetworking/plugins
63400d
- built commit dcf7368
63400d
- provides: containernetworking-plugins
63400d
- use vendored deps because they're a lot less of a PITA
63400d
- excludearch: s390x for now (rhbz#1466865)
63400d
63400d
* Mon Jun 12 2017 Timothy St. Clair <tstclair@heptio.com> - 0.5.2-1
63400d
- Update to 0.5.2 
63400d
- Softlink to default /opt/cni/bin directories
63400d
63400d
* Sun May 07 2017 Timothy St. Clair <tstclair@heptio.com> - 0.5.1-1
63400d
- Initial package
63400d