dev-python/pytest: arm64 stable (bug #723996)
[gentoo.git] / app-emulation / cri-o / cri-o-1.10.6.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 EGIT_COMMIT="56d7d9a0750d7deb06182361837b690683f13dfe"
7 EGO_PN="github.com/kubernetes-incubator/${PN}"
8
9 inherit golang-vcs-snapshot systemd
10
11 DESCRIPTION="OCI-based implementation of Kubernetes Container Runtime Interface"
12 HOMEPAGE="https://cri-o.io/"
13 SRC_URI="https://github.com/kubernetes-incubator/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
14
15 LICENSE="Apache-2.0 BSD BSD-2 CC-BY-SA-4.0 ISC MIT MPL-2.0"
16 SLOT="0"
17 KEYWORDS="~amd64"
18 IUSE="btrfs +device-mapper ostree seccomp selinux"
19
20 COMMON_DEPEND="
21         app-crypt/gpgme:=
22         app-emulation/runc
23         dev-libs/glib:=
24         dev-libs/libassuan:=
25         dev-libs/libgpg-error:=
26         net-firewall/conntrack-tools
27         net-firewall/iptables
28         net-misc/cni-plugins
29         net-misc/socat
30         sys-apps/iproute2
31         btrfs? ( sys-fs/btrfs-progs )
32         device-mapper? ( sys-fs/lvm2:= )
33         ostree? ( dev-util/ostree )
34         seccomp? ( sys-libs/libseccomp:= )
35         selinux? ( sys-libs/libselinux:= )"
36 DEPEND="
37         ${COMMON_DEPEND}
38         dev-go/go-md2man"
39 RDEPEND="${COMMON_DEPEND}"
40 S="${WORKDIR}/${P}/src/${EGO_PN}"
41
42 src_prepare() {
43         default
44
45         sed -e '/^GIT_.*/d' \
46                 -e 's/$(GO) build -i/$(GO) build -v -work -x/' \
47                 -e 's/\${GIT_COMMIT}/'${EGIT_COMMIT}'/' \
48                 -i Makefile || die
49
50         sed -e 's:/usr/local/bin:/usr/bin:' \
51                 -i contrib/systemd/* || die
52 }
53
54 src_compile() {
55         [[ -f hack/btrfs_installed_tag.sh ]] || die
56         use btrfs || { echo -e "#!/bin/sh\necho exclude_graphdriver_btrfs" > \
57                 hack/btrfs_installed_tag.sh || die; }
58
59         [[ -f hack/libdm_installed.sh ]] || die
60         use device-mapper || { echo -e "#!/bin/sh\necho exclude_graphdriver_devicemapper" > \
61                 hack/libdm_installed.sh || die; }
62
63         [[ -f hack/ostree_tag.sh ]] || die
64         use ostree || { echo -e "#!/bin/sh\necho containers_image_ostree_stub" > \
65                 hack/ostree_tag.sh || die; }
66
67         [[ -f hack/seccomp_tag.sh ]] || die
68         use seccomp || { echo -e "#!/bin/sh\ntrue" > \
69                 hack/seccomp_tag.sh || die; }
70
71         [[ -f hack/selinux_tag.sh ]] || die
72         use selinux || { echo -e "#!/bin/sh\ntrue" > \
73                 hack/selinux_tag.sh || die; }
74
75         mkdir -p bin || die
76         GOPATH="${WORKDIR}/${P}" GOBIN="${WORKDIR}/${P}/bin" \
77                 emake binaries docs
78 }
79
80 src_install() {
81         emake DESTDIR="${D}" PREFIX="${D}${EPREFIX}/usr" install.bin install.man
82
83         keepdir /etc/crio
84         insinto /etc/crio
85         use seccomp && doins seccomp.json
86
87         "${ED}"/usr/bin/crio --config="" config --default > "${T}"/crio.conf.example || die
88         doins   "${T}/crio.conf.example"
89
90         newinitd "${FILESDIR}/crio.initd" crio
91
92         insinto /etc/logrotate.d
93         newins "${FILESDIR}/${PN}.logrotated" "${PN}"
94
95         # Suppress crio log error messages triggered if these don't exist.
96         keepdir /etc/containers/oci/hooks.d
97         keepdir /usr/share/containers/oci/hooks.d
98
99         # Suppress crio "Missing CNI default network" log message.
100         keepdir /etc/cni/net.d
101         insinto /etc/cni/net.d
102         doins contrib/cni/99-loopback.conf
103
104         systemd_dounit contrib/systemd/*
105 }