4bc120
%global with_debug 1
4bc120
%global with_check 0
4bc120
4bc120
%if 0%{?with_debug}
4bc120
%global _find_debuginfo_dwz_opts %{nil}
4bc120
%global _dwz_low_mem_die_limit 0
4bc120
%else
4bc120
%global debug_package   %{nil}
4bc120
%endif
4bc120
4bc120
%define gobuild(o:) \
4bc120
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 %{?**};
4bc120
%define gotest(o:) go test
4bc120
4bc120
%global provider github
4bc120
%global provider_tld com
4bc120
%global project containernetworking
4bc120
%global repo plugins
4bc120
# https://github.com/containernetworking/plugins
4bc120
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
4bc120
%global import_path %{provider_prefix}
4bc120
%global commit 9ebe139e77e82afb122e335328007bca86905ae4
4bc120
%global shortcommit %(c=%{commit}; echo ${c:0:7})
4bc120
4bc120
Name: containernetworking-plugins
4bc120
Version: 0.7.4
f3e0e2
Release: 4.git%{shortcommit}%{?dist}
4bc120
Summary: Some CNI network plugins, maintained by the containernetworking team.
4bc120
License: ASL 2.0
4bc120
URL: https://%{provider_prefix}
4bc120
Source0: https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
4bc120
ExcludeArch: ppc64 i686
4bc120
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
4bc120
BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
4bc120
BuildRequires: git
4bc120
BuildRequires: go-md2man
4bc120
Provides: containernetworking-cni = %{version}-%{release}
4bc120
4bc120
%description
4bc120
The CNI (Container Network Interface) project consists of a specification
4bc120
and libraries for writing plugins to configure network interfaces in Linux
4bc120
containers, along with a number of supported plugins. CNI concerns itself
4bc120
only with network connectivity of containers and removing allocated resources
4bc120
when the container is deleted.
4bc120
4bc120
%prep
4bc120
%autosetup -Sgit -n %{repo}-%{commit}
4bc120
4bc120
%build
4bc120
export ORG_PATH="%{provider}.%{provider_tld}/%{project}"
4bc120
export REPO_PATH="$ORG_PATH/%{repo}"
4bc120
4bc120
if [ ! -h gopath/src/${REPO_PATH} ]; then
4bc120
	mkdir -p gopath/src/${ORG_PATH}
4bc120
	ln -s ../../../.. gopath/src/${REPO_PATH} || exit 255
4bc120
fi
4bc120
4bc120
export GOPATH=$(pwd)/gopath
4bc120
mkdir -p $(pwd)/bin
4bc120
4bc120
echo "Building plugins"
4bc120
export PLUGINS="plugins/meta/* plugins/main/* plugins/ipam/* plugins/sample"
4bc120
for d in $PLUGINS; do
4bc120
	if [ -d "$d" ]; then
4bc120
		plugin="$(basename "$d")"
4bc120
		echo "  $plugin"
4bc120
		%gobuild -o "${PWD}/bin/$plugin" "$@" "$REPO_PATH"/$d
4bc120
	fi
