diff options
author | V3n3RiX <venerix@koprulu.sector> | 2024-07-16 12:27:58 +0100 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2024-07-16 12:27:58 +0100 |
commit | b6fa31c964a602f8461a77d5b83355e8750c12eb (patch) | |
tree | 323fa7af31640b3ea8bb57fa7a927713f3d64769 /eclass | |
parent | 868fd5dc8aab84930cfaa5252b8be06b35552765 (diff) |
gentoo auto-resync : 16:07:2024 - 12:27:58
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/Manifest.gz | bin | 39549 -> 39556 bytes | |||
-rw-r--r-- | eclass/go-env.eclass | 65 | ||||
-rw-r--r-- | eclass/golang-base.eclass | 13 | ||||
-rw-r--r-- | eclass/golang-build.eclass | 6 | ||||
-rw-r--r-- | eclass/golang-vcs-snapshot.eclass | 6 | ||||
-rw-r--r-- | eclass/golang-vcs.eclass | 6 | ||||
-rw-r--r-- | eclass/kernel-build.eclass | 67 | ||||
-rw-r--r-- | eclass/kernel-install.eclass | 100 |
8 files changed, 164 insertions, 99 deletions
diff --git a/eclass/Manifest.gz b/eclass/Manifest.gz Binary files differindex 9e0230d8dc84..0229cf10b1b1 100644 --- a/eclass/Manifest.gz +++ b/eclass/Manifest.gz diff --git a/eclass/go-env.eclass b/eclass/go-env.eclass index 1a2c9787a146..be131133113b 100644 --- a/eclass/go-env.eclass +++ b/eclass/go-env.eclass @@ -6,11 +6,17 @@ # Flatcar Linux Maintainers <infra@flatcar-linux.org> # @AUTHOR: # Flatcar Linux Maintainers <infra@flatcar-linux.org> +# @SUPPORTED_EAPIS: 7 8 # @BLURB: Helper eclass for setting the Go compile environment. Required for cross-compiling. # @DESCRIPTION: # This eclass includes helper functions for setting the compile environment for Go ebuilds. # Intended to be called by other Go eclasses in an early build stage, e.g. src_unpack. +case ${EAPI} in + 7|8) ;; + *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; +esac + if [[ -z ${_GO_ENV_ECLASS} ]]; then _GO_ENV_ECLASS=1 @@ -34,14 +40,7 @@ go-env_set_compile_environment() { use x86 && export GO386=$(go-env_go386) # XXX: Hack for checking ICE (bug #912152, gcc PR113204) - case ${EAPI} in - 6) - has_version "sys-devel/gcc[debug]" && filter-lto - ;; - *) - has_version -b "sys-devel/gcc[debug]" && filter-lto - ;; - esac + has_version -b "sys-devel/gcc[debug]" && filter-lto export CGO_CFLAGS="${CGO_CFLAGS:-$CFLAGS}" export CGO_CPPFLAGS="${CGO_CPPFLAGS:-$CPPFLAGS}" @@ -49,26 +48,46 @@ go-env_set_compile_environment() { export CGO_LDFLAGS="${CGO_LDFLAGS:-$LDFLAGS}" } +# @FUNCTION: go-env_goos +# @USAGE: [toolchain prefix] +# @DESCRIPTION: +# Returns the appropriate GOOS setting for the target operating system. +go-env_goos() { + local target=${1:-${CHOST}} + case "${target}" in + *-linux*) echo linux ;; + *-darwin*) echo darwin ;; + *-freebsd*) echo freebsd ;; + *-netbsd*) echo netbsd ;; + *-openbsd*) echo openbsd ;; + *-solaris*) echo solaris ;; + *-cygwin*|*-interix*|*-winnt*) echo windows ;; + *) die "unknown GOOS for ${target}" ;; + esac +} + # @FUNCTION: go-env_goarch # @USAGE: [toolchain prefix] # @DESCRIPTION: # Returns the appropriate GOARCH setting for the target architecture. go-env_goarch() { - # By chance most portage arch names match Go - local tc_arch=$(tc-arch $@) - case "${tc_arch}" in - x86) echo 386;; - x64-*) echo amd64;; - loong) echo loong64;; - mips) if use abi_mips_o32; then - [[ $(tc-endian $@) = big ]] && echo mips || echo mipsle - elif use abi_mips_n64; then - [[ $(tc-endian $@) = big ]] && echo mips64 || echo mips64le - fi ;; - ppc64) [[ $(tc-endian $@) = big ]] && echo ppc64 || echo ppc64le ;; - riscv) echo riscv64 ;; - s390) echo s390x ;; - *) echo "${tc_arch}";; + local target=${1:-${CHOST}} + # Some Portage arch names match Go. + local arch=$(tc-arch "${target}") cpu=${target%%-*} + case "${arch}" in + x86) echo 386 ;; + loong) echo loong64 ;; + *) case "${cpu}" in + aarch64*be) echo arm64be ;; + arm64) echo arm64 ;; + arm*b*) echo armbe ;; + mips64*l*) echo mips64le ;; + mips*l*) echo mipsle ;; + powerpc64le*) echo ppc64le ;; + arm64|s390x) echo "${cpu}" ;; + mips64*|riscv64*|sparc64*) echo "${arch}64" ;; + *) echo "${arch}" ;; + esac ;; esac } diff --git a/eclass/golang-base.eclass b/eclass/golang-base.eclass index 4bba00200cfc..a2996e3b0683 100644 --- a/eclass/golang-base.eclass +++ b/eclass/golang-base.eclass @@ -1,10 +1,10 @@ -# Copyright 1999-2022 Gentoo Authors +# Copyright 1999-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: golang-base.eclass # @MAINTAINER: # William Hubbs <williamh@gentoo.org> -# @SUPPORTED_EAPIS: 5 6 7 +# @SUPPORTED_EAPIS: 7 # @BLURB: Eclass that provides base functions for Go packages. # @DEPRECATED: go-module.eclass # @DESCRIPTION: @@ -12,12 +12,9 @@ # programming language; it also provides the build-time dependency on # dev-lang/go. -case "${EAPI:-0}" in - 5|6|7) - ;; - *) - die "${ECLASS}: Unsupported EAPI (EAPI=${EAPI})" - ;; +case ${EAPI} in + 7) ;; + *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; esac if [[ -z ${_GOLANG_BASE} ]]; then diff --git a/eclass/golang-build.eclass b/eclass/golang-build.eclass index 235313bd70f5..b5218ce36572 100644 --- a/eclass/golang-build.eclass +++ b/eclass/golang-build.eclass @@ -1,10 +1,10 @@ -# Copyright 1999-2023 Gentoo Authors +# Copyright 1999-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: golang-build.eclass # @MAINTAINER: # William Hubbs <williamh@gentoo.org> -# @SUPPORTED_EAPIS: 6 7 +# @SUPPORTED_EAPIS: 7 # @PROVIDES: golang-base # @BLURB: Eclass for compiling go packages. # @DEPRECATED: go-module.eclass @@ -13,7 +13,7 @@ # functions for software written in the Go programming language. case ${EAPI} in - 6|7) ;; + 7) ;; *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; esac diff --git a/eclass/golang-vcs-snapshot.eclass b/eclass/golang-vcs-snapshot.eclass index d34b8a6e913d..a91ddbbe3615 100644 --- a/eclass/golang-vcs-snapshot.eclass +++ b/eclass/golang-vcs-snapshot.eclass @@ -1,10 +1,10 @@ -# Copyright 1999-2023 Gentoo Authors +# Copyright 1999-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: golang-vcs-snapshot.eclass # @MAINTAINER: # William Hubbs <williamh@gentoo.org> -# @SUPPORTED_EAPIS: 6 7 +# @SUPPORTED_EAPIS: 7 # @PROVIDES: golang-base # @BLURB: eclass to unpack VCS snapshot tarballs for Go software # @DEPRECATED: go-module.eclass @@ -45,7 +45,7 @@ # and add the vendored tarballs to ${WORKDIR}/src/${EGO_PN}/vendor case ${EAPI} in - 6|7) ;; + 7) ;; *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; esac diff --git a/eclass/golang-vcs.eclass b/eclass/golang-vcs.eclass index 6f7a837bc15f..dee040505d23 100644 --- a/eclass/golang-vcs.eclass +++ b/eclass/golang-vcs.eclass @@ -1,10 +1,10 @@ -# Copyright 1999-2023 Gentoo Authors +# Copyright 1999-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: golang-vcs.eclass # @MAINTAINER: # William Hubbs <williamh@gentoo.org> -# @SUPPORTED_EAPIS: 6 7 +# @SUPPORTED_EAPIS: 7 # @PROVIDES: golang-base # @BLURB: Eclass for fetching and unpacking go repositories. # @DEPRECATED: go-module.eclass @@ -13,7 +13,7 @@ # of software written in the Go programming language. case ${EAPI} in - 6|7) ;; + 7) ;; *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; esac diff --git a/eclass/kernel-build.eclass b/eclass/kernel-build.eclass index 1f0b07fdc3f9..d8e50e75812f 100644 --- a/eclass/kernel-build.eclass +++ b/eclass/kernel-build.eclass @@ -20,6 +20,14 @@ # the kernel and installing it along with its modules and subset # of sources needed to build external modules. +# @ECLASS_VARIABLE: KV_FULL +# @DEFAULT_UNSET +# @DESCRIPTION: +# A string containing the full kernel release version, e.g. +# '6.9.6-gentoo-dist'. This is used to ensure consistency between the +# kernel's release version and Gentoo's tooling. This is set by +# kernel-build_src_configure() once we have a kernel.release file. + case ${EAPI} in 8) ;; *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; @@ -225,6 +233,33 @@ kernel-build_src_configure() { emake O="${WORKDIR}"/modprep "${MAKEARGS[@]}" olddefconfig emake O="${WORKDIR}"/modprep "${MAKEARGS[@]}" modules_prepare cp -pR "${WORKDIR}"/modprep "${WORKDIR}"/build || die + + # Now that we have a release file, set KV_FULL + local relfile=${WORKDIR}/build/include/config/kernel.release + if [[ -z ${KV_FULL} ]]; then + KV_FULL=$(<"${relfile}") || die + fi + + # Make sure we are about to build the correct kernel + if [[ ${PV} != *9999 ]]; then + local expected_ver=$(dist-kernel_PV_to_KV "${PV}") + local expected_rel=$(<"${relfile}") + + if [[ ${KV_FULL} != ${expected_rel} ]]; then + eerror "KV_FULL mismatch!" + eerror "KV_FULL: ${KV_FULL}" + eerror "Expected: ${expected_rel}" + die "KV_FULL mismatch: got ${KV_FULL}, expected ${expected_rel}" + fi + + if [[ ${KV_FULL} != ${expected_ver}* ]]; then + eerror "Kernel version does not match PV!" + eerror "Source version: ${KV_FULL}" + eerror "Expected (PV*): ${expected_ver}*" + eerror "Please ensure you are applying the correct patchset." + die "Kernel version mismatch: got ${KV_FULL}, expected ${expected_ver}*" + fi + fi } # @FUNCTION: kernel-build_src_compile @@ -254,20 +289,15 @@ kernel-build_src_test() { INSTALL_MOD_PATH="${T}" INSTALL_MOD_STRIP="${strip_args}" \ modules_install - local dir_ver=${PV}${KV_LOCALVERSION} - local relfile=${WORKDIR}/build/include/config/kernel.release - local module_ver - module_ver=$(<"${relfile}") || die - - kernel-install_test "${module_ver}" \ + kernel-install_test "${KV_FULL}" \ "${WORKDIR}/build/$(dist-kernel_get_image_path)" \ - "${T}/lib/modules/${module_ver}" + "${T}/lib/modules/${KV_FULL}" } # @FUNCTION: kernel-build_src_install # @DESCRIPTION: # Install the built kernel along with subset of sources -# into /usr/src/linux-${PV}. Install the modules. Save the config. +# into /usr/src/linux-${KV_FULL}. Install the modules. Save the config. kernel-build_src_install() { debug-print-function ${FUNCNAME} "${@}" @@ -304,8 +334,7 @@ kernel-build_src_install() { # note: we're using mv rather than doins to save space and time # install main and arch-specific headers first, and scripts local kern_arch=$(tc-arch-kernel) - local dir_ver=${PV}${KV_LOCALVERSION} - local kernel_dir=/usr/src/linux-${dir_ver} + local kernel_dir=/usr/src/linux-${KV_FULL} if use sparc ; then # We don't want tc-arch-kernel's sparc64, even though we do @@ -378,10 +407,6 @@ kernel-build_src_install() { # strip empty directories find "${D}" -type d -empty -exec rmdir {} + || die - local relfile=${ED}${kernel_dir}/include/config/kernel.release - local module_ver - module_ver=$(<"${relfile}") || die - # warn when trying to "make" a dist-kernel cat <<-EOF >> "${ED}${kernel_dir}/Makefile" || die @@ -399,12 +424,12 @@ kernel-build_src_install() { echo "${CATEGORY}/${PF}:${SLOT}" > "${ED}${kernel_dir}/dist-kernel" || die # fix source tree and build dir symlinks - dosym "../../../${kernel_dir}" "/lib/modules/${module_ver}/build" - dosym "../../../${kernel_dir}" "/lib/modules/${module_ver}/source" + dosym "../../../${kernel_dir}" "/lib/modules/${KV_FULL}/build" + dosym "../../../${kernel_dir}" "/lib/modules/${KV_FULL}/source" if [[ "${image_path}" == *vmlinux* ]]; then - dosym "../../../${kernel_dir}/${image_path}" "/lib/modules/${module_ver}/vmlinux" + dosym "../../../${kernel_dir}/${image_path}" "/lib/modules/${KV_FULL}/vmlinux" else - dosym "../../../${kernel_dir}/${image_path}" "/lib/modules/${module_ver}/vmlinuz" + dosym "../../../${kernel_dir}/${image_path}" "/lib/modules/${KV_FULL}/vmlinuz" fi if [[ ${KERNEL_IUSE_MODULES_SIGN} ]]; then @@ -435,7 +460,7 @@ kernel-build_src_install() { --conf "${T}/empty-file" --confdir "${T}/empty-directory" --kernel-image "${image}" - --kmoddir "${ED}/lib/modules/${dir_ver}" + --kmoddir "${ED}/lib/modules/${KV_FULL}" --kver "${dir_ver}" --verbose --compress="xz -9e --check=crc32" @@ -462,7 +487,7 @@ kernel-build_src_install() { --linux="${image}" --initrd="${image%/*}/initrd" --cmdline="${KERNEL_GENERIC_UKI_CMDLINE}" - --uname="${dir_ver}" + --uname="${KV_FULL}" --output="${image%/*}/uki.efi" ) @@ -520,7 +545,7 @@ kernel-build_pkg_postinst() { ewarn ewarn "MODULES_SIGN_KEY was not set, this means the kernel build system" ewarn "automatically generated the signing key. This key was installed" - ewarn "in ${EROOT}/usr/src/linux-${PV}${KV_LOCALVERSION}/certs" + ewarn "in ${EROOT}/usr/src/linux-${KV_FULL}/certs" ewarn "and will also be included in any binary packages." ewarn "Please take appropriate action to protect the key!" ewarn diff --git a/eclass/kernel-install.eclass b/eclass/kernel-install.eclass index 77570a905ce1..e6f0b404dcaa 100644 --- a/eclass/kernel-install.eclass +++ b/eclass/kernel-install.eclass @@ -26,6 +26,15 @@ # If set to a non-null value, adds IUSE=generic-uki and required # logic to install a generic unified kernel image. +# @ECLASS_VARIABLE: KV_FULL +# @DEFAULT_UNSET +# @DESCRIPTION: +# A string containing the full kernel release version, e.g. +# '6.9.6-gentoo-dist'. Defaults to ${PV}${KV_LOCALVERSION}, +# but can be set by the ebuild when this default value does +# not match the kernel release. kernel-build.eclass sets this +# to whatever is in the built kernel's kernel.release file. + # @ECLASS_VARIABLE: KV_LOCALVERSION # @DEFAULT_UNSET # @DESCRIPTION: @@ -63,7 +72,10 @@ _IDEPEND_BASE=" >=sys-kernel/installkernel-14 ) initramfs? ( - >=sys-kernel/installkernel-14[dracut(-)] + || ( + >=sys-kernel/installkernel-14[dracut(-)] + >=sys-kernel/installkernel-14[ugrd(-)] + ) ) " @@ -190,7 +202,7 @@ if [[ ${KERNEL_IUSE_GENERIC_UKI} ]]; then " IDEPEND=" generic-uki? ( - >=sys-kernel/installkernel-14[-dracut(-),-ukify(-)] + >=sys-kernel/installkernel-14[-dracut(-),-ugrd(-),-ukify(-)] ) !generic-uki? ( ${_IDEPEND_BASE} @@ -543,16 +555,26 @@ kernel-install_pkg_pretend() { if ! use initramfs && ! has_version "${CATEGORY}/${PN}[-initramfs]"; then ewarn - ewarn "WARNING: The standard configuration of the Gentoo distribution" - ewarn "kernels requires an initramfs! You have disabled the initramfs" - ewarn "USE flag and as a result dracut was not pulled in as a dependency." - ewarn "Please ensure that you are either overriding the standard" - ewarn "configuration or that an alternative initramfs generation plugin" - ewarn "is installed for your installkernel implementation!" - ewarn - ewarn "This is an advanced use case, you are on your own to ensure" - ewarn "that your system is bootable!" + ewarn "WARNING: The default distribution kernel configuration is designed" + ewarn "to be used with an initramfs! Although possible, there is no guarantee" + ewarn "that distribution kernels will boot without an initramfs." ewarn + ewarn "You have disabled the initramfs USE flag, and as a result the package manager" + ewarn "will not enforce the configuration of an initramfs generator in" + ewarn "sys-kernel/installkernel." + ewarn + ewarn "If you wish to use a custom initramfs generator, then please ensure that" + ewarn "/sbin/installkernel is capable of calling it via a kernel installation hook," + ewarn "and is also configured to use it via /etc/kernel/install.conf." + ewarn + ewarn "If you wish to boot without an initramfs, then please ensure that" + ewarn "all kernel drivers required to boot your system are built into the" + ewarn "kernel by modifying the default distribution kernel configuration" + ewarn "using /etc/kernel/config.d" + ewarn + ewarn "Please refer to the installkernel and distribution kernel documentation:" + ewarn " https://wiki.gentoo.org/wiki/Installkernel" + ewarn " https://wiki.gentoo.org/wiki/Project:Distribution_Kernel" fi } @@ -571,40 +593,40 @@ kernel-install_src_test() { kernel-install_pkg_preinst() { debug-print-function ${FUNCNAME} "${@}" - local dir_ver=${PV}${KV_LOCALVERSION} - local kernel_dir=${ED}/usr/src/linux-${dir_ver} - local relfile=${kernel_dir}/include/config/kernel.release + # Set KV_FULL to ${PV}${KV_LOCALVERSION} if it hasn't + # been set elsewhere for backward compatibility with existing + # bin-kernel packages + if [[ -z ${KV_FULL} ]]; then + KV_FULL=${PV}${KV_LOCALVERSION} + fi + + local kernel_dir=${ED}/usr/src/linux-${KV_FULL} local image_path=$(dist-kernel_get_image_path) [[ ! -d ${kernel_dir} ]] && die "Kernel directory ${kernel_dir} not installed!" - [[ ! -f ${relfile} ]] && - 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 local expected_ver=$(dist-kernel_PV_to_KV "${PV}") - if [[ ${release} != ${expected_ver}* ]]; then - eerror "Kernel release mismatch!" - eerror " expected (PV): ${expected_ver}*" - eerror " found: ${release}" - eerror "Please verify that you are applying the correct patches." - die "Kernel release mismatch (${release} instead of ${expected_ver}*)" + if [[ ${KV_FULL} != ${expected_ver}* ]]; then + eerror "Kernel version does not match PV!" + eerror "Source version: ${KV_FULL}" + eerror "Expected (PV*): ${expected_ver}*" + eerror "Please ensure you are applying the correct patchset." + die "Kernel version mismatch: got ${KV_FULL}, expected ${expected_ver}*" fi fi if [[ -L ${EROOT}/lib && ${EROOT}/lib -ef ${EROOT}/usr/lib ]]; then # Adjust symlinks for merged-usr. - rm "${ED}/lib/modules/${release}"/{build,source} || die - dosym "../../../src/linux-${dir_ver}" "/usr/lib/modules/${release}/build" - dosym "../../../src/linux-${dir_ver}" "/usr/lib/modules/${release}/source" + rm "${ED}/lib/modules/${KV_FULL}"/{build,source} || die + dosym "../../../src/linux-${KV_FULL}" "/usr/lib/modules/${KV_FULL}/build" + dosym "../../../src/linux-${KV_FULL}" "/usr/lib/modules/${KV_FULL}/source" for file in vmlinux vmlinuz; do - if [[ -L "${ED}/lib/modules/${release}/${file}" ]]; then - rm "${ED}/lib/modules/${release}/${file}" || die - dosym "../../../src/linux-${dir_ver}/${image_path}" "/usr/lib/modules/${release}/${file}" + if [[ -L "${ED}/lib/modules/${KV_FULL}/${file}" ]]; then + rm "${ED}/lib/modules/${KV_FULL}/${file}" || die + dosym "../../../src/linux-${KV_FULL}/${image_path}" "/usr/lib/modules/${KV_FULL}/${file}" fi done fi @@ -678,13 +700,12 @@ kernel-install_install_all() { kernel-install_pkg_postinst() { debug-print-function ${FUNCNAME} "${@}" - local dir_ver=${PV}${KV_LOCALVERSION} - kernel-install_update_symlink "${EROOT}/usr/src/linux" "${dir_ver}" + kernel-install_update_symlink "${EROOT}/usr/src/linux" "${KV_FULL}" dist-kernel_compressed_module_cleanup \ - "${EROOT}/lib/modules/${DIST_KERNEL_RELEASE}" + "${EROOT}/lib/modules/${KV_FULL}" if [[ -z ${ROOT} ]]; then - kernel-install_install_all "${dir_ver}" + kernel-install_install_all "${KV_FULL}" fi if [[ ${KERNEL_IUSE_GENERIC_UKI} ]] && use generic-uki; then @@ -708,8 +729,7 @@ kernel-install_pkg_postrm() { debug-print-function ${FUNCNAME} "${@}" if [[ -z ${ROOT} && ! ${KERNEL_IUSE_GENERIC_UKI} ]]; then - local dir_ver=${PV}${KV_LOCALVERSION} - local kernel_dir=${EROOT}/usr/src/linux-${dir_ver} + local kernel_dir=${EROOT}/usr/src/linux-${KV_FULL} local image_path=$(dist-kernel_get_image_path) ebegin "Removing initramfs" rm -f "${kernel_dir}/${image_path%/*}"/{initrd,uki.efi} && @@ -724,7 +744,11 @@ kernel-install_pkg_postrm() { kernel-install_pkg_config() { [[ -z ${ROOT} ]] || die "ROOT!=/ not supported currently" - kernel-install_install_all "${PV}${KV_LOCALVERSION}" + if [[ -z ${KV_FULL} ]]; then + KV_FULL=${PV}${KV_LOCALVERSION} + fi + + kernel-install_install_all "${KV_FULL}" } # @FUNCTION: kernel-install_compress_modules |