Blame containernetworking-plugins.spec

29fc7fb
%global with_debug 1
d4dc821
d4dc821
%if 0%{?with_debug}
d4dc821
%global _find_debuginfo_dwz_opts %{nil}
d4dc821
%global _dwz_low_mem_die_limit 0
d4dc821
%else
d4dc821
%global debug_package   %{nil}
d4dc821
%endif
d4dc821
d4dc821
%global provider github
d4dc821
%global provider_tld com
d4dc821
%global project containernetworking
d4dc821
%global repo plugins
89124a4
%global import_path %{provider}.%{provider_tld}/%{project}/%{repo}
d4dc821
%global git0 https://%{import_path}
d4dc821
e43b084
%global built_tag v1.4.0
8308fd6
%global built_tag_strip %(b=%{built_tag}; echo ${b:1})
8308fd6
%global gen_version %(b=%{built_tag_strip}; echo ${b/-/"~"})
44bf724
d4dc821
Name: %{project}-%{repo}
e43b084
Version: 1.4.0
56c410a
Release: %autorelease
87219fe
License: Apache-2.0 and BSD-2-Clause and BSD-3-Clause and MIT and MPL-2.0
6a02556
Summary: Libraries for writing CNI plugin
d4dc821
URL: %{git0}
8308fd6
# Tarball fetched from upstream
8308fd6
Source0: %{url}/archive/%{built_tag}.tar.gz
921a605
ExclusiveArch: %{golang_arches}
e43b084
BuildRequires: golang >= 1.21.0
6a02556
BuildRequires: systemd-devel
99abe09
BuildRequires: go-rpm-macros
87bc762
BuildRequires: go-md2man
24becc3
Requires: systemd
3a6f9a5
Obsoletes: %{project}-cni < 0.7.1-2
d4dc821
Provides: %{project}-cni = %{version}-%{release}
f50486f
Provides: kubernetes-cni
3cb932f
Provides: container-network-stack = 1
b74d188
# vendored libraries
b74d188
# 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'
d2fb279
Provides: bundled(golang(github.com/alexflint/go_filemutex)) = v1.2.0
b74d188
Provides: bundled(golang(github.com/buger/jsonparser)) = v1.1.1
d2fb279
Provides: bundled(golang(github.com/containerd/cgroups)) = v1.1.0
d2fb279
Provides: bundled(golang(github.com/containernetworking/cni)) = v1.1.2
b74d188
Provides: bundled(golang(github.com/coreos/go_iptables)) = v0.6.0
d2fb279
Provides: bundled(golang(github.com/coreos/go_systemd/v22)) = v22.5.0
b74d188
Provides: bundled(golang(github.com/d2g/dhcp4client)) = v1.0.0
b74d188
Provides: bundled(golang(github.com/d2g/dhcp4server)) = v0.0.0_20181031114812_7d4a0a7f59a5
d2fb279
Provides: bundled(golang(github.com/d2g/dhcp4)) = v0.0.0_20170904100407_a1d1b6c41b1c
d2fb279
Provides: bundled(golang(github.com/godbus/dbus/v5)) = v5.1.0
b74d188
Provides: bundled(golang(github.com/gogo/protobuf)) = v1.3.2
d2fb279
Provides: bundled(golang(github.com/golang/groupcache)) = v0.0.0_20210331224755_41bb18bfe9da
d2fb279
Provides: bundled(golang(github.com/go_logr/logr)) = v1.2.4
d2fb279
Provides: bundled(golang(github.com/google/go_cmp)) = v0.5.9
d2fb279
Provides: bundled(golang(github.com/google/pprof)) = v0.0.0_20230323073829_e72429f035bd
d2fb279
Provides: bundled(golang(github.com/go_task/slim_sprig)) = v0.0.0_20230315185526_52ccab3ef572
b74d188
Provides: bundled(golang(github.com/mattn/go_shellwords)) = v1.0.12
d2fb279
Provides: bundled(golang(github.com/Microsoft/go_winio)) = v0.6.0
d2fb279
Provides: bundled(golang(github.com/Microsoft/hcsshim)) = v0.9.9
d2fb279
Provides: bundled(golang(github.com/networkplumbing/go_nft)) = v0.3.0
d2fb279
Provides: bundled(golang(github.com/onsi/ginkgo/v2)) = v2.9.2
d2fb279
Provides: bundled(golang(github.com/onsi/gomega)) = v1.27.6
d2fb279
Provides: bundled(golang(github.com/opencontainers/selinux)) = v1.11.0
b74d188
Provides: bundled(golang(github.com/pkg/errors)) = v0.9.1
d2fb279
Provides: bundled(golang(github.com/safchain/ethtool)) = v0.3.0
d2fb279
Provides: bundled(golang(github.com/sirupsen/logrus)) = v1.9.0
d2fb279
Provides: bundled(golang(github.com/vishvananda/netlink)) = v1.2.1_beta.2
d2fb279
Provides: bundled(golang(github.com/vishvananda/netns)) = v0.0.4
d4dc821
d4dc821
%description
d4dc821
The CNI (Container Network Interface) project consists of a specification
d4dc821
and libraries for writing plugins to configure network interfaces in Linux
d4dc821
containers, along with a number of supported plugins. CNI concerns itself
d4dc821
only with network connectivity of containers and removing allocated resources
d4dc821
when the container is deleted.
d4dc821
d4dc821
%prep
d7b87c1
%autosetup -p1 -n %{repo}-%{built_tag_strip}
48282f6
rm -rf plugins/main/windows
d4dc821
d6698f5
# Use correct paths in cni-dhcp unitfiles
d6698f5
sed -i 's/\/opt\/cni\/bin/\%{_prefix}\/libexec\/cni/' plugins/ipam/dhcp/systemd/cni-dhcp.service
d6698f5
d4dc821
%build
d4dc821
export ORG_PATH="%{provider}.%{provider_tld}/%{project}"
d4dc821
export REPO_PATH="$ORG_PATH/%{repo}"
d4dc821
d4dc821
if [ ! -h gopath/src/${REPO_PATH} ]; then
d4dc821
        mkdir -p gopath/src/${ORG_PATH}
