2021-06-14 14:22:00 +00:00
|
|
|
%global with_debug 1
|
2018-08-20 13:15:11 +00:00
|
|
|
|
|
|
|
%if 0%{?with_debug}
|
|
|
|
%global _find_debuginfo_dwz_opts %{nil}
|
|
|
|
%global _dwz_low_mem_die_limit 0
|
|
|
|
%else
|
|
|
|
%global debug_package %{nil}
|
|
|
|
%endif
|
|
|
|
|
|
|
|
%global provider github
|
|
|
|
%global provider_tld com
|
|
|
|
%global project containernetworking
|
|
|
|
%global repo plugins
|
2020-05-15 00:54:08 +00:00
|
|
|
%global import_path %{provider}.%{provider_tld}/%{project}/%{repo}
|
2018-08-20 13:15:11 +00:00
|
|
|
%global git0 https://%{import_path}
|
|
|
|
|
2022-10-10 14:46:32 +00:00
|
|
|
%global built_tag v1.1.1
|
|
|
|
%global built_tag_strip %(b=%{built_tag}; echo ${b:1})
|
|
|
|
%global gen_version %(b=%{built_tag_strip}; echo ${b/-/"~"})
|
2019-07-31 01:19:17 +00:00
|
|
|
|
2018-08-20 13:15:11 +00:00
|
|
|
Name: %{project}-%{repo}
|
2022-05-30 20:38:54 +00:00
|
|
|
Version: 1.1.1
|
2022-01-24 19:19:02 +00:00
|
|
|
Release: %autorelease
|
2022-04-01 16:04:39 +00:00
|
|
|
License: ASL 2.0 and BSD and MIT
|
2022-08-16 19:07:43 +00:00
|
|
|
Summary: Libraries for writing CNI plugin
|
2018-08-20 13:15:11 +00:00
|
|
|
URL: %{git0}
|
2022-10-10 14:46:32 +00:00
|
|
|
# Tarball fetched from upstream
|
|
|
|
Source0: %{url}/archive/%{built_tag}.tar.gz
|
2022-10-28 15:55:23 +00:00
|
|
|
ExclusiveArch: %{golang_arches}
|
2021-08-02 13:12:09 +00:00
|
|
|
BuildRequires: golang >= 1.16.6
|
2022-08-16 19:07:43 +00:00
|
|
|
BuildRequires: systemd-devel
|
2021-08-02 13:12:09 +00:00
|
|
|
BuildRequires: go-rpm-macros
|
2020-02-03 13:19:23 +00:00
|
|
|
BuildRequires: go-md2man
|
2021-03-08 18:32:48 +00:00
|
|
|
Requires: systemd
|
2018-08-30 13:02:47 +00:00
|
|
|
Obsoletes: %{project}-cni < 0.7.1-2
|
2018-08-20 13:15:11 +00:00
|
|
|
Provides: %{project}-cni = %{version}-%{release}
|
2019-02-27 14:49:28 +00:00
|
|
|
Provides: kubernetes-cni
|
2022-02-02 19:09:24 +00:00
|
|
|
Provides: container-network-stack = 1
|
2022-04-01 16:04:39 +00:00
|
|
|
# vendored libraries
|
|
|
|
# awk '{print "Provides: bundled(golang("$1")) = "$2}' go.mod | sort | uniq | sed -e 's/-/_/g' -e '/bundled(golang())/d' -e '/bundled(golang(go\|module\|replace\|require))/d'
|
|
|
|
Provides: bundled(golang(github.com/Microsoft/go_winio)) = v0.4.17
|
|
|
|
Provides: bundled(golang(github.com/Microsoft/hcsshim)) = v0.8.20
|
|
|
|
Provides: bundled(golang(github.com/alexflint/go_filemutex)) = v1.1.0
|
|
|
|
Provides: bundled(golang(github.com/buger/jsonparser)) = v1.1.1
|
|
|
|
Provides: bundled(golang(github.com/containerd/cgroups)) = v1.0.1
|
|
|
|
Provides: bundled(golang(github.com/containernetworking/cni)) = v1.0.1
|
|
|
|
Provides: bundled(golang(github.com/coreos/go_iptables)) = v0.6.0
|
|
|
|
Provides: bundled(golang(github.com/coreos/go_systemd/v22)) = v22.3.2
|
|
|
|
Provides: bundled(golang(github.com/d2g/dhcp4)) = v0.0.0_20170904100407_a1d1b6c41b1c
|
|
|
|
Provides: bundled(golang(github.com/d2g/dhcp4client)) = v1.0.0
|
|
|
|
Provides: bundled(golang(github.com/d2g/dhcp4server)) = v0.0.0_20181031114812_7d4a0a7f59a5
|
|
|
|
Provides: bundled(golang(github.com/fsnotify/fsnotify)) = v1.4.9
|
|
|
|
Provides: bundled(golang(github.com/godbus/dbus/v5)) = v5.0.4
|
|
|
|
Provides: bundled(golang(github.com/gogo/protobuf)) = v1.3.2
|
|
|
|
Provides: bundled(golang(github.com/golang/groupcache)) = v0.0.0_20200121045136_8c9f03a8e57e
|
|
|
|
Provides: bundled(golang(github.com/mattn/go_shellwords)) = v1.0.12
|
|
|
|
Provides: bundled(golang(github.com/networkplumbing/go_nft)) = v0.2.0
|
|
|
|
Provides: bundled(golang(github.com/nxadm/tail)) = v1.4.8
|
|
|
|
Provides: bundled(golang(github.com/onsi/ginkgo)) = v1.16.4
|
|
|
|
Provides: bundled(golang(github.com/onsi/gomega)) = v1.15.0
|
|
|
|
Provides: bundled(golang(github.com/pkg/errors)) = v0.9.1
|
|
|
|
Provides: bundled(golang(github.com/safchain/ethtool)) = v0.0.0_20210803160452_9aa261dae9b1
|
|
|
|
Provides: bundled(golang(github.com/sirupsen/logrus)) = v1.8.1
|
|
|
|
Provides: bundled(golang(github.com/vishvananda/netlink)) = v1.1.1_0.20210330154013_f5de75959ad5
|
|
|
|
Provides: bundled(golang(github.com/vishvananda/netns)) = v0.0.0_20210104183010_2eb08e3e575f
|
2018-08-20 13:15:11 +00:00
|
|
|
|
|
|
|
%description
|
|
|
|
The CNI (Container Network Interface) project consists of a specification
|
|
|
|
and libraries for writing plugins to configure network interfaces in Linux
|
|
|
|
containers, along with a number of supported plugins. CNI concerns itself
|
|
|
|
only with network connectivity of containers and removing allocated resources
|
|
|
|
when the container is deleted.
|
|
|
|
|
|
|
|
%prep
|
2022-08-17 18:44:31 +00:00
|
|
|
%autosetup -p1 -n %{repo}-%{built_tag_strip}
|
2019-06-07 13:23:57 +00:00
|
|
|
rm -rf plugins/main/windows
|
2018-08-20 13:15:11 +00:00
|
|
|
|
2021-06-07 18:13:16 +00:00
|
|
|
# Use correct paths in cni-dhcp unitfiles
|
|
|
|
sed -i 's/\/opt\/cni\/bin/\%{_prefix}\/libexec\/cni/' plugins/ipam/dhcp/systemd/cni-dhcp.service
|
|
|
|
|
2018-08-20 13:15:11 +00:00
|
|
|
%build
|
|
|
|
export ORG_PATH="%{provider}.%{provider_tld}/%{project}"
|
|
|
|
export REPO_PATH="$ORG_PATH/%{repo}"
|
|
|
|
|
|
|
|
if [ ! -h gopath/src/${REPO_PATH} ]; then
|
|
|
|
mkdir -p gopath/src/${ORG_PATH}
|
|
|
|
ln -s ../../../.. gopath/src/${REPO_PATH} || exit 255
|
|
|
|
fi
|
|
|
|
|
|
|
|
export GOPATH=$(pwd)/gopath
|
|
|
|
mkdir -p $(pwd)/bin
|
|
|
|
|
|
|
|
echo "Building plugins"
|
|
|
|
export PLUGINS="plugins/meta/* plugins/main/* plugins/ipam/* plugins/sample"
|
|
|
|
for d in $PLUGINS; do
|
|
|
|
if [ -d "$d" ]; then
|
|
|
|
plugin="$(basename "$d")"
|
|
|
|
echo " $plugin"
|
|
|
|
%gobuild -o "${PWD}/bin/$plugin" "$@" "$REPO_PATH"/$d
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
%install
|
|
|
|
install -d -p %{buildroot}%{_libexecdir}/cni/
|
|
|
|
install -p -m 0755 bin/* %{buildroot}/%{_libexecdir}/cni
|
|
|
|
|
2021-02-15 21:05:47 +00:00
|
|
|
install -dp %{buildroot}%{_unitdir}
|
|
|
|
install -p plugins/ipam/dhcp/systemd/cni-dhcp.service %{buildroot}%{_unitdir}
|
|
|
|
install -p plugins/ipam/dhcp/systemd/cni-dhcp.socket %{buildroot}%{_unitdir}
|
|
|
|
|
2018-08-20 13:15:11 +00:00
|
|
|
#define license tag if not already defined
|
|
|
|
%{!?_licensedir:%global license %doc}
|
|
|
|
|
|
|
|
%files
|
|
|
|
%license LICENSE
|
|
|
|
%doc *.md
|
|
|
|
%dir %{_libexecdir}/cni
|
|
|
|
%{_libexecdir}/cni/*
|
2021-02-15 21:05:47 +00:00
|
|
|
%{_unitdir}/cni-dhcp.service
|
|
|
|
%{_unitdir}/cni-dhcp.socket
|
2018-08-20 13:15:11 +00:00
|
|
|
|
|
|
|
%changelog
|
2022-01-24 19:19:02 +00:00
|
|
|
%autochangelog
|