From eb6b84e59fabdec573a61ea845edc144541c6b75 Mon Sep 17 00:00:00 2001 From: David Seifert Date: Tue, 3 Aug 2021 13:27:33 +0200 Subject: sys-fs/udev: enable musl Closes: https://github.com/gentoo/gentoo/pull/21862 Signed-off-by: David Seifert --- sys-fs/udev/Manifest | 1 + sys-fs/udev/files/249-sys-include-posix.patch | 67 +++++++++++++++++++++++++++ sys-fs/udev/udev-249-r2.ebuild | 64 +++++++++++++++++++++++-- 3 files changed, 127 insertions(+), 5 deletions(-) create mode 100644 sys-fs/udev/files/249-sys-include-posix.patch (limited to 'sys-fs') diff --git a/sys-fs/udev/Manifest b/sys-fs/udev/Manifest index f3904e20d039..507013c24e84 100644 --- a/sys-fs/udev/Manifest +++ b/sys-fs/udev/Manifest @@ -1,2 +1,3 @@ DIST systemd-248.tar.gz 10306883 BLAKE2B 3cb25d6101136a5f57e841d3f464f0d7649f6c1cb190b25e4dbf0a8f2be075d04a3cbe92e2fee5bb6a03b73bd8195d8c7b691661b39b7850547d512219cc40af SHA512 486f6ac6c2897a2aac97a59306091a03fd50768340407401e1f088ea5b21c67dae726bff4cbe53cec6b89a8f0ee72205b340165a4fe3a3c16cff6d176506c6e0 DIST systemd-249.tar.gz 10588828 BLAKE2B f7896dea0bdec25125188b94ee84270b972649b1eb16599bed1967ced79f62dbfd1494e22362934f418823c054b342fb24dc57706b49520814beb95b6956bf27 SHA512 0810d09cc32e4aaa4425ee5b7ddf129262b061ce159cbd43571fabda48285243d8f80b566379ece9215d531b9407ee45e1e72c71935644fea31c7bca1bbf540c +DIST systemd-musl-patches-249.1-r0.tar.xz 24276 BLAKE2B ba96bcfb04096d639d7ee028b219bb90648b6aa8aaefe804cd658d3fb8c4f9770b617dc9c5ddfb93e876b739ad927d037c881cbfb19d2db095fa897f3bb83d20 SHA512 9bd7ea515184e44bfa50c9f415200c62f931c657a49cd53a15ee9719991f3773c12ca7162dc12f61a7e67ed791405e879f9b5a13c9fa09fab464be269508f31f diff --git a/sys-fs/udev/files/249-sys-include-posix.patch b/sys-fs/udev/files/249-sys-include-posix.patch new file mode 100644 index 000000000000..6d9e0039b9c9 --- /dev/null +++ b/sys-fs/udev/files/249-sys-include-posix.patch @@ -0,0 +1,67 @@ +Silence annoying #warning's on musl + +https://github.com/systemd/systemd/pull/20362 +https://github.com/systemd/systemd/pull/20364 + +From f8d54f7810aeea5ff27a5db03e1aab7ea54c8268 Mon Sep 17 00:00:00 2001 +From: David Seifert +Date: Mon, 2 Aug 2021 12:41:38 +0200 +Subject: [PATCH] Use correct `` include + +* `` is not specified in POSIX +--- + src/basic/fileio.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/basic/fileio.h b/src/basic/fileio.h +index af797cfafdbf..4295b84a85c5 100644 +--- a/src/basic/fileio.h ++++ b/src/basic/fileio.h +@@ -2,11 +2,11 @@ + #pragma once + + #include ++#include + #include + #include + #include + #include +-#include + #include + + #include "macro.h" +From 2b6c0bb2a341c95223ce672249e43c743b03d78c Mon Sep 17 00:00:00 2001 +From: David Seifert +Date: Mon, 2 Aug 2021 16:09:10 +0200 +Subject: [PATCH] Use correct `` include + +* `` is not specified in POSIX +--- + src/shared/nscd-flush.c | 2 +- + src/shared/varlink.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/shared/nscd-flush.c b/src/shared/nscd-flush.c +index dfc47c423441..19e16d93455c 100644 +--- a/src/shared/nscd-flush.c ++++ b/src/shared/nscd-flush.c +@@ -1,5 +1,5 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ +-#include ++#include + + #include "fd-util.h" + #include "io-util.h" +diff --git a/src/shared/varlink.c b/src/shared/varlink.c +index 3a53c16a7242..4033947d3b8c 100644 +--- a/src/shared/varlink.c ++++ b/src/shared/varlink.c +@@ -1,7 +1,7 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + + #include +-#include ++#include + + #include "alloc-util.h" + #include "errno-util.h" diff --git a/sys-fs/udev/udev-249-r2.ebuild b/sys-fs/udev/udev-249-r2.ebuild index ae3ddedfae41..e2c3e613c5e6 100644 --- a/sys-fs/udev/udev-249-r2.ebuild +++ b/sys-fs/udev/udev-249-r2.ebuild @@ -2,9 +2,9 @@ # Distributed under the terms of the GNU General Public License v2 EAPI=7 -PYTHON_COMPAT=( python3_{7..9} ) +PYTHON_COMPAT=( python3_{8..9} ) -inherit bash-completion-r1 linux-info meson-multilib ninja-utils python-any-r1 toolchain-funcs udev usr-ldscript +inherit bash-completion-r1 flag-o-matic linux-info meson-multilib ninja-utils python-any-r1 toolchain-funcs udev usr-ldscript if [[ ${PV} = 9999* ]] ; then EGIT_REPO_URI="https://github.com/systemd/systemd.git" @@ -22,14 +22,21 @@ else KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86" fi +# musl patches taken from: +# http://cgit.openembedded.org/openembedded-core/tree/meta/recipes-core/systemd/systemd +SRC_URI+=" + elibc_musl? ( + https://dev.gentoo.org/~gyakovlev/distfiles/systemd-musl-patches-${PV}.1-r0.tar.xz + https://dev.gentoo.org/~soap/distfiles/systemd-musl-patches-${PV}.1-r0.tar.xz + )" + DESCRIPTION="Linux dynamic and persistent device naming support (aka userspace devfs)" HOMEPAGE="https://www.freedesktop.org/wiki/Software/systemd" LICENSE="LGPL-2.1 MIT GPL-2" SLOT="0" -IUSE="acl +kmod selinux static-libs" - -RESTRICT="test" +IUSE="acl +kmod selinux static-libs test" +RESTRICT="!test? ( test )" BDEPEND=" dev-util/gperf @@ -42,6 +49,7 @@ BDEPEND=" dev-libs/libxslt ${PYTHON_DEPS} $(python_gen_any_dep 'dev-python/jinja[${PYTHON_USEDEP}]') + test? ( app-text/tree ) " COMMON_DEPEND=" >=sys-apps/util-linux-2.30[${MULTILIB_USEDEP}] @@ -100,8 +108,11 @@ pkg_setup() { src_prepare() { local PATCHES=( + # backport from 250 to silence musl warnings + "${FILESDIR}/249-sys-include-posix.patch" "${FILESDIR}/249-libudev-static.patch" ) + use elibc_musl && PATCHES+=( "${WORKDIR}"/musl-patches ) default } @@ -120,6 +131,7 @@ multilib_src_configure() { # Prevent automagic deps -Dgcrypt=false -Dlibcryptsetup=false + -Didn=false -Dlibidn=false -Dlibidn2=false -Dlibiptc=false @@ -128,6 +140,12 @@ multilib_src_configure() { -Dlz4=false -Dxz=false ) + use elibc_musl && emesonargs+=( + -Dgshadow=false + -Dsmack=false + -Dutmp=false + ) + meson_src_configure } @@ -135,6 +153,9 @@ src_configure() { # Prevent conflicts with i686 cross toolchain, bug 559726 tc-export AR CC NM OBJCOPY RANLIB python_setup + + use elibc_musl && append-cppflags -D__UAPI_DEF_ETHHDR=0 + multilib-minimal_src_configure } @@ -172,6 +193,39 @@ multilib_src_compile() { eninja "${targets[@]}" } +multilib_src_test() { + # The testsuite is *very* finicky. Don't try running it in + # containers or anything but a full VM or on bare metal. + # udev calls 'mknod' a number of times, and this interacts + # badly with kernel namespaces. + + if has userpriv ${FEATURES}; then + ewarn "\'FEATURES=userpriv\' detected" + ewarn "udev tests need to run under uid 0" + ewarn "Skipping tests" + elif has usersandbox ${FEATURES}; then + ewarn "\'FEATURES=usersandbox\' detected" + ewarn "udev tests needs full access to /dev" + ewarn "Skipping tests" + elif has sandbox ${FEATURES}; then + ewarn "\'FEATURES=sandbox\' detected" + ewarn "udev tests needs full access to /dev" + ewarn "Skipping tests" + else + einfo Running tests + + # two binaries required by udev-test.pl + eninja systemd-detect-virt test-udev + local -x PATH="${PWD}:${PATH}" + + # prepare ${BUILD_DIR}/test/sys, required by udev-test.pl + "${EPYTHON}" "${S}"/test/sys-script.py test || die + + # the perl script contains all the udev tests + "${S}"/test/udev-test.pl || die + fi +} + multilib_src_install() { local libudev=$(readlink libudev.so.1) -- cgit v1.2.3-65-gdbad