d4dc821
        ln -s ../../../.. gopath/src/${REPO_PATH} || exit 255
d4dc821
fi
d4dc821
d4dc821
export GOPATH=$(pwd)/gopath
d4dc821
mkdir -p $(pwd)/bin
d4dc821
d4dc821
echo "Building plugins"
d4dc821
export PLUGINS="plugins/meta/* plugins/main/* plugins/ipam/* plugins/sample"
d4dc821
for d in $PLUGINS; do
d4dc821
        if [ -d "$d" ]; then
d4dc821
                plugin="$(basename "$d")"
d4dc821
                echo "  $plugin"
d4dc821
                %gobuild -o "${PWD}/bin/$plugin" "$@" "$REPO_PATH"/$d
d4dc821
        fi
d4dc821
done
d4dc821
d4dc821
%install
d4dc821
install -d -p %{buildroot}%{_libexecdir}/cni/
d4dc821
install -p -m 0755 bin/* %{buildroot}/%{_libexecdir}/cni
d4dc821
7430815
install -dp %{buildroot}%{_unitdir}
7430815
install -p plugins/ipam/dhcp/systemd/cni-dhcp.service %{buildroot}%{_unitdir}
7430815
install -p plugins/ipam/dhcp/systemd/cni-dhcp.socket %{buildroot}%{_unitdir}
7430815
d4dc821
#define license tag if not already defined
d4dc821
%{!?_licensedir:%global license %doc}
d4dc821
d4dc821
%files
d4dc821
%license LICENSE
d4dc821
%doc *.md
d4dc821
%dir %{_libexecdir}/cni
d4dc821
%{_libexecdir}/cni/*
7430815
%{_unitdir}/cni-dhcp.service
7430815
%{_unitdir}/cni-dhcp.socket
d4dc821
d4dc821
%changelog
e43b084
%autochangelog
e43b084