1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 EGIT_COMMIT="5d44534fff6877b1cb15b760242279ae6293154c"
8 inherit bash-completion-r1 flag-o-matic go-module
10 DESCRIPTION="Library and podman tool for running OCI-based containers in Pods"
11 HOMEPAGE="https://github.com/containers/libpod/"
12 SRC_URI="https://github.com/containers/libpod/archive/v${PV}.tar.gz -> ${P}.tar.gz"
13 LICENSE="Apache-2.0 BSD BSD-2 CC-BY-SA-4.0 ISC MIT MPL-2.0"
17 IUSE="apparmor btrfs +fuse +rootless selinux"
22 >=app-emulation/conmon-2.0.0
23 || ( >=app-emulation/runc-1.0.0_rc6 app-emulation/crun )
25 dev-libs/libgpg-error:=
30 apparmor? ( sys-libs/libapparmor )
31 btrfs? ( sys-fs/btrfs-progs )
32 rootless? ( app-emulation/slirp4netns )
33 selinux? ( sys-libs/libselinux:= )
38 RDEPEND="${COMMON_DEPEND}
39 fuse? ( sys-fs/fuse-overlayfs )"
44 # Disable installation of python modules here, since those are
45 # installed by separate ebuilds.
46 local makefile_sed_args=(
48 -e 's/$(GO) build/$(GO) build -v -work -x/'
49 -e 's/^\(install:.*\) install\.python$/\1/'
52 has_version -b '>=dev-lang/go-1.13.9' || makefile_sed_args+=(-e 's:GO111MODULE=off:GO111MODULE=on:')
54 sed "${makefile_sed_args[@]}" -i Makefile || die
56 sed -e 's|OUTPUT="${CIRRUS_TAG:.*|OUTPUT='v${PV}'|' \
57 -i hack/get_release_info.sh || die
61 # Filter unsupported linker flags
64 [[ -f hack/apparmor_tag.sh ]] || die
66 echo -e "#!/bin/sh\necho apparmor" > hack/apparmor_tag.sh || die
68 echo -e "#!/bin/sh\ntrue" > hack/apparmor_tag.sh || die
71 [[ -f hack/btrfs_installed_tag.sh ]] || die
73 echo -e "#!/bin/sh\ntrue" > hack/btrfs_installed_tag.sh || die
75 echo -e "#!/bin/sh\necho exclude_graphdriver_btrfs" > \
76 hack/btrfs_installed_tag.sh || die
79 [[ -f hack/selinux_tag.sh ]] || die
81 echo -e "#!/bin/sh\necho selinux" > hack/selinux_tag.sh || die
83 echo -e "#!/bin/sh\ntrue" > hack/selinux_tag.sh || die
86 export -n GOCACHE GOPATH XDG_CACHE_HOME
90 GIT_BRANCH_CLEAN=master \
91 COMMIT_NO="${EGIT_COMMIT}" \
92 GIT_COMMIT="${EGIT_COMMIT}"
96 emake DESTDIR="${D}" PREFIX="${EPREFIX}/usr" install
98 insinto /etc/containers
99 newins test/registries.conf registries.conf.example
100 newins test/policy.json policy.json.example
102 insinto /usr/share/containers
105 newinitd "${FILESDIR}"/podman.initd podman
107 insinto /etc/logrotate.d
108 newins "${FILESDIR}/podman.logrotated" podman
110 dobashcomp completions/bash/*
112 keepdir /var/lib/containers
116 LIBPOD_ROOTLESS_UPGRADE=false
117 if use rootless; then
118 has_version 'app-emulation/libpod[rootless]' || LIBPOD_ROOTLESS_UPGRADE=true
123 local want_newline=false
124 if [[ ! ( -e ${EROOT%/*}/etc/containers/policy.json && -e ${EROOT%/*}/etc/containers/registries.conf ) ]]; then
125 elog "You need to create the following config files:"
126 elog "/etc/containers/registries.conf"
127 elog "/etc/containers/policy.json"
128 elog "To copy over default examples, use:"
129 elog "cp /etc/containers/registries.conf{.example,}"
130 elog "cp /etc/containers/policy.json{.example,}"
133 if [[ ${LIBPOD_ROOTLESS_UPGRADE} == true ]] ; then
134 ${want_newline} && elog ""
135 elog "For rootless operation, you need to configure subuid/subgid"
136 elog "for user running podman. In case subuid/subgid has only been"
137 elog "configured for root, run:"
138 elog "usermod --add-subuids 1065536-1131071 <user>"
139 elog "usermod --add-subgids 1065536-1131071 <user>"