7e1e50
%global with_check 0
7e1e50
7e1e50
%global _find_debuginfo_dwz_opts %{nil}
7e1e50
%global _dwz_low_mem_die_limit 0
7e1e50
7e1e50
%if ! 0%{?gobuild:1}
7e1e50
%define gobuild(o:) \
7e1e50
go build -buildmode pie -compiler gc -tags="rpm_crashtraceback no_openssl ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-} -linkmode=external -compressdwarf=false -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags'" -a -v %{?**};
7e1e50
%define gotest(o:) go test
7e1e50
%endif
7e1e50
7e1e50
%global provider github
7e1e50
%global provider_tld com
7e1e50
%global project containernetworking
7e1e50
%global repo plugins
7e1e50
# https://github.com/containernetworking/plugins
7e1e50
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
7e1e50
%global import_path %{provider_prefix}
7e1e50
486003
Epoch: 1
7e1e50
Name: containernetworking-plugins
486003
Version: 1.1.1
486003
Release: 2%{?dist}
7e1e50
Summary: CNI network plugins
7e1e50
License: ASL 2.0
7e1e50
URL: https://%{provider_prefix}
7e1e50
Source0: https://%{provider_prefix}/archive/v%{version}.tar.gz
7e1e50
# https://fedoraproject.org/wiki/PackagingDrafts/Go#Go_Language_Architectures
486003
ExclusiveArch: %{go_arches}
486003
BuildRequires: golang >= 1.17.7
7e1e50
BuildRequires: git
7e1e50
BuildRequires: go-md2man
486003
BuildRequires: systemd-devel
486003
Requires: systemd
7e1e50
Provides: containernetworking-cni = %{version}-%{release}
7e1e50
7e1e50
%description
7e1e50
The CNI (Container Network Interface) project consists of a specification
7e1e50
and libraries for writing plugins to configure network interfaces in Linux
7e1e50
containers, along with a number of supported plugins. CNI concerns itself
7e1e50
only with network connectivity of containers and removing allocated resources
7e1e50
when the container is deleted.
7e1e50
7e1e50
%prep
7e1e50
%autosetup -Sgit -n %{repo}-%{version}
7e1e50
rm -rf plugins/main/windows
7e1e50
7e1e50
%build
7e1e50
export ORG_PATH="%{provider}.%{provider_tld}/%{project}"
7e1e50
export REPO_PATH="$ORG_PATH/%{repo}"
7e1e50
7e1e50
if [ ! -h gopath/src/${REPO_PATH} ]; then
7e1e50
	mkdir -p gopath/src/${ORG_PATH}
7e1e50
	ln -s ../../../.. gopath/src/${REPO_PATH} || exit 255
7e1e50
fi
7e1e50
7e1e50
export GOPATH=$(pwd)/gopath
7e1e50
export GO111MODULE=off
7e1e50
export CGO_CFLAGS="%{optflags} -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64"
7e1e50
mkdir -p $(pwd)/bin
7e1e50
7e1e50
echo "Building plugins"
7e1e50
export PLUGINS="plugins/meta/* plugins/main/* plugins/ipam/* plugins/sample"
7e1e50
for d in $PLUGINS; do
7e1e50
	if [ -d "$d" ]; then
7e1e50
		plugin="$(basename "$d")"
7e1e50
		echo "  $plugin"
7e1e50
		%gobuild -o "${PWD}/bin/$plugin" "$@" "$REPO_PATH"/$d
7e1e50
	fi