4bc120
done
4bc120
4bc120
%install
4bc120
install -d -p %{buildroot}%{_libexecdir}/cni/
4bc120
install -p -m 0755 bin/* %{buildroot}/%{_libexecdir}/cni
4bc120
4bc120
%check
4bc120
%if 0%{?with_check}
4bc120
# Since we aren't packaging up the vendor directory we need to link
4bc120
# back to it somehow. Hack it up so that we can add the vendor
4bc120
# directory from BUILD dir as a gopath to be searched when executing
4bc120
# tests from the BUILDROOT dir.
4bc120
ln -s ./ ./vendor/src # ./vendor/src -> ./vendor
4bc120
4bc120
export GOPATH=%{buildroot}/%{gopath}:$(pwd)/vendor:%{gopath}
4bc120
4bc120
%gotest %{import_path}/libcni
4bc120
%gotest %{import_path}/pkg/invoke
4bc120
%gotest %{import_path}/pkg/ip
4bc120
%gotest %{import_path}/pkg/ipam
4bc120
%gotest %{import_path}/pkg/ns
4bc120
%gotest %{import_path}/pkg/skel
4bc120
%gotest %{import_path}/pkg/types
4bc120
%gotest %{import_path}/pkg/types/020
4bc120
%gotest %{import_path}/pkg/types/current
4bc120
%gotest %{import_path}/pkg/utils
4bc120
%gotest %{import_path}/pkg/utils/hwaddr
4bc120
%gotest %{import_path}/pkg/version
4bc120
%gotest %{import_path}/pkg/version/legacy_examples
4bc120
%gotest %{import_path}/pkg/version/testhelpers
4bc120
%gotest %{import_path}/plugins/ipam/dhcp
4bc120
%gotest %{import_path}/plugins/ipam/host-local
4bc120
%gotest %{import_path}/plugins/ipam/host-local/backend/allocator
4bc120
%gotest %{import_path}/plugins/main/bridge
4bc120
%gotest %{import_path}/plugins/main/ipvlan
4bc120
%gotest %{import_path}/plugins/main/loopback
4bc120
%gotest %{import_path}/plugins/main/macvlan
4bc120
%gotest %{import_path}/plugins/main/ptp
4bc120
%gotest %{import_path}/plugins/meta/flannel
4bc120
%gotest %{import_path}/plugins/test/noop
4bc120
%endif
4bc120
4bc120
#define license tag if not already defined
4bc120
%{!?_licensedir:%global license %doc}
4bc120
4bc120
%files
4bc120
%license LICENSE
4bc120
%doc *.md
4bc120
%dir %{_libexecdir}/cni
4bc120
%{_libexecdir}/cni/*
4bc120
4bc120
%changelog
7af30b
* Fri Jun 26 2020 Jindrich Novy <jnovy@redhat.com> - 0.7.4-4.git9ebe139
7af30b
- bump release to preserve upgrade path
7af30b
- Related: #1821193
f3e0e2
4bc120
* Tue Dec 18 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.7.4-3.git9ebe139
4bc120
- re-enable debuginfo
4bc120
4bc120
* Mon Dec 17 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.7.4-2.git9ebe139
4bc120
- rebase, removed patch that is already upstream
4bc120
4bc120
* Mon Dec 17 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.7.3-7.git19f2f28
4bc120
- go tools not in scl anymore
4bc120
4bc120
* Mon Aug 27 2018 Lokesh Mandvekar <lsm5@redhat.com> - 0.7.3-6.git19f2f28
4bc120
- correct tag specification format in %%gobuild macro
4bc120
4bc120
* Fri Aug 24 2018 Lokesh Mandvekar <lsm5@redhat.com> - 0.7.3-5.git19f2f28
4bc120
- Resolves: #1616062 - patch to revert coreos/go-iptables bump
4bc120
4bc120
* Wed Aug 08 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.7.3-4.git19f2f28
4bc120
- Resolves:#1603012
4bc120
- fix versioning, upstream got it wrong at 7.2
4bc120
4bc120
* Tue Aug 07 2018 Lokesh Mandvekar <lsm5@redhat.com> - 0.7.2-3.git19f2f28
4bc120
- disable i686 temporarily for appstream builds
4bc120
- update golang deps and gobuild definition
4bc120
4bc120
* Mon Aug 06 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.7.2-2.git19f2f28
4bc120
- rebase
4bc120
4bc120
* Thu Jul 12 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.7.0-103.gitdd8ff8a
4bc120
- enable scl with the toolset
4bc120
4bc120
* Tue Jul 03 2018 Lokesh Mandvekar <lsm5@redhat.com> - 0.7.0-102.gitdd8ff8a
4bc120
- remove devel and unittest subpackages
4bc120
- use new go-toolset deps
4bc120
 
4bc120
* Thu May 10 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.7.0-101
4bc120
- rebase
4bc120
- patches already upstream, removed
4bc120
4bc120
* Thu Apr 26 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.6.0-6
4bc120
- Imported from Fedora
4bc120
- Renamed CNI -> plugins
4bc120
4bc120
* Mon Apr  2 2018 Peter Robinson <pbrobinson@fedoraproject.org> 0.6.0-4
4bc120
- Own the libexec cni directory
4bc120
4bc120
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.6.0-3
4bc120
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
4bc120
4bc120
* Tue Jan 23 2018 Dan Williams <dcbw@redhat.com> - 0.6.0-2
4bc120
- skip settling IPv4 addresses
4bc120
4bc120
* Mon Jan 08 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.6.0-1
4bc120
- rebased to 7480240de9749f9a0a5c8614b17f1f03e0c06ab9
4bc120
4bc120
* Fri Oct 13 2017 Lokesh Mandvekar <lsm5@fedoraproject.org> - 0.5.2-7
4bc120
- do not install to /opt (against Fedora Guidelines)
4bc120
4bc120
* Thu Aug 24 2017 Jan Chaloupka <jchaloup@redhat.com> - 0.5.2-6
4bc120
- Enable devel subpackage
4bc120
4bc120
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.2-5
4bc120
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
4bc120
4bc120
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.2-4
4bc120
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
4bc120
4bc120
* Thu Jul 13 2017 Lokesh Mandvekar <lsm5@fedoraproject.org> - 0.5.2-3
4bc120
- excludearch: ppc64 as it's not in goarches anymore
4bc120
- re-enable s390x
4bc120
4bc120
* Fri Jun 30 2017 Lokesh Mandvekar <lsm5@fedoraproject.org> - 0.5.2-2
4bc120
- upstream moved to github.com/containernetworking/plugins
4bc120
- built commit dcf7368
4bc120
- provides: containernetworking-plugins
4bc120
- use vendored deps because they're a lot less of a PITA
4bc120
- excludearch: s390x for now (rhbz#1466865)
4bc120
4bc120
* Mon Jun 12 2017 Timothy St. Clair <tstclair@heptio.com> - 0.5.2-1
4bc120
- Update to 0.5.2 
4bc120
- Softlink to default /opt/cni/bin directories
4bc120
4bc120
* Sun May 07 2017 Timothy St. Clair <tstclair@heptio.com> - 0.5.1-1
4bc120
- Initial package
4bc120