Gentoo Archives: gentoo-commits

From: Erik Mackdanz <stasibear@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-emulation/lxd/, app-emulation/lxd/files/
Date: Sun, 04 Sep 2016 17:52:00
Message-Id: 1473011484.fc50c0f7bb680462f6b6299dccc15b1cb023d53f.stasibear@gentoo
1 commit: fc50c0f7bb680462f6b6299dccc15b1cb023d53f
2 Author: Erik Mackdanz <stasibear <AT> gentoo <DOT> org>
3 AuthorDate: Sun Sep 4 17:51:24 2016 +0000
4 Commit: Erik Mackdanz <stasibear <AT> gentoo <DOT> org>
5 CommitDate: Sun Sep 4 17:51:24 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fc50c0f7
7
8 app-emulation/lxd: bump to 2.1
9
10 Package-Manager: portage-2.3.0
11
12 app-emulation/lxd/Manifest | 1 +
13 app-emulation/lxd/files/lxd-2.1-dont-go-get.patch | 22 +++
14 app-emulation/lxd/files/lxd-2.1.confd | 27 ++++
15 app-emulation/lxd/files/lxd-2.1.initd | 50 +++++++
16 app-emulation/lxd/lxd-2.1.ebuild | 156 ++++++++++++++++++++++
17 5 files changed, 256 insertions(+)
18
19 diff --git a/app-emulation/lxd/Manifest b/app-emulation/lxd/Manifest
20 index 5ecedc5..55bbeca 100644
21 --- a/app-emulation/lxd/Manifest
22 +++ b/app-emulation/lxd/Manifest
23 @@ -1 +1,2 @@
24 DIST lxd-2.0.3.tar.bz2 2349842 SHA256 fb8a56e08da776f5210970a12e61b2e7b751328b5628e6fbebde231952b907a9 SHA512 62ac76bee0ff151343d0686da9376ff16965af5de19b50055bad86461dc2dd8e06544ee39640537f8352ec03b584ed32cf70cce9c7c961285d9ea567c617330e WHIRLPOOL 60204498c0a104310ddb28e42ea8889830c2f0e8c830c683b51d5cdbc92380de7c7964961fc7a34b32c7cb4dccaa4222f017b0d8948f54d5044770c066141319
25 +DIST lxd-2.1.tar.bz2 2260663 SHA256 6513d0576c8579668e480c4a663ffda9c3788b7d72338dbd443567a2da0d52d2 SHA512 4da46c256035253a7c0447cfc3f6887116b99f7bb4757b2b54dba436107a56dbab5973c654ea5c39760fac6b590ee9eb99ecc81b357b37a212990b25b9fa9ee9 WHIRLPOOL 90256881584a8b1d8ebe6d774a3d5614a634be06bbc0e0a51284ea842e590a21b8fc9b1eb228cca65b45306ed9750e10c81847663d2b6676ba192870aa8569a7
26
27 diff --git a/app-emulation/lxd/files/lxd-2.1-dont-go-get.patch b/app-emulation/lxd/files/lxd-2.1-dont-go-get.patch
28 new file mode 100644
29 index 00000000..9402de5
30 --- /dev/null
31 +++ b/app-emulation/lxd/files/lxd-2.1-dont-go-get.patch
32 @@ -0,0 +1,22 @@
33 +--- /Makefile.orig 2016-07-11 23:34:40.299664675 +0000
34 ++++ /Makefile 2016-07-11 23:37:00.816018727 +0000
35 +@@ -12,19 +12,11 @@
36 +
37 + .PHONY: default
38 + default:
39 +- # Must a few times due to go get race
40 +- -go get -t -v -d ./...
41 +- -go get -t -v -d ./...
42 +- -go get -t -v -d ./...
43 + go install -v $(DEBUG) ./...
44 + @echo "LXD built successfully"
45 +
46 + .PHONY: client
47 + client:
48 +- # Must a few times due to go get race
49 +- -go get -t -v -d ./...
50 +- -go get -t -v -d ./...
51 +- -go get -t -v -d ./...
52 + go install -v $(DEBUG) ./lxc
53 + @echo "LXD client built successfully"
54 +
55
56 diff --git a/app-emulation/lxd/files/lxd-2.1.confd b/app-emulation/lxd/files/lxd-2.1.confd
57 new file mode 100644
58 index 00000000..3d55327
59 --- /dev/null
60 +++ b/app-emulation/lxd/files/lxd-2.1.confd
61 @@ -0,0 +1,27 @@
62 +# Group which owns the shared socket
63 +LXD_OPTIONS+=" --group lxd"
64 +
65 +
66 +
67 +# Enable cpu profiling into the specified file
68 +#LXD_OPTIONS+=" --cpuprofile /tmp/lxc_cpu_profile"
69 +
70 +# Enable memory profiling into the specified file
71 +#LXD_OPTIONS+=" --memprofile /tmp/lxc_mem_profile"
72 +
73 +
74 +
75 +# Enables debug mode
76 +#LXD_OPTIONS+=" --debug"
77 +
78 +# For debugging, print a complete stack trace every n seconds
79 +#LXD_OPTIONS+=" --print-goroutines-every 5"
80 +
81 +# Enables verbose mode
82 +#LXD_OPTIONS+=" -v"
83 +
84 +# Logfile to log to
85 +#LXD_OPTIONS+=" --logfile /var/log/lxd/lxd.log"
86 +
87 +# Enables syslog logging
88 +#LXD_OPTIONS+=" --syslog"
89
90 diff --git a/app-emulation/lxd/files/lxd-2.1.initd b/app-emulation/lxd/files/lxd-2.1.initd
91 new file mode 100644
92 index 00000000..c1aef37
93 --- /dev/null
94 +++ b/app-emulation/lxd/files/lxd-2.1.initd
95 @@ -0,0 +1,50 @@
96 +#!/sbin/openrc-run
97 +# Copyright 1999-2016 Gentoo Foundation
98 +# Distributed under the terms of the GNU General Public License v2
99 +# $Id$
100 +
101 +DAEMON=/usr/sbin/lxd
102 +PIDFILE=/run/lxd.pid
103 +
104 +extra_commands="stopall"
105 +
106 +depend() {
107 + need net
108 + use lxcfs
109 +
110 + # remove with 2.0 release
111 + need cgmanager
112 +}
113 +
114 +start() {
115 + ebegin "Starting lxd server"
116 +
117 + start-stop-daemon --start \
118 + --pidfile ${PIDFILE} \
119 + --exec ${DAEMON} \
120 + --background \
121 + --make-pidfile \
122 + -- \
123 + ${LXD_OPTIONS}
124 +
125 + eend $?
126 +}
127 +
128 +stop() {
129 + if [[ $RC_GOINGDOWN = YES ]] || [[ $RC_REBOOT = YES ]]; then
130 + stopall
131 + else
132 + ebegin "Stopping lxd service (but not containers)"
133 + start-stop-daemon --stop --quiet -R TERM/45 -p ${PIDFILE}
134 + eend $?
135 + fi
136 +}
137 +
138 +stopall() {
139 + ebegin "Stopping lxd service and containers"
140 + if "${DAEMON}" shutdown; then
141 + /etc/init.d/lxd zap
142 + rm -f ${PIDFILE}
143 + fi
144 + eend $?
145 +}
146
147 diff --git a/app-emulation/lxd/lxd-2.1.ebuild b/app-emulation/lxd/lxd-2.1.ebuild
148 new file mode 100644
149 index 00000000..b5754f1
150 --- /dev/null
151 +++ b/app-emulation/lxd/lxd-2.1.ebuild
152 @@ -0,0 +1,156 @@
153 +# Copyright 1999-2016 Gentoo Foundation
154 +# Distributed under the terms of the GNU General Public License v2
155 +# $Id$
156 +
157 +EAPI=6
158 +
159 +DESCRIPTION="Fast, dense and secure container management"
160 +HOMEPAGE="https://linuxcontainers.org/lxd/introduction/"
161 +EGO_PN_PARENT="github.com/lxc"
162 +EGO_PN="${EGO_PN_PARENT}/lxd"
163 +
164 +# The source is repackaged using a script at:
165 +# https://dev.gentoo.org/~stasibear/lxd_repackage.py
166 +# This is necessary because go's native package management assumes
167 +# that a build starts with checking out many git repositories, often
168 +# from HEAD. This provides no way to build the same code repeatably,
169 +# and anyway portage requires that fetching is only done from SRC_URI.
170 +# The only sane alternative I've seen is in the consul ebuild, which
171 +# is more transparent but raises other questions.
172 +SRC_URI="https://dev.gentoo.org/~stasibear/distfiles/${P}.tar.bz2"
173 +
174 +LICENSE="Apache-2.0"
175 +SLOT="0"
176 +KEYWORDS="~amd64"
177 +
178 +PLOCALES="de fr ja"
179 +IUSE="+daemon nls test"
180 +
181 +# IUSE and PLOCALES must be defined before l10n inherited
182 +inherit bash-completion-r1 golang-build l10n systemd user vcs-snapshot
183 +
184 +DEPEND="
185 + dev-go/go-crypto
186 + dev-libs/protobuf
187 + nls? ( sys-devel/gettext )
188 + test? (
189 + app-misc/jq
190 + dev-db/sqlite
191 + net-misc/curl
192 + sys-devel/gettext
193 + )
194 +"
195 +
196 +RDEPEND="
197 + daemon? (
198 + app-admin/cgmanager
199 + app-arch/xz-utils
200 + app-emulation/lxc[cgmanager,seccomp]
201 + net-misc/rsync[xattr]
202 + sys-apps/iproute2
203 + sys-fs/squashfs-tools
204 + virtual/acl
205 + )
206 +"
207 +
208 +PATCHES=("${FILESDIR}/${P}-dont-go-get.patch")
209 +
210 +# KNOWN ISSUES:
211 +# - Translations may not work. I've been unsuccessful in forcing
212 +# localized output. Anyway, upstream (Canonical) doesn't install the
213 +# message files.
214 +
215 +src_prepare() {
216 + cd "${S}/src/${EGO_PN}" || die "Failed to change to deep src dir"
217 +
218 + default_src_prepare
219 +
220 + tmpgoroot="${T}/goroot"
221 + mkdir -p "$tmpgoroot" || die "Failed to create temporary GOROOT"
222 + cp -sR "$(get_golibdir_gopath)"/* "${tmpgoroot}" || die "Failed to copy files to temporary GOROOT"
223 +
224 + # Warn on unhandled locale changes
225 + l10n_find_plocales_changes po "" .po
226 +}
227 +
228 +src_compile() {
229 + golang-build_src_compile
230 +
231 + cd "${S}/src/${EGO_PN}" || die "Failed to change to deep src dir"
232 +
233 + tmpgoroot="${T}/goroot"
234 + if use daemon; then
235 + # Build binaries
236 + GOPATH="${S}:${tmpgoroot}" emake
237 + else
238 + # build client tool
239 + GOPATH="${S}:${tmpgoroot}" emake client
240 + fi
241 +
242 + use nls && emake build-mo
243 +}
244 +
245 +src_test() {
246 + if use daemon; then
247 + # Go native tests should succeed
248 + golang-build_src_test
249 + fi
250 +}
251 +
252 +src_install() {
253 + # Installs all src,pkg to /usr/lib/go-gentoo
254 + golang-build_src_install
255 +
256 + cd "${S}"
257 + dobin bin/lxc
258 + use daemon && dosbin bin/lxd
259 +
260 + cd "src/${EGO_PN}"
261 +
262 + if use nls; then
263 + for lingua in ${PLOCALES}; do
264 + if use linguas_${lingua}; then
265 + domo po/${lingua}.mo
266 + fi
267 + done
268 + fi
269 +
270 + if use daemon; then
271 + newinitd "${FILESDIR}"/${P}.initd lxd
272 + newconfd "${FILESDIR}"/${P}.confd lxd
273 +
274 + systemd_dounit "${FILESDIR}"/lxd.service
275 + fi
276 +
277 + newbashcomp config/bash/lxd-client lxc
278 +
279 + dodoc AUTHORS CONTRIBUTING.md README.md doc/*
280 +}
281 +
282 +pkg_postinst() {
283 + einfo
284 + einfo "Consult https://wiki.gentoo.org/wiki/LXD for more information,"
285 + einfo "including a Quick Start."
286 +
287 + # The messaging below only applies to daemon installs
288 + use daemon || return 0
289 +
290 + # The control socket will be owned by (and writeable by) this group.
291 + enewgroup lxd
292 +
293 + # Ubuntu also defines an lxd user but it appears unused (the daemon
294 + # must run as root)
295 +
296 + einfo
297 + einfo "Though not strictly required, some features are enabled at run-time"
298 + einfo "when the relevant helper programs are detected:"
299 + einfo "- sys-apps/apparmor"
300 + einfo "- sys-fs/btrfs-progs"
301 + einfo "- sys-fs/lvm2"
302 + einfo "- sys-fs/lxcfs"
303 + einfo "- sys-fs/zfs"
304 + einfo "- sys-process/criu"
305 + einfo
306 + einfo "Since these features can't be disabled at build-time they are"
307 + einfo "not USE-conditional."
308 +}