Blame containernetworking-plugins.spec

6a02556
%if "%{_vendor}" == "debbuild"
6a02556
%define gobuild(o:) GO111MODULE=off go build -buildmode pie -tags=" ${BUILDTAGS:-}" -a -v -x %{?**};
6a02556
%endif
6a02556
03a6e92
%if 0%{?fedora}
29fc7fb
%global with_debug 1
03a6e92
%else
03a6e92
%global with_debug 0
03a6e92
%endif
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
d7b87c1
%global built_tag_strip 1.1.1
44bf724
d4dc821
Name: %{project}-%{repo}
RH Container Bot d9a8461
Version: 1.1.1
6a02556
%if "%{_vendor}" == "debbuild"
6a02556
Packager: Podman Debbuild Maintainers <https://github.com/orgs/containers/teams/podman-debbuild-maintainers>
6a02556
License: ASL-2.0+
6a02556
Release: 0%{?dist}
6a02556
%else
56c410a
Release: %autorelease
b74d188
License: ASL 2.0 and BSD and MIT
6a02556
%endif
6a02556
Summary: Libraries for writing CNI plugin
d4dc821
URL: %{git0}
d7b87c1
Source0: %{git0}/archive/v%{built_tag_strip}.tar.gz
99abe09
BuildRequires: golang >= 1.16.6
6a02556
%if "%{_vendor}" == "debbuild"
6a02556
BuildRequires: libsystemd-dev
6a02556
%else
6a02556
BuildRequires: systemd-devel
6a02556
%if 0%{?fedora} || 0%{?rhel} >= 9
99abe09
BuildRequires: go-rpm-macros
6a02556
%endif
6a02556
%endif
87bc762
BuildRequires: go-md2man
24becc3
Requires: systemd
d4dc821
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'
8b37473
%if "%{_vendor}" != "debbuild"
b74d188
Provides: bundled(golang(github.com/Microsoft/go_winio)) = v0.4.17
b74d188
Provides: bundled(golang(github.com/Microsoft/hcsshim)) = v0.8.20
b74d188
Provides: bundled(golang(github.com/alexflint/go_filemutex)) = v1.1.0
b74d188
Provides: bundled(golang(github.com/buger/jsonparser)) = v1.1.1
b74d188
Provides: bundled(golang(github.com/containerd/cgroups)) = v1.0.1
b74d188
Provides: bundled(golang(github.com/containernetworking/cni)) = v1.0.1
b74d188
Provides: bundled(golang(github.com/coreos/go_iptables)) = v0.6.0
b74d188
Provides: bundled(golang(github.com/coreos/go_systemd/v22)) = v22.3.2
b74d188
Provides: bundled(golang(github.com/d2g/dhcp4)) = v0.0.0_20170904100407_a1d1b6c41b1c
b74d188
Provides: bundled(golang(github.com/d2g/dhcp4client)) = v1.0.0
b74d188
Provides: bundled(golang(github.com/d2g/dhcp4server)) = v0.0.0_20181031114812_7d4a0a7f59a5
b74d188
Provides: bundled(golang(github.com/fsnotify/fsnotify)) = v1.4.9
b74d188
Provides: bundled(golang(github.com/godbus/dbus/v5)) = v5.0.4
b74d188
Provides: bundled(golang(github.com/gogo/protobuf)) = v1.3.2
b74d188
Provides: bundled(golang(github.com/golang/groupcache)) = v0.0.0_20200121045136_8c9f03a8e57e
b74d188
Provides: bundled(golang(github.com/mattn/go_shellwords)) = v1.0.12
b74d188
Provides: bundled(golang(github.com/networkplumbing/go_nft)) = v0.2.0
b74d188
Provides: bundled(golang(github.com/nxadm/tail)) = v1.4.8
b74d188
Provides: bundled(golang(github.com/onsi/ginkgo)) = v1.16.4
b74d188
Provides: bundled(golang(github.com/onsi/gomega)) = v1.15.0
b74d188
Provides: bundled(golang(github.com/pkg/errors)) = v0.9.1
b74d188
Provides: bundled(golang(github.com/safchain/ethtool)) = v0.0.0_20210803160452_9aa261dae9b1
b74d188
Provides: bundled(golang(github.com/sirupsen/logrus)) = v1.8.1
b74d188
Provides: bundled(golang(github.com/vishvananda/netlink)) = v1.1.1_0.20210330154013_f5de75959ad5
b74d188
Provides: bundled(golang(github.com/vishvananda/netns)) = v0.0.0_20210104183010_2eb08e3e575f
8b37473
%endif
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
6a02556
%if "%{_vendor}" != "debbuild"
56c410a
%autochangelog
6a02556
%endif