From 35e3ee5faf74dc69409f957f81a6848d4d24c49f Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sat, 30 Dec 2023 17:41:14 +0000 Subject: gentoo auto-resync : 30:12:2023 - 17:41:14 --- eclass/Manifest.gz | Bin 38929 -> 38938 bytes eclass/dist-kernel-utils.eclass | 37 +++++++++++++++++++++++++++++++++++++ eclass/kernel-build.eclass | 4 ++-- eclass/kernel-install.eclass | 9 ++++++--- eclass/linux-mod-r1.eclass | 17 ++++++++++------- eclass/linux-mod.eclass | 4 +++- eclass/ssl-cert.eclass | 19 ++++--------------- 7 files changed, 62 insertions(+), 28 deletions(-) (limited to 'eclass') diff --git a/eclass/Manifest.gz b/eclass/Manifest.gz index 50cb3c4bc73b..eca06882e3df 100644 Binary files a/eclass/Manifest.gz and b/eclass/Manifest.gz differ diff --git a/eclass/dist-kernel-utils.eclass b/eclass/dist-kernel-utils.eclass index 67cb802151b2..8ccffd038474 100644 --- a/eclass/dist-kernel-utils.eclass +++ b/eclass/dist-kernel-utils.eclass @@ -210,5 +210,42 @@ dist-kernel_PV_to_KV() { echo "${kv}" } +# @FUNCTION: dist-kernel_compressed_module_cleanup +# @USAGE: +# @DESCRIPTION: +# Traverse path for duplicate (un)compressed modules and remove all +# but the newest variant. +dist-kernel_compressed_module_cleanup() { + debug-print-function ${FUNCNAME} "${@}" + + [[ ${#} -ne 1 ]] && die "${FUNCNAME}: invalid arguments" + local path=${1} + local basename f + + while read -r basename; do + local prev= + for f in "${path}/${basename}"{,.gz,.xz,.zst}; do + if [[ ! -e ${f} ]]; then + continue + elif [[ -z ${prev} ]]; then + prev=${f} + elif [[ ${f} -nt ${prev} ]]; then + rm -v "${prev}" || die + prev=${f} + else + rm -v "${f}" || die + fi + done + done < <( + cd "${path}" && + find -type f \ + \( -name '*.ko' \ + -o -name '*.ko.gz' \ + -o -name '*.ko.xz' \ + -o -name '*.ko.zst' \ + \) | sed -e 's:[.]\(gz\|xz\|zst\)$::' | sort | uniq -d || die + ) +} + _DIST_KERNEL_UTILS=1 fi diff --git a/eclass/kernel-build.eclass b/eclass/kernel-build.eclass index 29ee9f86e7e2..28f111ec998b 100644 --- a/eclass/kernel-build.eclass +++ b/eclass/kernel-build.eclass @@ -284,7 +284,7 @@ kernel-build_src_install() { dostrip -x /lib/modules local compress=() - if [[ ${KERNEL_IUSE_GENERIC_UKI} ]] && ! use module-compress; then + if [[ ${KERNEL_IUSE_GENERIC_UKI} ]] && ! use modules-compress; then compress+=( # force installing uncompressed modules even if compression # is enabled via config @@ -560,7 +560,7 @@ kernel-build_merge_configs() { # Only semi-related but let's use that to avoid changing stable ebuilds. if [[ ${KERNEL_IUSE_GENERIC_UKI} ]]; then - # NB: we enable this even with USE=-module-compress, in order + # NB: we enable this even with USE=-modules-compress, in order # to support both uncompressed and compressed modules in prebuilt # kernels cat <<-EOF > "${WORKDIR}/module-compress.config" || die diff --git a/eclass/kernel-install.eclass b/eclass/kernel-install.eclass index 8c4d5c14fc03..b4c3d5fe7b4d 100644 --- a/eclass/kernel-install.eclass +++ b/eclass/kernel-install.eclass @@ -79,7 +79,7 @@ _IDEPEND_BASE=" LICENSE="GPL-2" if [[ ${KERNEL_IUSE_GENERIC_UKI} ]]; then - IUSE+=" generic-uki module-compress" + IUSE+=" generic-uki modules-compress" # https://github.com/AndrewAmmerlaan/dist-kernel-log-to-licenses # This script can help with generating the array below, keep in mind # that it is not a fully automatic solution, i.e. use flags will @@ -592,6 +592,7 @@ kernel-install_pkg_preinst() { die "Release file ${relfile} not installed!" local release release="$(<"${relfile}")" || die + DIST_KERNEL_RELEASE="${release}" # perform the version check for release ebuilds only if [[ ${PV} != *9999 ]]; then @@ -706,6 +707,8 @@ kernel-install_pkg_postinst() { local dir_ver=${PV}${KV_LOCALVERSION} kernel-install_update_symlink "${EROOT}/usr/src/linux" "${dir_ver}" + dist-kernel_compressed_module_cleanup \ + "${EROOT}/lib/modules/${DIST_KERNEL_RELEASE}" if [[ -z ${ROOT} ]]; then kernel-install_install_all "${dir_ver}" @@ -762,11 +765,11 @@ kernel-install_pkg_config() { # @FUNCTION: kernel-install_compress_modules # @DESCRIPTION: -# Compress modules installed in ED, if USE=module-compress is enabled. +# Compress modules installed in ED, if USE=modules-compress is enabled. kernel-install_compress_modules() { debug-print-function ${FUNCNAME} "${@}" - if use module-compress; then + if use modules-compress; then einfo "Compressing kernel modules ..." # taken from scripts/Makefile.modinst find "${ED}/lib" -name '*.ko' -exec \ diff --git a/eclass/linux-mod-r1.eclass b/eclass/linux-mod-r1.eclass index 44fc927c3a70..67a4b64eb481 100644 --- a/eclass/linux-mod-r1.eclass +++ b/eclass/linux-mod-r1.eclass @@ -109,9 +109,9 @@ esac if [[ ! ${_LINUX_MOD_R1_ECLASS} ]]; then _LINUX_MOD_R1_ECLASS=1 -inherit edo linux-info multiprocessing toolchain-funcs +inherit dist-kernel-utils edo linux-info multiprocessing toolchain-funcs -IUSE="dist-kernel modules-sign +strip ${MODULES_OPTIONAL_IUSE}" +IUSE="dist-kernel modules-compress modules-sign +strip ${MODULES_OPTIONAL_IUSE}" RDEPEND=" sys-apps/kmod[tools] @@ -468,6 +468,7 @@ linux-mod-r1_pkg_postinst() { debug-print-function ${FUNCNAME[0]} "${@}" _modules_check_function ${#} 0 0 || return 0 + dist-kernel_compressed_module_cleanup "${EROOT}/lib/modules/${KV_FULL}" _modules_update_depmod # post_process ensures modules were installed and that the eclass' USE @@ -835,6 +836,8 @@ _modules_prepare_toolchain() { # If enabled in the kernel configuration, this compresses the given # modules using the same format. _modules_process_compress() { + use modules-compress || return + local -a compress if linux_chkconfig_present MODULE_COMPRESS_XZ; then compress=( @@ -853,13 +856,13 @@ _modules_process_compress() { fi elif linux_chkconfig_present MODULE_COMPRESS_ZSTD; then compress=(zstd -qT"$(makeopts_jobs)" --rm) + else + die "USE=modules-compress enabled but no MODULE_COMPRESS* configured" fi - if [[ -v compress ]]; then - # could fail, assumes have commands that were needed for the kernel - einfo "Compressing modules (matching the kernel configuration) ..." - edob "${compress[@]}" -- "${@}" - fi + # could fail, assumes have commands that were needed for the kernel + einfo "Compressing modules (matching the kernel configuration) ..." + edob "${compress[@]}" -- "${@}" } # @FUNCTION: _modules_process_depmod.d diff --git a/eclass/linux-mod.eclass b/eclass/linux-mod.eclass index 26d8cac47ef0..c71ace53aa00 100644 --- a/eclass/linux-mod.eclass +++ b/eclass/linux-mod.eclass @@ -689,7 +689,9 @@ linux-mod_src_install() { # and similarly compress the module being built if != NONE. if linux_chkconfig_present MODULE_COMPRESS_XZ; then - xz -T$(makeopts_jobs) --memlimit-compress=50% -q ${modulename}.${KV_OBJ} || die "Compressing ${modulename}.${KV_OBJ} with xz failed" + # match kernel compression options for compatibility + # https://bugs.gentoo.org/920837 + xz -T$(makeopts_jobs) --memlimit-compress=50% -q --check=crc32 --lzma2=dict=1MiB ${modulename}.${KV_OBJ} || die "Compressing ${modulename}.${KV_OBJ} with xz failed" doins ${modulename}.${KV_OBJ}.xz KV_OBJ_COMPRESS_EXT=".xz" elif linux_chkconfig_present MODULE_COMPRESS_GZIP; then diff --git a/eclass/ssl-cert.eclass b/eclass/ssl-cert.eclass index 0453f0fbf665..240f9f12cc91 100644 --- a/eclass/ssl-cert.eclass +++ b/eclass/ssl-cert.eclass @@ -6,7 +6,7 @@ # maintainer-needed@gentoo.org # @AUTHOR: # Max Kalika -# @SUPPORTED_EAPIS: 6 7 8 +# @SUPPORTED_EAPIS: 7 8 # @BLURB: Eclass for SSL certificates # @DESCRIPTION: # This eclass implements a standard installation procedure for installing @@ -15,7 +15,7 @@ # "install_cert /foo/bar" installs ${ROOT}/foo/bar.{key,csr,crt,pem} case ${EAPI} in - 6|7|8) ;; + 7|8) ;; *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; esac @@ -42,22 +42,11 @@ _SSL_CERT_ECLASS=1 if [[ "${SSL_DEPS_SKIP}" == "0" ]]; then if [[ "${SSL_CERT_MANDATORY}" == "0" ]]; then - SSL_DEPEND="${SSL_CERT_USE}? ( dev-libs/openssl:0 )" + BDEPEND="${SSL_CERT_USE}? ( dev-libs/openssl )" IUSE="${SSL_CERT_USE}" else - SSL_DEPEND="dev-libs/openssl:0" + BDEPEND="dev-libs/openssl" fi - - case "${EAPI}" in - 6) - DEPEND="${SSL_DEPEND}" - ;; - *) - BDEPEND="${SSL_DEPEND}" - ;; - esac - - unset SSL_DEPEND fi # @FUNCTION: gen_cnf -- cgit v1.2.3