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