From 327f06ecdeeac996b0dcaf2d39068d18285cbc57 Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Thu, 3 Apr 2025 15:19:14 +0200 Subject: [PATCH] sys-apps/keyutils: Sync with Gentoo It's from Gentoo commit 0e727a3a16bc2abfd39386f10821d3e5ce89c45a. --- .../sys-apps/keyutils/README.md | 3 - .../keyutils/files/keyutils-1.6.3-tests.patch | 76 +++++++++++++++++++ .../keyutils/files/tmpfiles.d/keyutils.conf | 3 - ...-1.6.3.ebuild => keyutils-1.6.3-r1.ebuild} | 76 +++++++++---------- 4 files changed, 114 insertions(+), 44 deletions(-) delete mode 100644 sdk_container/src/third_party/portage-stable/sys-apps/keyutils/README.md create mode 100644 sdk_container/src/third_party/portage-stable/sys-apps/keyutils/files/keyutils-1.6.3-tests.patch delete mode 100644 sdk_container/src/third_party/portage-stable/sys-apps/keyutils/files/tmpfiles.d/keyutils.conf rename sdk_container/src/third_party/portage-stable/sys-apps/keyutils/{keyutils-1.6.3.ebuild => keyutils-1.6.3-r1.ebuild} (69%) diff --git a/sdk_container/src/third_party/portage-stable/sys-apps/keyutils/README.md b/sdk_container/src/third_party/portage-stable/sys-apps/keyutils/README.md deleted file mode 100644 index 2aab30e620..0000000000 --- a/sdk_container/src/third_party/portage-stable/sys-apps/keyutils/README.md +++ /dev/null @@ -1,3 +0,0 @@ -We keep this package in overlay, because we install the keyutils -config file in /usr instead of /etc, and then establish some symlinks -during installation and with systemd's tmpfiles.d utility. diff --git a/sdk_container/src/third_party/portage-stable/sys-apps/keyutils/files/keyutils-1.6.3-tests.patch b/sdk_container/src/third_party/portage-stable/sys-apps/keyutils/files/keyutils-1.6.3-tests.patch new file mode 100644 index 0000000000..d9414e800a --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/sys-apps/keyutils/files/keyutils-1.6.3-tests.patch @@ -0,0 +1,76 @@ +https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/keyutils.git/commit/?id=c076dff259e99d84d3822b4d2ad7f3f66532f411 + +From c076dff259e99d84d3822b4d2ad7f3f66532f411 Mon Sep 17 00:00:00 2001 +From: Pavel Reichl +Date: Tue, 20 Dec 2022 14:13:29 +0100 +Subject: test: Fix test expectation based on kernel config + +Some test results are dependent on the kernel configuration option +CONFIG_SYSTEM_BLACKLIST_AUTH_UPDATE. + +Check the kernel configuration file for its presence and expect appropriate +test results. + +Function has_kernel_config is based on its xfstsests counterpart. + +Signed-off-by: Pavel Reichl +Signed-off-by: David Howells +--- a/tests/features/builtin_trusted/runtest.sh ++++ b/tests/features/builtin_trusted/runtest.sh +@@ -33,7 +33,11 @@ expect_error EACCES + create_key --fail user a a $stk + expect_error EOPNOTSUPP + create_key --fail user a a $blk +-expect_error EACCES ++if has_kernel_config "CONFIG_SYSTEM_BLACKLIST_AUTH_UPDATE"; then ++ expect_error EOPNOTSUPP ++else ++ expect_error EACCES ++fi + + # Try adding a key to the keyrings + marker "TRY ADDING ASYMMETRIC KEYS" +@@ -89,7 +93,11 @@ expect_error EACCES + create_key --fail -x asymmetric "" "$x509" $stk + expect_error ENOKEY + create_key --fail -x asymmetric "" "$x509" $blk +-expect_error EACCES ++if has_kernel_config "CONFIG_SYSTEM_BLACKLIST_AUTH_UPDATE"; then ++ expect_error EOPNOTSUPP ++else ++ expect_error EACCES ++fi + + echo "++++ FINISHED TEST: $result" >>$OUTPUTFILE + +--- a/tests/prepare.inc.sh ++++ b/tests/prepare.inc.sh +@@ -4,6 +4,26 @@ + includes=${BASH_SOURCE[0]} + includes=${includes%/*}/ + ++# Check if currently running kernel has option set ++function has_kernel_config() ++{ ++ local option=$1 ++ local uname=$(uname -r) ++ local config_list="$KCONFIG_PATH ++ /lib/modules/$uname/build/.config ++ /boot/config-$uname ++ /lib/kernel/config-$uname" ++ ++ for config in $config_list; do ++ [ ! -f $config ] && continue ++ grep -qE "^${option}=[my]" $config ++ return ++ done ++ ++ echo "Failed to find kernel configuration file" ++ return false ++} ++ + # --- need to run in own session keyring + watch_fd=0 + if [ "$1" != "--inside-test-session" ] +-- +cgit 1.2.3-korg diff --git a/sdk_container/src/third_party/portage-stable/sys-apps/keyutils/files/tmpfiles.d/keyutils.conf b/sdk_container/src/third_party/portage-stable/sys-apps/keyutils/files/tmpfiles.d/keyutils.conf deleted file mode 100644 index 4e88f2670a..0000000000 --- a/sdk_container/src/third_party/portage-stable/sys-apps/keyutils/files/tmpfiles.d/keyutils.conf +++ /dev/null @@ -1,3 +0,0 @@ -L /etc/request-key.conf - - - - ../usr/share/keyutils/request-key.conf -d /etc/request-key.d - - - - - -d /etc/keyutils - - - - - diff --git a/sdk_container/src/third_party/portage-stable/sys-apps/keyutils/keyutils-1.6.3.ebuild b/sdk_container/src/third_party/portage-stable/sys-apps/keyutils/keyutils-1.6.3-r1.ebuild similarity index 69% rename from sdk_container/src/third_party/portage-stable/sys-apps/keyutils/keyutils-1.6.3.ebuild rename to sdk_container/src/third_party/portage-stable/sys-apps/keyutils/keyutils-1.6.3-r1.ebuild index e9c4abb077..691b0f34f6 100644 --- a/sdk_container/src/third_party/portage-stable/sys-apps/keyutils/keyutils-1.6.3.ebuild +++ b/sdk_container/src/third_party/portage-stable/sys-apps/keyutils/keyutils-1.6.3-r1.ebuild @@ -1,10 +1,9 @@ -# Copyright 1999-2023 Gentoo Authors +# Copyright 1999-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=7 -TMPFILES_OPTIONAL=1 -inherit toolchain-funcs linux-info multilib-minimal usr-ldscript systemd tmpfiles +inherit toolchain-funcs linux-info multilib-minimal DESCRIPTION="Linux Key Management Utilities" HOMEPAGE="https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/keyutils.git" @@ -12,7 +11,7 @@ SRC_URI="https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/keyutils.git/s LICENSE="GPL-2 LGPL-2.1" SLOT="0/1.9" -KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ppc64 ~riscv ~s390 ~sparc x86 ~amd64-linux ~x86-linux" +KEYWORDS="~alpha amd64 arm arm64 hppa ~loong ~m68k ~mips ~ppc ppc64 ~riscv ~s390 ~sparc x86 ~amd64-linux ~x86-linux" IUSE="static static-libs test" RESTRICT="!test? ( test )" @@ -24,10 +23,9 @@ PATCHES=( "${FILESDIR}"/${PN}-1.5.10-disable-tests.patch #519062 #522050 "${FILESDIR}"/${PN}-1.5.9-header-extern-c.patch "${FILESDIR}"/${PN}-1.6.3-fix-rpmspec-check.patch + "${FILESDIR}"/${P}-tests.patch ) -MAKEOPTS+=" ETCDIR=/usr/share/keyutils" - pkg_setup() { # To prevent a failure in test phase and false positive bug reports # we are enforcing the following options because testsuite expects @@ -72,30 +70,38 @@ src_prepare() { multilib_copy_sources } -multilib_src_compile() { - tc-export AR CC CXX - sed -i \ - -e "1iRPATH = $(usex static -static '')" \ - -e '/^C.*FLAGS/s|:=|+=|' \ - -e 's:-Werror::' \ - -e '/^BUILDFOR/s:=.*:=:' \ - -e "/^LIBDIR/s:=.*:= /usr/$(get_libdir):" \ - -e '/^USRLIBDIR/s:=.*:=$(LIBDIR):' \ - -e "s: /: ${EPREFIX}/:g" \ - -e '/^NO_ARLIB/d' \ - Makefile || die - - # We need the static lib in order to statically link programs. - if use static ; then - export NO_ARLIB=0 - # Hack the progs to depend on the static lib instead. - sed -i \ - -e '/^.*:.*[$](DEVELLIB)$/s:$(DEVELLIB):$(ARLIB) $(SONAME):' \ - Makefile || die - else - export NO_ARLIB=$(usex static-libs 0 1) +mymake() { + local args=( + PREFIX="${EPREFIX}/usr" + ETCDIR="${EPREFIX}/etc" + BINDIR="${EPREFIX}/bin" + SBINDIR="${EPREFIX}/sbin" + SHAREDIR="${EPREFIX}/usr/share/keyutils" + MANDIR="${EPREFIX}/usr/share/man" + INCLUDEDIR="${EPREFIX}/usr/include" + LIBDIR="${EPREFIX}/usr/$(get_libdir)" + USRLIBDIR="${EPREFIX}/usr/$(get_libdir)" + CFLAGS="${CFLAGS}" + CXXFLAGS="${CXXFLAGS}" + RPATH=$(usex static -static '') + BUILDFOR= + NO_ARLIB="${NO_ARLIB}" + ) + if use static; then + args+=( LIB_DEPENDENCY='$(ARLIB)' ) fi - emake + emake "${args[@]}" "$@" +} + +multilib_src_compile() { + local NO_ARLIB + if use static; then + NO_ARLIB=0 + else + NO_ARLIB=$(usex static-libs 0 1) + fi + tc-export AR CC CXX + mymake } multilib_src_test() { @@ -103,19 +109,13 @@ multilib_src_test() { # older versions already installed in the system. LD_LIBRARY_PATH=${BUILD_DIR} \ PATH="${BUILD_DIR}:${PATH}" \ - emake test + mymake test } multilib_src_install() { - dotmpfiles "${FILESDIR}/tmpfiles.d/keyutils.conf" # Possibly undo the setting for USE=static (see src_compile). - export NO_ARLIB=$(usex static-libs 0 1) - - default - use static || gen_usr_ldscript -a keyutils - dosym ../usr/share/keyutils/request-key.conf /etc/request-key.conf - dodir /etc/request-key.d - dodir /etc/keyutils + local NO_ARLIB=$(usex static-libs 0 1) + mymake DESTDIR="${D}" install } multilib_src_install_all() {