From 075fd1f8cabc5879c6eb42127fb84c3058677fde Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sat, 18 May 2024 00:01:42 +0100 Subject: gentoo auto-resync : 18:05:2024 - 00:01:41 --- eclass/Manifest.gz | Bin 39578 -> 39588 bytes eclass/cargo.eclass | 56 ++++++++++++++++++++++++------------------ eclass/linux-info.eclass | 14 ++++++++--- eclass/linux-mod-r1.eclass | 59 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 103 insertions(+), 26 deletions(-) (limited to 'eclass') diff --git a/eclass/Manifest.gz b/eclass/Manifest.gz index 9c620b74027c..c72436512f7f 100644 Binary files a/eclass/Manifest.gz and b/eclass/Manifest.gz differ diff --git a/eclass/cargo.eclass b/eclass/cargo.eclass index 0f2da982f60c..a685cd99fb38 100644 --- a/eclass/cargo.eclass +++ b/eclass/cargo.eclass @@ -329,40 +329,50 @@ _cargo_gen_git_config() { cargo_src_unpack() { debug-print-function ${FUNCNAME} "$@" - mkdir -p "${ECARGO_VENDOR}" || die - mkdir -p "${S}" || die + mkdir -p "${ECARGO_VENDOR}" "${S}" || die local archive shasum pkg + local crates=() for archive in ${A}; do case "${archive}" in *.crate) - # when called by pkgdiff-mg, do not unpack crates - [[ ${PKGBUMPING} == ${PVR} ]] && continue - - ebegin "Loading ${archive} into Cargo registry" - tar -xf "${DISTDIR}"/${archive} -C "${ECARGO_VENDOR}/" || die - # generate sha256sum of the crate itself as cargo needs this - shasum=$(sha256sum "${DISTDIR}"/${archive} | cut -d ' ' -f 1) - pkg=$(basename ${archive} .crate) - cat <<- EOF > ${ECARGO_VENDOR}/${pkg}/.cargo-checksum.json - { - "package": "${shasum}", - "files": {} - } - EOF - # if this is our target package we need it in ${WORKDIR} too - # to make ${S} (and handle any revisions too) - if [[ ${P} == ${pkg}* ]]; then - tar -xf "${DISTDIR}"/${archive} -C "${WORKDIR}" || die - fi - eend $? + crates+=( "${archive}" ) ;; *) - unpack ${archive} + unpack "${archive}" ;; esac done + if [[ ${PKGBUMPING} != ${PVR} && ${crates[@]} ]]; then + pushd "${DISTDIR}" >/dev/null || die + + ebegin "Unpacking crates" + printf '%s\0' "${crates[@]}" | + xargs -0 -P "$(makeopts_jobs)" -n 1 -t -- \ + tar -x -C "${ECARGO_VENDOR}" -f + assert + eend $? + + while read -d '' -r shasum archive; do + pkg=${archive%.crate} + cat <<- EOF > ${ECARGO_VENDOR}/${pkg}/.cargo-checksum.json || die + { + "package": "${shasum}", + "files": {} + } + EOF + + # if this is our target package we need it in ${WORKDIR} too + # to make ${S} (and handle any revisions too) + if [[ ${P} == ${pkg}* ]]; then + tar -xf "${archive}" -C "${WORKDIR}" || die + fi + done < <(sha256sum -z "${crates[@]}" || die) + + popd >/dev/null || die + fi + cargo_gen_config } diff --git a/eclass/linux-info.eclass b/eclass/linux-info.eclass index 864594f607ca..9449a6359d2a 100644 --- a/eclass/linux-info.eclass +++ b/eclass/linux-info.eclass @@ -158,6 +158,14 @@ KERNEL_DIR="${KERNEL_DIR:-${ROOT%/}/usr/src/linux}" # This is a user flag and should under _no circumstances_ be set in the ebuild. : "${SKIP_KERNEL_CHECK:=""}" +# @ECLASS_VARIABLE: SKIP_KERNEL_BINPKG_ENV_RESET +# @DEFAULT_UNSET +# @DESCRIPTION: +# If set, do not reset the kernel environment variables when merging a package +# as a binpkg. +# Main use-case is for kernel modules, i.e. linux-mod-r1.eclass. +# This should be set before running linux-info_pkg_setup + # And to ensure all the weirdness with crosscompile inherit toolchain-funcs [[ ${EAPI} == 6 ]] && inherit eapi7-ver @@ -696,12 +704,12 @@ linux-info_get_any_version() { die "${FUNCNAME}() called on non-Linux system, please fix the ebuild" fi - if [[ ${MERGE_TYPE} == binary && -z ${LINUX_INFO_BINARY_RESET} ]]; then + if [[ ${MERGE_TYPE} == binary && -z ${SKIP_KERNEL_BINPKG_ENV_RESET} ]]; then unset KV_FULL _LINUX_CONFIG_EXISTS_DONE KV_OUT_DIR - LINUX_INFO_BINARY_RESET=1 + SKIP_KERNEL_BINPKG_ENV_RESET=1 fi - if [[ ${MERGE_TYPE} != binary ]] && ! get_version; then + if ! get_version; then ewarn "Unable to calculate Linux Kernel version for build, attempting to use running version" fi diff --git a/eclass/linux-mod-r1.eclass b/eclass/linux-mod-r1.eclass index 4b267aae4db1..6060074d8734 100644 --- a/eclass/linux-mod-r1.eclass +++ b/eclass/linux-mod-r1.eclass @@ -131,6 +131,15 @@ IDEPEND=" sys-apps/kmod[tools] " +if [[ ${MODULES_INITRAMFS_IUSE} ]]; then + IUSE+=" ${MODULES_INITRAMFS_IUSE}" + IDEPEND+=" + ${MODULES_INITRAMFS_IUSE#+}? ( + sys-kernel/installkernel + ) + " +fi + if [[ -n ${MODULES_OPTIONAL_IUSE} ]]; then : "${MODULES_OPTIONAL_IUSE#+}? ( | )" RDEPEND=${_/|/${RDEPEND}} DEPEND=${_/|/${DEPEND}} \ @@ -179,6 +188,22 @@ fi # # May want to look at KERNEL_CHOST before considering this. +# @ECLASS_VARIABLE: MODULES_INITRAMFS_IUSE +# @DEFAULT_UNSET +# @PRE_INHERIT +# @DESCRIPTION: +# If set, adds the specified USE flag. When this flag is enabled the +# installed kernel modules are registered for inclusion in the dracut +# initramfs. Additionally, if distribution kernels are used +# (USE="dist-kernel") then these kernels are re-installed. +# +# The typical recommended value is "initramfs" or "+initramfs" (global +# IUSE). +# +# If MODULES_INITRAMFS_IUSE is not set, or the specified flag is not +# enabled, then the installed kernel modules are omitted from the +# dracut initramfs. + # @ECLASS_VARIABLE: MODULES_SIGN_HASH # @USER_VARIABLE # @DEFAULT_UNSET @@ -471,6 +496,19 @@ linux-mod-r1_pkg_postinst() { dist-kernel_compressed_module_cleanup "${EROOT}/lib/modules/${KV_FULL}" _modules_update_depmod + if [[ -z ${ROOT} && ${MODULES_INITRAMFS_IUSE} ]] && + use dist-kernel && use ${MODULES_INITRAMFS_IUSE#+} + then + dist-kernel_reinstall_initramfs "${KV_DIR}" "${KV_FULL}" + fi + + if has_version virtual/dist-kernel && ! use dist-kernel; then + ewarn "virtual/dist-kernel is installed, but USE=\"dist-kernel\"" + ewarn "is not enabled for ${CATEGORY}/${PN}." + ewarn "It's recommended to globally enable the dist-kernel USE flag" + ewarn "to automatically trigger initramfs rebuilds on kernel updates" + fi + # post_process ensures modules were installed and that the eclass' USE # are likely not no-ops (unfortunately postinst itself may be missed) [[ -v _MODULES_GLOBAL[ran:post_process] ]] || @@ -550,6 +588,7 @@ modules_post_process() { # which can lead to unnecessarily increased size or stale modules) # _modules_process_depmod.d "${mods[@]#"${path}/"}" + _modules_process_dracut.conf.d "${mods[@]##*/}" _modules_process_strip "${mods[@]}" _modules_process_sign "${mods[@]}" _modules_sanity_modversion "${mods[@]}" # after strip/sign in case broke it @@ -622,6 +661,11 @@ _modules_check_migration() { # Handles linux-info bits to provide usable sources, KV_ variables, # and CONFIG_CHECK use. _modules_prepare_kernel() { + # The modules we build are specific to each kernel version, we don't + # want to reset the environment to use the user selected kernel version. + # Bug 931213, 926063 + SKIP_KERNEL_BINPKG_ENV_RESET=1 + get_version # linux-info allows skipping checks if SKIP_KERNEL_CHECK is set and @@ -904,6 +948,21 @@ _modules_process_depmod.d() { ) } +# @FUNCTION: _modules_process_dracut.conf.d +# @USAGE: ... +# @INTERNAL +# @DESCRIPTION: +# Create dracut.conf.d snippet defining if module should be included in the +# initramfs. +_modules_process_dracut.conf.d() { + ( + insinto /usr/lib/dracut/dracut.conf.d + [[ ${MODULES_INITRAMFS_IUSE} ]] && use ${MODULES_INITRAMFS_IUSE#+} && + : add || : omit + newins - 10-${PN}.conf <<<"${_}_drivers+=\" ${*%.ko} \"" + ) +} + # @FUNCTION: _modules_process_sign # @USAGE: ... # @INTERNAL -- cgit v1.2.3