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