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