Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-emulation/libpod/
Date: Tue, 19 Feb 2019 19:45:31
Message-Id: 1550605384.08bd18e22f5f1c864831770293596d0dcef36594.zmedico@gentoo
1 commit: 08bd18e22f5f1c864831770293596d0dcef36594
2 Author: Gerhard Bräunlich <g.braeunlich <AT> disroot <DOT> org>
3 AuthorDate: Tue Feb 19 17:06:22 2019 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Tue Feb 19 19:43:04 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=08bd18e2
7
8 app-emulation/libpod: Add rootless useflag
9
10 Closes: https://github.com/gentoo/gentoo/pull/11107
11 Package-Manager: Portage-2.3.51, Repoman-2.3.11
12 Signed-off-by: Gerhard Bräunlich <g.braeunlich <AT> disroot.org>
13 Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>
14
15 app-emulation/libpod/libpod-1.0.1-r1.ebuild | 139 ++++++++++++++++++++++++++++
16 app-emulation/libpod/metadata.xml | 3 +
17 2 files changed, 142 insertions(+)
18
19 diff --git a/app-emulation/libpod/libpod-1.0.1-r1.ebuild b/app-emulation/libpod/libpod-1.0.1-r1.ebuild
20 new file mode 100644
21 index 00000000000..a02406b1ca8
22 --- /dev/null
23 +++ b/app-emulation/libpod/libpod-1.0.1-r1.ebuild
24 @@ -0,0 +1,139 @@
25 +# Copyright 1999-2019 Gentoo Authors
26 +# Distributed under the terms of the GNU General Public License v2
27 +
28 +EAPI=6
29 +
30 +EGIT_COMMIT="2c74edd0ac6509d6e533cb4e012e3e3f9e03434d"
31 +EGO_PN="github.com/containers/${PN}"
32 +
33 +inherit golang-vcs-snapshot systemd
34 +
35 +DESCRIPTION="Library and podman tool for running OCI-based containers in Pods"
36 +HOMEPAGE="https://github.com/containers/libpod/"
37 +SRC_URI="https://github.com/containers/libpod/archive/v${PV}.tar.gz -> ${P}.tar.gz"
38 +LICENSE="Apache-2.0"
39 +SLOT="0"
40 +
41 +KEYWORDS="~amd64"
42 +IUSE="apparmor btrfs ostree +rootless selinux"
43 +REQUIRED_USE="!selinux? ( !ostree )"
44 +RESTRICT="test"
45 +
46 +COMMON_DEPEND="
47 + app-crypt/gpgme:=
48 + >=app-emulation/cri-o-1.13.0
49 + >=app-emulation/runc-1.0.0_rc6
50 + dev-libs/libassuan:=
51 + dev-libs/libgpg-error:=
52 + sys-fs/lvm2
53 + sys-libs/libseccomp:=
54 +
55 + apparmor? ( sys-libs/libapparmor )
56 + btrfs? ( sys-fs/btrfs-progs )
57 + ostree? (
58 + dev-libs/glib:=
59 + dev-util/ostree:=
60 + )
61 + rootless? ( app-emulation/slirp4netns )
62 + selinux? ( sys-libs/libselinux:= )
63 +"
64 +DEPEND="
65 + ${COMMON_DEPEND}
66 + dev-go/go-md2man"
67 +RDEPEND="${COMMON_DEPEND}"
68 +S="${WORKDIR}/${P}/src/${EGO_PN}"
69 +
70 +src_prepare() {
71 + default
72 +
73 + # Disable installation of python modules here, since those are
74 + # installed by separate ebuilds.
75 + sed -e '/^GIT_.*/d' \
76 + -e 's/$(GO) build/$(GO) build -v -work -x/' \
77 + -e 's/^\(install:.*\) install\.python$/\1/' \
78 + -i Makefile || die
79 +}
80 +
81 +src_compile() {
82 + [[ -f hack/apparmor_tag.sh ]] || die
83 + if use apparmor; then
84 + echo -e "#!/bin/sh\necho apparmor" > hack/apparmor_tag.sh || die
85 + else
86 + echo -e "#!/bin/sh\ntrue" > hack/apparmor_tag.sh || die
87 + fi
88 +
89 + [[ -f hack/btrfs_installed_tag.sh ]] || die
90 + if use btrfs; then
91 + echo -e "#!/bin/sh\ntrue" > hack/btrfs_installed_tag.sh || die
92 + else
93 + echo -e "#!/bin/sh\necho exclude_graphdriver_btrfs" > \
94 + hack/btrfs_installed_tag.sh || die
95 + fi
96 +
97 + [[ -f hack/ostree_tag.sh ]] || die
98 + if use ostree; then
99 + echo -e "#!/bin/sh\necho ostree" > hack/ostree_tag.sh || die
100 + else
101 + echo -e "#!/bin/sh\necho containers_image_ostree_stub" > hack/ostree_tag.sh || die
102 + fi
103 +
104 + [[ -f hack/selinux_tag.sh ]] || die
105 + if use selinux; then
106 + echo -e "#!/bin/sh\necho selinux" > hack/selinux_tag.sh || die
107 + else
108 + echo -e "#!/bin/sh\ntrue" > hack/selinux_tag.sh || die
109 + fi
110 +
111 + env -u LDFLAGS GOPATH="${WORKDIR}/${P}" GOBIN="${WORKDIR}/${P}/bin" \
112 + emake all \
113 + GIT_BRANCH=master \
114 + GIT_BRANCH_CLEAN=master \
115 + COMMIT_NO="${EGIT_COMMIT}" \
116 + GIT_COMMIT="${EGIT_COMMIT}"
117 +}
118 +
119 +src_install() {
120 + emake DESTDIR="${D}" PREFIX="${D}${EPREFIX}/usr" install
121 +
122 + insinto /etc/containers
123 + newins test/registries.conf registries.conf.example
124 + newins test/policy.json policy.json.example
125 +
126 + newinitd "${FILESDIR}"/podman.initd podman
127 +
128 + systemd_dounit "${S}"/contrib/varlink/*.service "${S}"/contrib/varlink/*.socket
129 +
130 + insinto /etc/logrotate.d
131 + newins "${FILESDIR}/podman.logrotated" podman
132 +
133 + keepdir /var/lib/containers
134 +}
135 +
136 +pkg_preinst() {
137 + LIBPOD_ROOTLESS_UPGRADE=false
138 + if use rootless; then
139 + has_version 'app-emulation/libpod[rootless]' || LIBPOD_ROOTLESS_UPGRADE=true
140 + fi
141 +}
142 +
143 +pkg_postinst() {
144 + local want_newline=false
145 + if [[ ! ( -e ${EROOT%/*}/etc/containers/policy.json && -e ${EROOT%/*}/etc/containers/registries.conf ) ]]; then
146 + elog "You need to create the following config files:"
147 + elog "/etc/containers/registries.conf"
148 + elog "/etc/containers/policy.json"
149 + elog "To copy over default examples, use:"
150 + elog "cp /etc/containers/registries.conf{.example,}"
151 + elog "cp /etc/containers/policy.json{.example,}"
152 + want_newline=true
153 + fi
154 + if [[ ${LIBPOD_ROOTLESS_UPGRADE} == true ]] ; then
155 + ${want_newline} && elog ""
156 + elog "For rootless operation, you need to configure subuid/subgid"
157 + elog "for user running podman. In case subuid/subgid has only been"
158 + elog "configured for root, run:"
159 + elog "usermod --add-subuids 1065536-1131071 <user>"
160 + elog "usermod --add-subgids 1065536-1131071 <user>"
161 + want_newline=true
162 + fi
163 +}
164
165 diff --git a/app-emulation/libpod/metadata.xml b/app-emulation/libpod/metadata.xml
166 index 1c5655b32d7..b488c7d9282 100644
167 --- a/app-emulation/libpod/metadata.xml
168 +++ b/app-emulation/libpod/metadata.xml
169 @@ -22,6 +22,9 @@
170 <flag name="ostree">
171 Enables dependencies for handling of OSTree images.
172 </flag>
173 + <flag name="rootless">
174 + Enables dependencies for running in rootless mode.
175 + </flag>
176 </use>
177 <upstream>
178 <remote-id type="github">containers/libpod</remote-id>