Gentoo Archives: gentoo-commits

From: Joonas Niilola <juippis@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-containers/lxd/, app-containers/lxd/files/
Date: Tue, 31 Jan 2023 10:45:00
Message-Id: 1675161057.d16b97d50adcc81c90a0035365310594e7b19a1f.juippis@gentoo
1 commit: d16b97d50adcc81c90a0035365310594e7b19a1f
2 Author: Joonas Niilola <juippis <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jan 31 10:30:57 2023 +0000
4 Commit: Joonas Niilola <juippis <AT> gentoo <DOT> org>
5 CommitDate: Tue Jan 31 10:30:57 2023 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d16b97d5
7
8 app-containers/lxd: re-add 4.0.9 to the tree
9
10 - it's needed, and it's only purpose is to provide an update path
11 from lxd-3 to lxd-5. lxd-3 is supported until June 2023.
12
13 Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>
14
15 app-containers/lxd/Manifest | 2 +
16 .../lxd/files/lxd-4.0.9-glibc-2.36-fix.patch | 74 +++++++++
17 app-containers/lxd/lxd-4.0.9-r3.ebuild | 181 +++++++++++++++++++++
18 3 files changed, 257 insertions(+)
19
20 diff --git a/app-containers/lxd/Manifest b/app-containers/lxd/Manifest
21 index 8c94a3ceb31e..fd079b683160 100644
22 --- a/app-containers/lxd/Manifest
23 +++ b/app-containers/lxd/Manifest
24 @@ -1,3 +1,5 @@
25 +DIST lxd-4.0.9.tar.gz 9117078 BLAKE2B aa6689c1e958258484fba5c060765dd71d5406cb4375d3132cdc38633277e6c95322e8e3aed5e9dd251140c6868ec42470e797639dde4af42848e138f3b45ee2 SHA512 657949311753895f3941deaabae2d03092fc67490d2de78db48b296fdd3e9df4c5844467dd6913814426ca423a6ee1da9705bb1a2652ea99fe1356eb7da97ebb
26 +DIST lxd-4.0.9.tar.gz.asc 833 BLAKE2B 7cd0d3ab518d947ca3ea6dc804c6a59b592e4e568152c078fdd3c102420bcd94d2f0b2c335b8b4ecdb19dc3c9a10f665a1510903f395247da956717beaa172a3 SHA512 79a4111571ab43e79cf669e416ed50f3ccae0fbceb86d73757d23c778035e827f47643bc87ff6a2fc64b095345a3d53cbd0c4eb245c75364e907d7449f3a0886
27 DIST lxd-5.0.1.tar.gz 14640923 BLAKE2B 81bdf3301c0eecc719864cd8e18fd886113f83d1980e13ee4d4ccb6641ee4a7e33f0b859a21abd8a0a9956d1c2f3dfa6e7eb1ae454fbb580c23b5558ef51168e SHA512 b04b7329bdeb17ca384cc2d931a1510d5f03521fd247eab93904bbcb6139cc0daf28f9aeb6416268ccf15affdd15b26598f3e280fb5eefe5c59be6918f092bed
28 DIST lxd-5.0.1.tar.gz.asc 833 BLAKE2B d233c8ebfb5b71f66ff08b4d74861a42bf45ef3e9622d4f113603a7a6c1a29b5aa3422c075ad5250a7d5ab7526a49dd676672d0a73194024af477fa762e02b12 SHA512 bf22f26b6688420e843e9e24eb731a2068eae3d90c77787e0f4a279d4cb7a8a2df38b7e9c8ea79f604c1d54743238cb36474baf018ea6bf72e6f37838b252294
29 DIST lxd-5.0.2-move-shellcheck-version-call-into-static-analysis.patch 882 BLAKE2B 4c4cb8b19709939c0c14ed87e5d9c917ac967471400de07c14ea049c0a8aae9a2ed0e3755d554cb1077ee7c607fcdc71431d57a55becd0a46c1f177bc9b33aed SHA512 266788186ca9aabda4ad0fe5fa47ef3acfa31bee64c742c011c58a39f4da833f768e8bb71ec81b57af8d4f124d733f2c22ab33f9ee1bc4ecbd21f5bbbae1f6e7
30
31 diff --git a/app-containers/lxd/files/lxd-4.0.9-glibc-2.36-fix.patch b/app-containers/lxd/files/lxd-4.0.9-glibc-2.36-fix.patch
32 new file mode 100644
33 index 000000000000..d05ff2c81bd9
34 --- /dev/null
35 +++ b/app-containers/lxd/files/lxd-4.0.9-glibc-2.36-fix.patch
36 @@ -0,0 +1,74 @@
37 +From cc7bab602e6b967fdd31c5feed0f3f6321c0a0a7 Mon Sep 17 00:00:00 2001
38 +From: Luca Barbato <lu_zero@g.o>
39 +Date: Fri, 13 Jan 2023 21:43:22 +0000
40 +Subject: [PATCH] Fix syscall wrappers
41 +
42 +---
43 + lxd/include/syscall_wrappers.h | 7 ++++---
44 + lxd/main_nsexec.go | 2 +-
45 + shared/idmap/shift_linux.go | 2 +-
46 + 3 files changed, 6 insertions(+), 5 deletions(-)
47 +
48 +diff --git a/lxd/include/syscall_wrappers.h b/lxd/include/syscall_wrappers.h
49 +index 2c28133a8..a6975ab4d 100644
50 +--- a/lxd/include/syscall_wrappers.h
51 ++++ b/lxd/include/syscall_wrappers.h
52 +@@ -26,10 +26,10 @@ static inline int lxd_close_range(unsigned int fd, unsigned int max_fd, unsigned
53 + return syscall(__NR_close_range, fd, max_fd, flags);
54 + }
55 +
56 +-static inline int open_tree(int dfd, const char *filename, unsigned int flags)
57 ++/* static inline int open_tree(int dfd, const char *filename, unsigned int flags)
58 + {
59 + return syscall(__NR_open_tree, dfd, filename, flags);
60 +-}
61 ++}*/
62 +
63 + /*
64 + * mount_setattr()
65 +@@ -40,7 +40,7 @@ struct lxc_mount_attr {
66 + __u64 propagation;
67 + __u64 userns_fd;
68 + };
69 +-
70 ++/*
71 + static inline int mount_setattr(int dfd, const char *path, unsigned int flags,
72 + struct lxc_mount_attr *attr, size_t size)
73 + {
74 +@@ -53,6 +53,7 @@ static inline int move_mount(int from_dfd, const char *from_pathname, int to_dfd
75 + return syscall(__NR_move_mount, from_dfd, from_pathname, to_dfd,
76 + to_pathname, flags);
77 + }
78 ++*/
79 +
80 + /* arg1 of prctl() */
81 + #ifndef PR_SCHED_CORE
82 +diff --git a/lxd/main_nsexec.go b/lxd/main_nsexec.go
83 +index f11c0d4cb..753024283 100644
84 +--- a/lxd/main_nsexec.go
85 ++++ b/lxd/main_nsexec.go
86 +@@ -298,7 +298,7 @@ static char *file_to_buf(char *path, ssize_t *length)
87 + int mount_detach_idmap(const char *path, int fd_userns)
88 + {
89 + __do_close int fd_tree = -EBADF;
90 +- struct lxc_mount_attr attr = {
91 ++ struct mount_attr attr = {
92 + .attr_set = MOUNT_ATTR_IDMAP,
93 +
94 + };
95 +diff --git a/shared/idmap/shift_linux.go b/shared/idmap/shift_linux.go
96 +index daaf37275..e219ac01c 100644
97 +--- a/shared/idmap/shift_linux.go
98 ++++ b/shared/idmap/shift_linux.go
99 +@@ -314,7 +314,7 @@ static int get_userns_fd(void)
100 + static int create_detached_idmapped_mount(const char *path)
101 + {
102 + __do_close int fd_tree = -EBADF, fd_userns = -EBADF;
103 +- struct lxc_mount_attr attr = {
104 ++ struct mount_attr attr = {
105 + .attr_set = MOUNT_ATTR_IDMAP,
106 + .propagation = MS_SLAVE,
107 +
108 +--
109 +2.39.0
110 +
111
112 diff --git a/app-containers/lxd/lxd-4.0.9-r3.ebuild b/app-containers/lxd/lxd-4.0.9-r3.ebuild
113 new file mode 100644
114 index 000000000000..f8d5b8f837b9
115 --- /dev/null
116 +++ b/app-containers/lxd/lxd-4.0.9-r3.ebuild
117 @@ -0,0 +1,181 @@
118 +# Copyright 1999-2023 Gentoo Authors
119 +# Distributed under the terms of the GNU General Public License v2
120 +
121 +EAPI=7
122 +
123 +inherit bash-completion-r1 go-module linux-info optfeature systemd verify-sig
124 +
125 +DESCRIPTION="Fast, dense and secure container management"
126 +HOMEPAGE="https://linuxcontainers.org/lxd/introduction/ https://github.com/lxc/lxd"
127 +SRC_URI="https://linuxcontainers.org/downloads/lxd/${P}.tar.gz
128 + verify-sig? ( https://linuxcontainers.org/downloads/lxd/${P}.tar.gz.asc )"
129 +
130 +LICENSE="Apache-2.0"
131 +SLOT="0"
132 +KEYWORDS="~amd64 ~arm64 ~x86"
133 +IUSE="apparmor ipv6 nls verify-sig"
134 +
135 +DEPEND="acct-group/lxd
136 + app-arch/xz-utils
137 + >=app-containers/lxc-3.0.0[apparmor?,seccomp(+)]
138 + dev-db/sqlite:3
139 + dev-libs/dqlite
140 + dev-libs/lzo
141 + dev-libs/raft[lz4]
142 + >=dev-util/xdelta-3.0[lzma(+)]
143 + net-dns/dnsmasq[dhcp,ipv6(+)?]
144 + sys-libs/libcap
145 + virtual/udev"
146 +RDEPEND="${DEPEND}
147 + net-firewall/ebtables
148 + net-firewall/iptables[ipv6(+)?]
149 + sys-apps/iproute2[ipv6(+)?]
150 + sys-fs/fuse:*
151 + sys-fs/lxcfs
152 + sys-fs/squashfs-tools[lzma]
153 + virtual/acl"
154 +BDEPEND="dev-lang/go
155 + nls? ( sys-devel/gettext )
156 + verify-sig? ( sec-keys/openpgp-keys-linuxcontainers )"
157 +
158 +CONFIG_CHECK="
159 + ~CGROUPS
160 + ~IPC_NS
161 + ~NET_NS
162 + ~PID_NS
163 +
164 + ~SECCOMP
165 + ~USER_NS
166 + ~UTS_NS
167 +
168 + ~KVM
169 + ~MACVTAP
170 + ~VHOST_VSOCK
171 +"
172 +
173 +ERROR_IPC_NS="CONFIG_IPC_NS is required."
174 +ERROR_NET_NS="CONFIG_NET_NS is required."
175 +ERROR_PID_NS="CONFIG_PID_NS is required."
176 +ERROR_SECCOMP="CONFIG_SECCOMP is required."
177 +ERROR_UTS_NS="CONFIG_UTS_NS is required."
178 +
179 +WARNING_KVM="CONFIG_KVM and CONFIG_KVM_AMD/-INTEL is required for virtual machines."
180 +WARNING_MACVTAP="CONFIG_MACVTAP is required for virtual machines."
181 +WARNING_VHOST_VSOCK="CONFIG_VHOST_VSOCK is required for virtual machines."
182 +
183 +# Go magic.
184 +QA_PREBUILT="/usr/bin/fuidshift
185 + /usr/bin/lxc
186 + /usr/bin/lxc-to-lxd
187 + /usr/bin/lxd-agent
188 + /usr/bin/lxd-benchmark
189 + /usr/bin/lxd-p2c
190 + /usr/sbin/lxd"
191 +
192 +VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/linuxcontainers.asc
193 +
194 +# The testsuite must be run as root.
195 +# make: *** [Makefile:156: check] Error 1
196 +RESTRICT="test"
197 +
198 +GOPATH="${S}/_dist"
199 +
200 +PATCHES=( "${FILESDIR}"/lxd-4.0.9-glibc-2.36-fix.patch )
201 +
202 +src_prepare() {
203 + export GOPATH="${S}/_dist"
204 +
205 + default
206 +
207 + sed -i \
208 + -e "s:\./configure:./configure --prefix=/usr --libdir=${EPREFIX}/usr/lib/lxd:g" \
209 + -e "s:make:make ${MAKEOPTS}:g" \
210 + Makefile || die
211 +
212 + # Fix hardcoded ovmf file path, see bug 763180
213 + sed -i \
214 + -e "s:/usr/share/OVMF:/usr/share/edk2-ovmf:g" \
215 + -e "s:OVMF_VARS.ms.fd:OVMF_VARS.secboot.fd:g" \
216 + doc/environment.md \
217 + lxd/apparmor/instance.go \
218 + lxd/apparmor/instance_qemu.go \
219 + lxd/instance/drivers/driver_qemu.go || die "Failed to fix hardcoded ovmf paths."
220 +
221 + # Fix hardcoded virtfs-proxy-helper file path, see bug 798924
222 + sed -i \
223 + -e "s:/usr/lib/qemu/virtfs-proxy-helper:/usr/libexec/virtfs-proxy-helper:g" \
224 + lxd/device/device_utils_disk.go || die "Failed to fix virtfs-proxy-helper path."
225 +
226 + cp "${FILESDIR}"/lxd-4.0.9-r1.service "${T}"/lxd.service || die
227 + if use apparmor; then
228 + sed -i \
229 + '/^EnvironmentFile=.*/a ExecStartPre=\/usr\/libexec\/lxc\/lxc-apparmor-load' \
230 + "${T}"/lxd.service || die
231 + fi
232 +
233 + # Disable -Werror's from go modules.
234 + find "${S}" -name "cgo.go" -exec sed -i "s/ -Werror / /g" {} + || die
235 +}
236 +
237 +src_configure() { :; }
238 +
239 +src_compile() {
240 + export GOPATH="${S}/_dist"
241 + export CGO_LDFLAGS_ALLOW="-Wl,-z,now"
242 +
243 + for k in fuidshift lxd-benchmark lxc lxc-to-lxd; do
244 + go install -v -x "${S}/${k}" || die "failed compiling ${k}"
245 + done
246 +
247 + go install -v -x -tags libsqlite3 "${S}"/lxd || die "Failed to build the daemon"
248 +
249 + # Needs to be built statically
250 + CGO_ENABLED=0 go install -v -tags netgo "${S}"/lxd-p2c
251 + CGO_ENABLED=0 go install -v -tags agent,netgo "${S}"/lxd-agent
252 +
253 + use nls && emake build-mo
254 +}
255 +
256 +src_test() {
257 + emake check
258 +}
259 +
260 +src_install() {
261 + export GOPATH="${S}/_dist"
262 + local bindir="_dist/bin"
263 +
264 + dosbin ${bindir}/lxd
265 +
266 + for l in fuidshift lxd-agent lxd-benchmark lxd-p2c lxc lxc-to-lxd; do
267 + dobin ${bindir}/${l}
268 + done
269 +
270 + newbashcomp scripts/bash/lxd-client lxc
271 +
272 + newconfd "${FILESDIR}"/lxd-4.0.0.confd lxd
273 + newinitd "${FILESDIR}"/lxd-4.0.9.initd lxd
274 +
275 + systemd_dounit "${T}"/lxd.service
276 + systemd_newunit "${FILESDIR}"/lxd-containers-4.0.0.service lxd-containers.service
277 + systemd_newunit "${FILESDIR}"/lxd-4.0.0.socket lxd.socket
278 +
279 + dodoc AUTHORS doc/*
280 + use nls && domo po/*.mo
281 +}
282 +
283 +pkg_postinst() {
284 + elog
285 + elog "Consult https://wiki.gentoo.org/wiki/LXD for more information,"
286 + elog "including a Quick Start."
287 + elog "For virtual machine support, see:"
288 + elog "https://wiki.gentoo.org/wiki/LXD#Virtual_machines"
289 + elog
290 + elog "Please run 'lxc-checkconfig' to see all optional kernel features."
291 + elog
292 + optfeature "virtual machine support" app-emulation/qemu[spice,usbredir,virtfs]
293 + optfeature "btrfs storage backend" sys-fs/btrfs-progs
294 + optfeature "lvm2 storage backend" sys-fs/lvm2
295 + optfeature "zfs storage backend" sys-fs/zfs
296 + elog
297 + elog "Be sure to add your local user to the lxd group."
298 +}