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