7e1e50
done
7e1e50
7e1e50
%install
7e1e50
install -d -p %{buildroot}%{_libexecdir}/cni/
7e1e50
install -p -m 0755 bin/* %{buildroot}/%{_libexecdir}/cni
7e1e50
486003
install -dp %{buildroot}%{_unitdir}
486003
install -p plugins/ipam/dhcp/systemd/cni-dhcp.service %{buildroot}%{_unitdir}
486003
install -p plugins/ipam/dhcp/systemd/cni-dhcp.socket %{buildroot}%{_unitdir}
486003
7e1e50
%check
7e1e50
%if 0%{?with_check}
7e1e50
# Since we aren't packaging up the vendor directory we need to link
7e1e50
# back to it somehow. Hack it up so that we can add the vendor
7e1e50
# directory from BUILD dir as a gopath to be searched when executing
7e1e50
# tests from the BUILDROOT dir.
7e1e50
ln -s ./ ./vendor/src # ./vendor/src -> ./vendor
7e1e50
7e1e50
export GOPATH=%{buildroot}/%{gopath}:$(pwd)/vendor:%{gopath}
7e1e50
7e1e50
%gotest %{import_path}/libcni
7e1e50
%gotest %{import_path}/pkg/invoke
7e1e50
%gotest %{import_path}/pkg/ip
7e1e50
%gotest %{import_path}/pkg/ipam
7e1e50
%gotest %{import_path}/pkg/ns
7e1e50
%gotest %{import_path}/pkg/skel
7e1e50
%gotest %{import_path}/pkg/types
7e1e50
%gotest %{import_path}/pkg/types/020
7e1e50
%gotest %{import_path}/pkg/types/current
7e1e50
%gotest %{import_path}/pkg/utils
7e1e50
%gotest %{import_path}/pkg/utils/hwaddr
7e1e50
%gotest %{import_path}/pkg/version
7e1e50
%gotest %{import_path}/pkg/version/legacy_examples
7e1e50
%gotest %{import_path}/pkg/version/testhelpers
7e1e50
%gotest %{import_path}/plugins/ipam/dhcp
7e1e50
%gotest %{import_path}/plugins/ipam/host-local
7e1e50
%gotest %{import_path}/plugins/ipam/host-local/backend/allocator
7e1e50
%gotest %{import_path}/plugins/main/bridge
7e1e50
%gotest %{import_path}/plugins/main/ipvlan
7e1e50
%gotest %{import_path}/plugins/main/loopback
7e1e50
%gotest %{import_path}/plugins/main/macvlan
7e1e50
%gotest %{import_path}/plugins/main/ptp
7e1e50
%gotest %{import_path}/plugins/meta/flannel
7e1e50
%gotest %{import_path}/plugins/test/noop
7e1e50
%endif
7e1e50
7e1e50
#define license tag if not already defined
7e1e50
%{!?_licensedir:%global license %doc}
7e1e50
7e1e50
%files
7e1e50
%license LICENSE
7e1e50
%doc *.md
7e1e50
%dir %{_libexecdir}/cni
7e1e50
%{_libexecdir}/cni/*
486003
%{_unitdir}/cni-dhcp.service
486003
%{_unitdir}/cni-dhcp.socket
7e1e50
7e1e50
%changelog
486003
* Fri Apr 08 2022 Jindrich Novy <jnovy@redhat.com> - 1:1.1.1-2
486003
- bump golang BR to 1.17.7
486003
- Related: #2061390
486003
486003
* Fri Mar 11 2022 Jindrich Novy <jnovy@redhat.com> - 1:1.1.1-1
486003
- update to https://github.com/containernetworking/plugins/releases/tag/v1.1.1
486003
- Related: #2061390
486003
486003
* Mon Mar 07 2022 Jindrich Novy <jnovy@redhat.com> - 1:1.0.1-2
486003
- revert back to https://github.com/containernetworking/plugins/releases/tag/v1.0.1
486003
- Related: #2061390
486003
7e1e50
* Fri Sep 10 2021 Jindrich Novy <jnovy@redhat.com> - 1.0.1-1
7e1e50
- update to https://github.com/containernetworking/plugins/releases/tag/v1.0.1
7e1e50
- Related: #2001445
7e1e50
7e1e50
* Thu Aug 12 2021 Jindrich Novy <jnovy@redhat.com> - 1.0.0-1
7e1e50
- update to https://github.com/containernetworking/plugins/releases/tag/v1.0.0
7e1e50
- Related: #1934415
7e1e50
7e1e50
* Sat Feb 06 2021 Jindrich Novy <jnovy@redhat.com> - 0.9.1-1
7e1e50
- update to https://github.com/containernetworking/plugins/releases/tag/v0.9.1
7e1e50
- Related: #1883490
7e1e50
7e1e50
* Thu Dec 10 2020 Jindrich Novy <jnovy@redhat.com> - 0.9.0-1
7e1e50
- update to https://github.com/containernetworking/plugins/releases/tag/v0.9.0
7e1e50
- Related: #1883490
7e1e50
7e1e50
* Tue Dec 08 2020 Jindrich Novy <jnovy@redhat.com> - 0.8.7-3
7e1e50
- use ExcludeArch: i686 again as the go_arches macro is broken
7e1e50
- Related: #1883490
7e1e50
7e1e50
* Thu Nov 05 2020 Jindrich Novy <jnovy@redhat.com> - 0.8.7-2
7e1e50
- attempt to fix linker error with golang-1.15
7e1e50
- Related: #1883490
7e1e50
7e1e50
* Wed Oct 21 2020 Jindrich Novy <jnovy@redhat.com> - 0.8.7-1
7e1e50
- synchronize with stream-container-tools-rhel8
7e1e50
- Related: #1883490
7e1e50
7e1e50
* Tue Aug 11 2020 Jindrich Novy <jnovy@redhat.com> - 0.8.6-2
7e1e50
- propagate proper CFLAGS to CGO_CFLAGS to assure code hardening and optimization
7e1e50
- Related: #1821193
7e1e50
7e1e50
* Thu May 14 2020 Jindrich Novy <jnovy@redhat.com> - 0.8.6-1
7e1e50
- update to https://github.com/containernetworking/plugins/releases/tag/v0.8.6
7e1e50
- Related: #1821193
7e1e50
7e1e50
* Tue May 12 2020 Jindrich Novy <jnovy@redhat.com> - 0.8.5-1
7e1e50
- synchronize containter-tools 8.3.0 with 8.2.1
7e1e50
- Related: #1821193
7e1e50
7e1e50
* Thu Dec 12 2019 Jindrich Novy <jnovy@redhat.com> - 0.8.3-5
7e1e50
- compile with no_openssl
7e1e50
- Related: RHELPLAN-25139
7e1e50
7e1e50
* Wed Dec 11 2019 Jindrich Novy <jnovy@redhat.com> - 0.8.3-4
7e1e50
- compile in FIPS mode
7e1e50
- Related: RHELPLAN-25139
7e1e50
7e1e50
* Mon Dec 09 2019 Jindrich Novy <jnovy@redhat.com> - 0.8.3-3
7e1e50
- be sure to use golang >= 1.12.12-4
7e1e50
- Related: RHELPLAN-25139
7e1e50
7e1e50
* Wed Dec 04 2019 Jindrich Novy <jnovy@redhat.com> - 0.8.3-2
7e1e50
- build with GO111MODULE=off
7e1e50
- Related: RHELPLAN-25139
7e1e50
7e1e50
* Wed Dec 04 2019 Jindrich Novy <jnovy@redhat.com> - 0.8.3-1
7e1e50
- update to 0.8.3
7e1e50
- Related: RHELPLAN-25139
7e1e50
7e1e50
* Thu Aug 01 2019 Jindrich Novy <jnovy@redhat.com> - 0.8.1-2
7e1e50
- backport https://github.com/coreos/go-iptables/pull/62
7e1e50
  from Michael Cambria
7e1e50
- Resolves: #1627561
7e1e50
7e1e50
* Thu Jun 13 2019 Lokesh Mandvekar <lsm5@redhat.com> - 0.8.1-1
7e1e50
- Resolves: #1720319 - bump to v0.8.1
7e1e50
7e1e50
* Sat Jun 01 2019 Lokesh Mandvekar <lsm5@redhat.com> - 0.7.5-1
7e1e50
- Resolves: #1616063
7e1e50
- bump to v0.7.5
7e1e50
7e1e50
* Tue Dec 18 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.7.4-3.git9ebe139
7e1e50
- re-enable debuginfo
7e1e50
7e1e50
* Mon Dec 17 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.7.4-2.git9ebe139
7e1e50
- rebase, removed patch that is already upstream
7e1e50
7e1e50
* Mon Dec 17 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.7.3-7.git19f2f28
7e1e50
- go tools not in scl anymore
7e1e50
7e1e50
* Mon Aug 27 2018 Lokesh Mandvekar <lsm5@redhat.com> - 0.7.3-6.git19f2f28
7e1e50
- correct tag specification format in %%gobuild macro
7e1e50
7e1e50
* Fri Aug 24 2018 Lokesh Mandvekar <lsm5@redhat.com> - 0.7.3-5.git19f2f28
7e1e50
- Resolves: #1616062 - patch to revert coreos/go-iptables bump
7e1e50
7e1e50
* Wed Aug 08 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.7.3-4.git19f2f28
7e1e50
- Resolves:#1603012
7e1e50
- fix versioning, upstream got it wrong at 7.2
7e1e50
7e1e50
* Tue Aug 07 2018 Lokesh Mandvekar <lsm5@redhat.com> - 0.7.2-3.git19f2f28
7e1e50
- disable i686 temporarily for appstream builds
7e1e50
- update golang deps and gobuild definition
7e1e50
7e1e50
* Mon Aug 06 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.7.2-2.git19f2f28
7e1e50
- rebase
7e1e50
7e1e50
* Thu Jul 12 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.7.0-103.gitdd8ff8a
7e1e50
- enable scl with the toolset
7e1e50
7e1e50
* Tue Jul 03 2018 Lokesh Mandvekar <lsm5@redhat.com> - 0.7.0-102.gitdd8ff8a
7e1e50
- remove devel and unittest subpackages
7e1e50
- use new go-toolset deps
7e1e50
 
7e1e50
* Thu May 10 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.7.0-101
7e1e50
- rebase
7e1e50
- patches already upstream, removed
7e1e50
7e1e50
* Thu Apr 26 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.6.0-6
7e1e50
- Imported from Fedora
7e1e50
- Renamed CNI -> plugins
7e1e50
7e1e50
* Mon Apr  2 2018 Peter Robinson <pbrobinson@fedoraproject.org> 0.6.0-4
7e1e50
- Own the libexec cni directory
7e1e50
7e1e50
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.6.0-3
7e1e50
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
7e1e50
7e1e50
* Tue Jan 23 2018 Dan Williams <dcbw@redhat.com> - 0.6.0-2
7e1e50
- skip settling IPv4 addresses
7e1e50
7e1e50
* Mon Jan 08 2018 Frantisek Kluknavsky <fkluknav@redhat.com> - 0.6.0-1
7e1e50
- rebased to 7480240de9749f9a0a5c8614b17f1f03e0c06ab9
7e1e50
7e1e50
* Fri Oct 13 2017 Lokesh Mandvekar <lsm5@fedoraproject.org> - 0.5.2-7
7e1e50
- do not install to /opt (against Fedora Guidelines)
7e1e50
7e1e50
* Thu Aug 24 2017 Jan Chaloupka <jchaloup@redhat.com> - 0.5.2-6
7e1e50
- Enable devel subpackage
7e1e50
7e1e50
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.2-5
7e1e50
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
7e1e50
7e1e50
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.2-4
7e1e50
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
7e1e50
7e1e50
* Thu Jul 13 2017 Lokesh Mandvekar <lsm5@fedoraproject.org> - 0.5.2-3
7e1e50
- excludearch: ppc64 as it's not in goarches anymore
7e1e50
- re-enable s390x
7e1e50
7e1e50
* Fri Jun 30 2017 Lokesh Mandvekar <lsm5@fedoraproject.org> - 0.5.2-2
7e1e50
- upstream moved to github.com/containernetworking/plugins
7e1e50
- built commit dcf7368
7e1e50
- provides: containernetworking-plugins
7e1e50
- use vendored deps because they're a lot less of a PITA
7e1e50
- excludearch: s390x for now (rhbz#1466865)
7e1e50
7e1e50
* Mon Jun 12 2017 Timothy St. Clair <tstclair@heptio.com> - 0.5.2-1
7e1e50
- Update to 0.5.2 
7e1e50
- Softlink to default /opt/cni/bin directories
7e1e50
7e1e50
* Sun May 07 2017 Timothy St. Clair <tstclair@heptio.com> - 0.5.1-1
7e1e50
- Initial package
7e1e50