Gentoo Archives: gentoo-commits

From: Mike Gilbert <floppym@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-apps/systemd-utils/
Date: Sat, 03 Sep 2022 23:33:37
Message-Id: 1662247754.b89bf7e58b5123ae528650a9ea8ef103367d2737.floppym@gentoo
1 commit: b89bf7e58b5123ae528650a9ea8ef103367d2737
2 Author: Mike Gilbert <floppym <AT> gentoo <DOT> org>
3 AuthorDate: Sat Sep 3 23:29:14 2022 +0000
4 Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org>
5 CommitDate: Sat Sep 3 23:29:14 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b89bf7e5
7
8 sys-apps/systemd-utils: wire up 'split-usr' USE flag
9
10 Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>
11
12 .../systemd-utils/systemd-utils-251.4-r1.ebuild | 521 +++++++++++++++++++++
13 1 file changed, 521 insertions(+)
14
15 diff --git a/sys-apps/systemd-utils/systemd-utils-251.4-r1.ebuild b/sys-apps/systemd-utils/systemd-utils-251.4-r1.ebuild
16 new file mode 100644
17 index 000000000000..4bd77d7b1486
18 --- /dev/null
19 +++ b/sys-apps/systemd-utils/systemd-utils-251.4-r1.ebuild
20 @@ -0,0 +1,521 @@
21 +# Copyright 2022 Gentoo Authors
22 +# Distributed under the terms of the GNU General Public License v2
23 +
24 +EAPI=8
25 +PYTHON_COMPAT=( python3_{8..11} )
26 +
27 +QA_PKGCONFIG_VERSION=$(ver_cut 1)
28 +
29 +inherit bash-completion-r1 flag-o-matic meson-multilib python-any-r1 toolchain-funcs udev usr-ldscript
30 +
31 +DESCRIPTION="Utilities split out from systemd for OpenRC users"
32 +HOMEPAGE="https://systemd.io/"
33 +
34 +if [[ ${PV} == *.* ]]; then
35 + MY_P="systemd-stable-${PV}"
36 + S="${WORKDIR}/${MY_P}"
37 + SRC_URI="https://github.com/systemd/systemd-stable/archive/refs/tags/v${PV}.tar.gz -> ${MY_P}.tar.gz"
38 +else
39 + MY_P="systemd-${PV}"
40 + S="${WORKDIR}/${MY_P}"
41 + SRC_URI="https://github.com/systemd/systemd/archive/refs/tags/v${PV}.tar.gz -> ${MY_P}.tar.gz"
42 +fi
43 +
44 +MUSL_PATCHSET="systemd-musl-patches-251.2"
45 +SRC_URI+=" elibc_musl? ( https://dev.gentoo.org/~floppym/dist/${MUSL_PATCHSET}.tar.gz )"
46 +
47 +LICENSE="GPL-2 LGPL-2.1 MIT public-domain"
48 +SLOT="0"
49 +#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
50 +IUSE="+acl boot +kmod selinux split-usr sysusers +tmpfiles test +udev"
51 +REQUIRED_USE="|| ( boot tmpfiles sysusers udev )"
52 +RESTRICT="!test? ( test )"
53 +
54 +COMMON_DEPEND="
55 + elibc_musl? ( >=sys-libs/musl-1.2.3 )
56 + selinux? ( sys-libs/libselinux:0= )
57 + tmpfiles? (
58 + acl? ( sys-apps/acl:0= )
59 + )
60 + udev? (
61 + >=sys-apps/util-linux-2.30:0=[${MULTILIB_USEDEP}]
62 + sys-libs/libcap:0=[${MULTILIB_USEDEP}]
63 + virtual/libcrypt:=[${MULTILIB_USEDEP}]
64 + acl? ( sys-apps/acl:0= )
65 + kmod? ( >=sys-apps/kmod-15:0= )
66 + )
67 + !udev? (
68 + >=sys-apps/util-linux-2.30:0=
69 + sys-libs/libcap:0=
70 + virtual/libcrypt:=
71 + )
72 +"
73 +DEPEND="${COMMON_DEPEND}
74 + >=sys-kernel/linux-headers-3.11
75 + boot? ( >=sys-boot/gnu-efi-3.0.2 )
76 +"
77 +RDEPEND="${COMMON_DEPEND}
78 + boot? ( !<sys-boot/systemd-boot-250 )
79 + tmpfiles? ( !<sys-apps/systemd-tmpfiles-250 )
80 + udev? (
81 + acct-group/audio
82 + acct-group/cdrom
83 + acct-group/dialout
84 + acct-group/disk
85 + acct-group/input
86 + acct-group/kmem
87 + acct-group/kvm
88 + acct-group/lp
89 + acct-group/render
90 + acct-group/sgx
91 + acct-group/tape
92 + acct-group/tty
93 + acct-group/video
94 + !sys-apps/gentoo-systemd-integration
95 + !sys-apps/hwids[udev]
96 + !<sys-fs/udev-250
97 + !sys-fs/eudev
98 + )
99 + !sys-apps/systemd
100 +"
101 +PDEPEND="
102 + udev? ( >=sys-fs/udev-init-scripts-34 )
103 +"
104 +BDEPEND="
105 + $(python_gen_any_dep 'dev-python/jinja[${PYTHON_USEDEP}]')
106 + app-text/docbook-xml-dtd:4.2
107 + app-text/docbook-xml-dtd:4.5
108 + app-text/docbook-xsl-stylesheets
109 + dev-libs/libxslt
110 + dev-util/gperf
111 + >=sys-apps/coreutils-8.16
112 + sys-devel/gettext
113 + virtual/pkgconfig
114 +"
115 +
116 +TMPFILES_OPTIONAL=1
117 +UDEV_OPTIONAL=1
118 +
119 +python_check_deps() {
120 + python_has_version "dev-python/jinja[${PYTHON_USEDEP}]"
121 +}
122 +
123 +QA_EXECSTACK="usr/lib/systemd/boot/efi/*"
124 +QA_FLAGS_IGNORED="usr/lib/systemd/boot/efi/.*"
125 +
126 +src_prepare() {
127 + local PATCHES=(
128 + )
129 +
130 + if use elibc_musl; then
131 + PATCHES+=( "${WORKDIR}/${MUSL_PATCHSET}" )
132 + # Applied upstream in 251.3
133 + rm "${WORKDIR}/${MUSL_PATCHSET}/0001-Add-sys-file.h-for-LOCK_.patch" || die
134 + fi
135 + default
136 +
137 + # Remove install_rpath; we link statically
138 + local rpath_pattern="install_rpath : rootlibexecdir,"
139 + grep -q -e "${rpath_pattern}" meson.build || die
140 + sed -i -e "/${rpath_pattern}/d" meson.build || die
141 +}
142 +
143 +multilib_src_configure() {
144 + # When bumping to 251, please keep this, but add the revert patch
145 + # like in sys-apps/systemd!
146 + #
147 + # Broken with FORTIFY_SOURCE=3 without a patch. And the patch
148 + # wasn't backported to 250.x, but it turns out to break Clang
149 + # anyway: bug #841770.
150 + #
151 + # Our toolchain sets F_S=2 by default w/ >= -O2, so we need
152 + # to unset F_S first, then explicitly set 2, to negate any default
153 + # and anything set by the user if they're choosing 3 (or if they've
154 + # modified GCC to set 3).
155 + #
156 + if is-flagq '-O[23]' || is-flagq '-Ofast' ; then
157 + # We can't unconditionally do this b/c we fortify needs
158 + # some level of optimisation.
159 + filter-flags -D_FORTIFY_SOURCE=3
160 + append-cppflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
161 + fi
162 +
163 + local emesonargs=(
164 + $(meson_use split-usr)
165 + $(meson_use split-usr split-bin)
166 + -Drootprefix="$(usex split-usr "${EPREFIX:-/}" "${EPREFIX}/usr")"
167 + -Drootlibdir="${EPREFIX}/usr/$(get_libdir)"
168 + -Dsysvinit-path=
169 + $(meson_native_use_bool boot efi)
170 + $(meson_native_use_bool boot gnu-efi)
171 + $(meson_native_use_bool boot kernel-install)
172 + $(meson_native_use_bool selinux)
173 + $(meson_native_use_bool sysusers)
174 + $(meson_use test tests)
175 + $(meson_native_use_bool tmpfiles)
176 + $(meson_use udev hwdb)
177 +
178 + -Defi-libdir="${ESYSROOT}/usr/$(get_libdir)"
179 +
180 + # Link staticly with libsystemd-shared
181 + -Dlink-boot-shared=false
182 + -Dlink-udev-shared=false
183 +
184 + # systemd-tmpfiles has a separate "systemd-tmpfiles.standalone" target
185 + -Dstandalone-binaries=true
186 +
187 + # Disable all optional features
188 + -Dadm-group=false
189 + -Danalyze=false
190 + -Dapparmor=false
191 + -Daudit=false
192 + -Dbacklight=false
193 + -Dbinfmt=false
194 + -Dbzip2=false
195 + -Dcoredump=false
196 + -Ddbus=false
197 + -Delfutils=false
198 + -Denvironment-d=false
199 + -Dfdisk=false
200 + -Dgcrypt=false
201 + -Dglib=false
202 + -Dgshadow=false
203 + -Dgnutls=false
204 + -Dhibernate=false
205 + -Dhostnamed=false
206 + -Didn=false
207 + -Dima=false
208 + -Dinitrd=false
209 + -Dfirstboot=false
210 + -Dldconfig=false
211 + -Dlibcryptsetup=false
212 + -Dlibcurl=false
213 + -Dlibfido2=false
214 + -Dlibidn=false
215 + -Dlibidn2=false
216 + -Dlibiptc=false
217 + -Dlocaled=false
218 + -Dlogind=false
219 + -Dlz4=false
220 + -Dmachined=false
221 + -Dmicrohttpd=false
222 + -Dnetworkd=false
223 + -Dnscd=false
224 + -Dnss-myhostname=false
225 + -Dnss-resolve=false
226 + -Dnss-systemd=false
227 + -Doomd=false
228 + -Dopenssl=false
229 + -Dp11kit=false
230 + -Dpam=false
231 + -Dpcre2=false
232 + -Dpolkit=false
233 + -Dportabled=false
234 + -Dpstore=false
235 + -Dpwquality=false
236 + -Drandomseed=false
237 + -Dresolve=false
238 + -Drfkill=false
239 + -Dseccomp=false
240 + -Dsmack=false
241 + -Dsysext=false
242 + -Dtimedated=false
243 + -Dtimesyncd=false
244 + -Dtpm=false
245 + -Dqrencode=false
246 + -Dquotacheck=false
247 + -Duserdb=false
248 + -Dutmp=false
249 + -Dvconsole=false
250 + -Dwheel-group=false
251 + -Dxdg-autostart=false
252 + -Dxkbcommon=false
253 + -Dxz=false
254 + -Dzlib=false
255 + -Dzstd=false
256 + )
257 +
258 + if use tmpfiles || use udev; then
259 + emesonargs+=( $(meson_native_use_bool acl) )
260 + else
261 + emesonargs+=( -Dacl=false )
262 + fi
263 +
264 + if use udev; then
265 + emesonargs+=( $(meson_native_use_bool kmod) )
266 + else
267 + emesonargs+=( -Dkmod=false )
268 + fi
269 +
270 + if use elibc_musl; then
271 + # Avoid redefinition of struct ethhdr.
272 + append-cppflags -D__UAPI_DEF_ETHHDR=0
273 + fi
274 +
275 + if multilib_is_native_abi || use udev; then
276 + meson_src_configure
277 + fi
278 +}
279 +
280 +efi_arch() {
281 + case "$(tc-arch)" in
282 + amd64) echo x64 ;;
283 + arm) echo arm ;;
284 + arm64) echo aa64 ;;
285 + x86) echo x86 ;;
286 + esac
287 +}
288 +
289 +multilib_src_compile() {
290 + local targets=()
291 + if multilib_is_native_abi; then
292 + if use boot; then
293 + targets+=(
294 + bootctl
295 + kernel-install
296 + man/bootctl.1
297 + man/kernel-install.8
298 + src/boot/efi/linux$(efi_arch).{efi,elf}.stub
299 + src/boot/efi/systemd-boot$(efi_arch).efi
300 + )
301 + fi
302 + if use sysusers; then
303 + targets+=(
304 + systemd-sysusers.standalone
305 + man/sysusers.d.5
306 + man/systemd-sysusers.8
307 + )
308 + if use test; then
309 + targets+=(
310 + systemd-runtest.env
311 + )
312 + fi
313 + fi
314 + if use tmpfiles; then
315 + targets+=(
316 + systemd-tmpfiles.standalone
317 + man/tmpfiles.d.5
318 + man/systemd-tmpfiles.8
319 + )
320 + if use test; then
321 + targets+=( test-tmpfiles )
322 + fi
323 + fi
324 + if use udev; then
325 + targets+=(
326 + udevadm
327 + systemd-hwdb
328 + src/udev/ata_id
329 + src/udev/cdrom_id
330 + src/udev/fido_id
331 + src/udev/mtd_probe
332 + src/udev/scsi_id
333 + src/udev/udev.pc
334 + src/udev/v4l_id
335 + man/udev.conf.5
336 + man/systemd.link.5
337 + man/hwdb.7
338 + man/udev.7
339 + man/systemd-hwdb.8
340 + man/systemd-udevd.service.8
341 + man/udevadm.8
342 + hwdb.d/60-autosuspend-chromiumos.hwdb
343 + rules.d/50-udev-default.rules
344 + rules.d/64-btrfs.rules
345 + )
346 + if use test; then
347 + targets+=(
348 + # Used by udev-test.pl
349 + systemd-detect-virt
350 + test/sys
351 + test-udev
352 +
353 + test-fido-id-desc
354 + test-udev-builtin
355 + test-udev-event
356 + test-udev-netlink
357 + test-udev-node
358 + test-udev-util
359 + )
360 + fi
361 + fi
362 + fi
363 + if use udev; then
364 + targets+=(
365 + udev:shared_library
366 + src/libudev/libudev.pc
367 + )
368 + if use test; then
369 + targets+=(
370 + test-libudev
371 + test-libudev-sym
372 + test-udev-device-thread
373 + )
374 + fi
375 + fi
376 + if multilib_is_native_abi || use udev; then
377 + meson_src_compile "${targets[@]}"
378 + fi
379 +}
380 +
381 +multilib_src_test() {
382 + local tests=()
383 + if multilib_is_native_abi; then
384 + if use sysusers; then
385 + tests+=(
386 + test-sysusers.standalone
387 + )
388 + fi
389 + if use tmpfiles; then
390 + tests+=(
391 + test-systemd-tmpfiles.standalone
392 + test-tmpfiles
393 + )
394 + fi
395 + if use udev; then
396 + tests+=(
397 + rule-syntax-check
398 + test-fido-id-desc
399 + test-udev-builtin
400 + test-udev-event
401 + test-udev-netlink
402 + test-udev-node
403 + test-udev-util
404 + )
405 + if [[ -w /dev ]]; then
406 + tests+=( udev-test )
407 + else
408 + ewarn "Skipping udev-test (needs write access to /dev)"
409 + fi
410 + fi
411 + fi
412 + if use udev; then
413 + tests+=(
414 + test-libudev
415 + test-libudev-sym
416 + test-udev-device-thread
417 + )
418 + fi
419 + if [[ ${#tests[@]} -ne 0 ]]; then
420 + meson_src_test "${tests[@]}"
421 + fi
422 +}
423 +
424 +src_install() {
425 + local rootprefix="$(usex split-usr '' /usr)"
426 + meson-multilib_src_install
427 +}
428 +
429 +multilib_src_install() {
430 + if multilib_is_native_abi; then
431 + if use boot; then
432 + into /usr
433 + dobin bootctl kernel-install
434 + doman man/{bootctl.1,kernel-install.8}
435 + insinto usr/lib/systemd/boot/efi
436 + doins src/boot/efi/{linux$(efi_arch).{efi,elf}.stub,systemd-boot$(efi_arch).efi}
437 + fi
438 + if use sysusers; then
439 + into "${rootprefix:-/}"
440 + newbin systemd-sysusers{.standalone,}
441 + doman man/{systemd-sysusers.8,sysusers.d.5}
442 + fi
443 + if use tmpfiles; then
444 + into "${rootprefix:-/}"
445 + newbin systemd-tmpfiles{.standalone,}
446 + doman man/{systemd-tmpfiles.8,tmpfiles.d.5}
447 + fi
448 + if use udev; then
449 + into "${rootprefix:-/}"
450 + dobin udevadm systemd-hwdb
451 + dosym ../../bin/udevadm "${rootprefix}"/lib/systemd/systemd-udevd
452 +
453 + exeinto "${rootprefix}"/lib/udev
454 + doexe src/udev/{ata_id,cdrom_id,fido_id,mtd_probe,scsi_id,v4l_id}
455 +
456 + insinto "${rootprefix}"/lib/udev/rules.d
457 + doins rules.d/*.rules
458 +
459 + insinto "${rootprefix}"/lib/udev/hwdb.d
460 + doins hwdb.d/*.hwdb
461 +
462 + insinto /usr/share/pkgconfig
463 + doins src/udev/udev.pc
464 +
465 + doman man/{udev.conf.5,systemd.link.5,hwdb.7,systemd-hwdb.8,udev.7,udevadm.8}
466 + newman man/systemd-udevd.service.8 systemd-udevd.8
467 + fi
468 + fi
469 + if use udev; then
470 + meson_install --no-rebuild --tags libudev
471 + gen_usr_ldscript -a udev
472 + insinto "/usr/$(get_libdir)/pkgconfig"
473 + doins src/libudev/libudev.pc
474 + fi
475 +}
476 +
477 +multilib_src_install_all() {
478 + einstalldocs
479 + if use boot; then
480 + into /usr
481 + exeinto usr/lib/kernel/install.d
482 + doexe src/kernel-install/*.install
483 + dobashcomp shell-completion/bash/bootctl
484 + insinto /usr/share/zsh/site-functions
485 + doins shell-completion/zsh/{_bootctl,_kernel-install}
486 + fi
487 + if use tmpfiles; then
488 + doinitd "${FILESDIR}"/systemd-tmpfiles-setup
489 + doinitd "${FILESDIR}"/systemd-tmpfiles-setup-dev
490 + insinto /usr/share/zsh/site-functions
491 + doins shell-completion/zsh/_systemd-tmpfiles
492 + fi
493 + if use udev; then
494 + doheader src/libudev/libudev.h
495 +
496 + insinto /etc/udev
497 + doins src/udev/udev.conf
498 + keepdir /etc/udev/{hwdb.d,rules.d}
499 +
500 + insinto "${rootprefix}"/lib/systemd/network
501 + doins network/99-default.link
502 +
503 + # Remove to avoid conflict with elogind
504 + # https://bugs.gentoo.org/856433
505 + rm rules.d/70-power-switch.rules || die
506 + insinto /lib/udev/rules.d
507 + doins rules.d/*.rules
508 + doins "${FILESDIR}"/40-gentoo.rules
509 +
510 + insinto /lib/udev/hwdb.d
511 + doins hwdb.d/*.hwdb
512 +
513 + dobashcomp shell-completion/bash/udevadm
514 +
515 + insinto /usr/share/zsh/site-functions
516 + doins shell-completion/zsh/_udevadm
517 + fi
518 +}
519 +
520 +add_service() {
521 + local initd=$1
522 + local runlevel=$2
523 +
524 + ebegin "Adding '${initd}' service to the '${runlevel}' runlevel"
525 + mkdir -p "${EROOT}/etc/runlevels/${runlevel}" &&
526 + ln -snf "${EPREFIX}/etc/init.d/${initd}" "${EROOT}/etc/runlevels/${runlevel}/${initd}"
527 + eend $?
528 +}
529 +
530 +pkg_postinst() {
531 + if [[ -z ${REPLACING_VERSIONS} ]]; then
532 + add_service systemd-tmpfiles-setup-dev sysinit
533 + add_service systemd-tmpfiles-setup boot
534 + fi
535 + if use udev; then
536 + ebegin "Updating hwdb"
537 + systemd-hwdb --root="${ROOT}" update
538 + eend $?
539 + udev_reload
540 + fi
541 +}