diff --git a/sdk_container/src/third_party/portage-stable/eclass/kernel-2.eclass b/sdk_container/src/third_party/portage-stable/eclass/kernel-2.eclass index 6d5dcca6e3..873d4a2046 100644 --- a/sdk_container/src/third_party/portage-stable/eclass/kernel-2.eclass +++ b/sdk_container/src/third_party/portage-stable/eclass/kernel-2.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2021 Gentoo Authors +# Copyright 1999-2022 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: kernel-2.eclass @@ -8,7 +8,7 @@ # John Mylchreest # Mike Pagano # -# @SUPPORTED_EAPIS: 6 7 8 +# @SUPPORTED_EAPIS: 7 8 # @BLURB: Eclass for kernel packages # @DESCRIPTION: # This is the kernel.eclass rewrite for a clean base regarding the 2.6 @@ -17,40 +17,144 @@ # added functionality: # unipatch - a flexible, singular method to extract, add and remove patches. -# @ECLASS-VARIABLE: K_USEPV +# @ECLASS_VARIABLE: CTARGET +# @INTERNAL +# @DESCRIPTION: +# Utilized for 32-bit userland on ppc64. + +# @ECLASS_VARIABLE: CKV # @DEFAULT_UNSET # @DESCRIPTION: -# When setting the EXTRAVERSION variable, it should -# add PV to the end. -# this is useful for things like wolk. IE: -# EXTRAVERSION would be something like : -wolk-4.19-r1 +# Used as a comparison kernel version, which is used when +# PV doesnt reflect the genuine kernel version. +# This gets set to the portage style versioning. ie: +# CKV=2.6.11_rc4 -# @ECLASS-VARIABLE: K_NODRYRUN +# @ECLASS_VARIABLE: EXTRAVERSION +# @DEFAULT_UNSET +# @DESCRIPTION: +# The additional version appended to OKV (-gentoo/-gentoo-r1) + +# @ECLASS_VARIABLE: H_SUPPORTEDARCH +# @DEFAULT_UNSET +# @DESCRIPTION: +# this should be a space separated list of ARCH's which +# can be supported by the headers ebuild + +# @ECLASS_VARIABLE: K_BASE_VER +# @DEFAULT_UNSET +# @DESCRIPTION: +# for git-sources, declare the base version this patch is +# based off of. + +# @ECLASS_VARIABLE: K_DEBLOB_AVAILABLE +# @DEFAULT_UNSET +# @DESCRIPTION: +# A value of "0" will disable all of the optional deblob +# code. If empty, will be set to "1" if deblobbing is +# possible. Test ONLY for "1". + +# @ECLASS_VARIABLE: K_DEBLOB_TAG +# @DEFAULT_UNSET +# @DESCRIPTION: +# This will be the version of deblob script. It's a upstream SVN tag +# such asw -gnu or -gnu1. + +# @ECLASS_VARIABLE: K_DEFCONFIG +# @DEFAULT_UNSET +# @DESCRIPTION: +# Allow specifying a different defconfig target. +# If length zero, defaults to "defconfig". + +# @ECLASS_VARIABLE: K_EXP_GENPATCHES_PULL +# @DEFAULT_UNSET +# @DESCRIPTION: +# If set, we pull "experimental" regardless of the USE FLAG +# but expect the ebuild maintainer to use K_EXP_GENPATCHES_LIST. + +# @ECLASS_VARIABLE: K_EXP_GENPATCHES_NOUSE +# @DEFAULT_UNSET +# @DESCRIPTION: +# If set, no USE flag will be provided for "experimental"; +# as a result the user cannot choose to apply those patches. + +# @ECLASS_VARIABLE: K_EXP_GENPATCHES_LIST +# @DEFAULT_UNSET +# @DESCRIPTION: +# A list of patches to pick from "experimental" to apply when +# the USE flag is unset and K_EXP_GENPATCHES_PULL is set. + +# @ECLASS_VARIABLE: K_EXTRAEINFO +# @DEFAULT_UNSET +# @DESCRIPTION: +# this is a new-line seperated list of einfo displays in +# postinst and can be used to carry additional postinst +# messages + +# @ECLASS_VARIABLE: K_EXTRAELOG +# @DEFAULT_UNSET +# @DESCRIPTION: +# same as K_EXTRAEINFO except using elog instead of einfo + +# @ECLASS_VARIABLE: K_EXTRAEWARN +# @DEFAULT_UNSET +# @DESCRIPTION: +# same as K_EXTRAEINFO except using ewarn instead of einfo + +# @ECLASS_VARIABLE: K_FROM_GIT +# @DEFAULT_UNSET +# @DESCRIPTION: +# If set, this variable signals that the kernel sources derives +# from a git tree and special handling will be applied so that +# any patches that are applied will actually apply. + +# @ECLASS_VARIABLE: K_GENPATCHES_VER +# @DEFAULT_UNSET +# @DESCRIPTION: +# The version of the genpatches tarball(s) to apply. +# A value of "5" would apply genpatches-2.6.12-5 to +# my-sources-2.6.12.ebuild + +# @ECLASS_VARIABLE: K_LONGTERM +# @DEFAULT_UNSET +# @DESCRIPTION: +# If set, the eclass will search for the kernel source +# in the long term directories on the upstream servers +# as the location has been changed by upstream + +# @ECLASS_VARIABLE: K_NODRYRUN # @DEFAULT_UNSET # @DESCRIPTION: # if this is set then patch --dry-run will not # be run. Certain patches will fail with this parameter # See bug #507656 -# @ECLASS-VARIABLE: K_NOSETEXTRAVERSION +# @ECLASS_VARIABLE: K_NOSETEXTRAVERSION # @DEFAULT_UNSET # @DESCRIPTION: # if this is set then EXTRAVERSION will not be # automatically set within the kernel Makefile -# @ECLASS-VARIABLE: K_NOUSENAME +# @ECLASS_VARIABLE: K_NOUSENAME # @DEFAULT_UNSET # @DESCRIPTION: # if this is set then EXTRAVERSION will not include the # first part of ${PN} in EXTRAVERSION -# @ECLASS-VARIABLE: K_NOUSEPR +# @ECLASS_VARIABLE: K_NOUSEPR # @DEFAULT_UNSET # @DESCRIPTION: # if this is set then EXTRAVERSION will not include the # anything based on ${PR}. -# @ECLASS-VARIABLE: K_PREPATCHED +# @ECLASS_VARIABLE: K_PREDEBLOBBED +# @DEFAULT_UNSET +# @DESCRIPTION: +# This kernel was already deblobbed elsewhere. +# If false, either optional deblobbing will be available +# or the license will note the inclusion of linux-firmware code. + +# @ECLASS_VARIABLE: K_PREPATCHED # @DEFAULT_UNSET # @DESCRIPTION: # if the patchset is prepatched (ie: pf-sources, @@ -58,123 +162,93 @@ # patchset version for and not use it as a true package # revision -# @ECLASS-VARIABLE: K_EXTRAEINFO -# @DEFAULT_UNSET -# @DESCRIPTION: -# this is a new-line seperated list of einfo displays in -# postinst and can be used to carry additional postinst -# messages - -# @ECLASS-VARIABLE: K_EXTRAELOG -# @DEFAULT_UNSET -# @DESCRIPTION: -# same as K_EXTRAEINFO except using elog instead of einfo - -# @ECLASS-VARIABLE: K_EXTRAEWARN -# @DEFAULT_UNSET -# @DESCRIPTION: -# same as K_EXTRAEINFO except using ewarn instead of einfo - -# @ECLASS-VARIABLE: K_SYMLINK -# @DEFAULT_UNSET -# @DESCRIPTION: -# if this is set, then forcably create symlink anyway - -# @ECLASS-VARIABLE: K_BASE_VER -# @DEFAULT_UNSET -# @DESCRIPTION: -# for git-sources, declare the base version this patch is -# based off of. - -# @ECLASS-VARIABLE: K_DEFCONFIG -# @DEFAULT_UNSET -# @DESCRIPTION: -# Allow specifying a different defconfig target. -# If length zero, defaults to "defconfig". - -# @ECLASS-VARIABLE: K_WANT_GENPATCHES -# @DEFAULT_UNSET -# @DESCRIPTION: -# Apply genpatches to kernel source. Provide any -# combination of "base", "extras" or "experimental". - -# @ECLASS-VARIABLE: K_EXP_GENPATCHES_PULL -# @DEFAULT_UNSET -# @DESCRIPTION: -# If set, we pull "experimental" regardless of the USE FLAG -# but expect the ebuild maintainer to use K_EXP_GENPATCHES_LIST. - -# @ECLASS-VARIABLE: K_EXP_GENPATCHES_NOUSE -# @DEFAULT_UNSET -# @DESCRIPTION: -# If set, no USE flag will be provided for "experimental"; -# as a result the user cannot choose to apply those patches. - -# @ECLASS-VARIABLE: K_EXP_GENPATCHES_LIST -# @DEFAULT_UNSET -# @DESCRIPTION: -# A list of patches to pick from "experimental" to apply when -# the USE flag is unset and K_EXP_GENPATCHES_PULL is set. - -# @ECLASS-VARIABLE: K_FROM_GIT -# @DEFAULT_UNSET -# @DESCRIPTION: -# If set, this variable signals that the kernel sources derives -# from a git tree and special handling will be applied so that -# any patches that are applied will actually apply. - -# @ECLASS-VARIABLE: K_GENPATCHES_VER -# @DEFAULT_UNSET -# @DESCRIPTION: -# The version of the genpatches tarball(s) to apply. -# A value of "5" would apply genpatches-2.6.12-5 to -# my-sources-2.6.12.ebuild - -# @ECLASS-VARIABLE: K_SECURITY_UNSUPPORTED +# @ECLASS_VARIABLE: K_SECURITY_UNSUPPORTED # @DEFAULT_UNSET # @DESCRIPTION: # If set, this kernel is unsupported by Gentoo Security # to the current eclass maintainer :) -# @ECLASS-VARIABLE: K_DEBLOB_AVAILABLE +# @ECLASS_VARIABLE: K_SYMLINK # @DEFAULT_UNSET # @DESCRIPTION: -# A value of "0" will disable all of the optional deblob -# code. If empty, will be set to "1" if deblobbing is -# possible. Test ONLY for "1". +# if this is set, then forcably create symlink anyway -# @ECLASS-VARIABLE: K_DEBLOB_TAG +# @ECLASS_VARIABLE: K_USEPV # @DEFAULT_UNSET # @DESCRIPTION: -# This will be the version of deblob script. It's a upstream SVN tag -# such asw -gnu or -gnu1. +# When setting the EXTRAVERSION variable, it should +# add PV to the end. +# this is useful for things like wolk. IE: +# EXTRAVERSION would be something like : -wolk-4.19-r1 -# @ECLASS-VARIABLE: K_PREDEBLOBBED +# @ECLASS_VARIABLE: K_WANT_GENPATCHES # @DEFAULT_UNSET # @DESCRIPTION: -# This kernel was already deblobbed elsewhere. -# If false, either optional deblobbing will be available -# or the license will note the inclusion of linux-firmware code. +# Apply genpatches to kernel source. Provide any +# combination of "base", "extras" or "experimental". -# @ECLASS-VARIABLE: K_LONGTERM +# @ECLASS_VARIABLE: KERNEL_URI # @DEFAULT_UNSET # @DESCRIPTION: -# If set, the eclass will search for the kernel source -# in the long term directories on the upstream servers -# as the location has been changed by upstream +# Upstream kernel src URI -# @ECLASS-VARIABLE: H_SUPPORTEDARCH +# @ECLASS_VARIABLE: KV +# @DEFAULT_UNSET +# @OUTPUT_VARIABLE +# @DESCRIPTION: +# Kernel Version (2.6.0-gentoo/2.6.0-test11-gentoo-r1) + +# @ECLASS_VARIABLE: KV_FULL +# @DEFAULT_UNSET +# @OUTPUT_VARIABLE +# @DESCRIPTION: +# Kernel full version + +# @ECLASS_VARIABLE: KV_MAJOR +# @DEFAULT_UNSET +# @OUTPUT_VARIABLE +# @DESCRIPTION: +# Kernel major version from ....../dev/null; then xmakeopts="${xmakeopts} CROSS_COMPILE=${CHOST}-" fi - xmakeopts="${xmakeopts} HOSTCC=$(tc-getBUILD_CC)" + xmakeopts="${xmakeopts} HOSTCC=$(tc-getBUILD_CC) CC=$(tc-getCC) LD=$(tc-getLD) AR=$(tc-getAR) NM=$(tc-getNM) OBJCOPY=$(tc-getOBJCOPY) READELF=$(tc-getREADELF) STRIP=$(tc-getSTRIP)" export xmakeopts } @@ -780,10 +850,10 @@ install_headers() { local ddir=$(kernel_header_destdir) env_setup_xmakeopts - emake headers_install INSTALL_HDR_PATH="${ED%/}"${ddir}/.. ${xmakeopts} + emake headers_install INSTALL_HDR_PATH="${ED}"${ddir}/.. ${xmakeopts} # let other packages install some of these headers - rm -rf "${ED%/}"${ddir}/scsi || die #glibc/uclibc/etc... + rm -rf "${ED}"${ddir}/scsi || die #glibc/uclibc/etc... return 0 } @@ -810,7 +880,7 @@ install_sources() { done fi - mv "${WORKDIR}"/linux* "${ED%/}"/usr/src || die + mv "${WORKDIR}"/linux* "${ED}"/usr/src || die if [[ -n ${UNIPATCH_DOCS} ]]; then for i in ${UNIPATCH_DOCS}; do @@ -850,15 +920,15 @@ postinst_sources() { # if we are to forcably symlink, delete it if it already exists first. if [[ ${K_SYMLINK} -gt 0 ]]; then - if [[ -e ${EROOT%/}/usr/src/linux && ! -L ${EROOT%/}/usr/src/linux ]] ; then - die "${EROOT%/}/usr/src/linux exist and is not a symlink" + if [[ -e ${EROOT}/usr/src/linux && ! -L ${EROOT}/usr/src/linux ]] ; then + die "${EROOT}/usr/src/linux exists and is not a symlink" fi - ln -snf linux-${KV_FULL} "${EROOT%/}"/usr/src/linux || die + ln -snf linux-${KV_FULL} "${EROOT}"/usr/src/linux || die fi # Don't forget to make directory for sysfs - [[ ! -d ${EROOT%/}/sys ]] && kernel_is 2 6 && { mkdir "${EROOT%/}"/sys || die ; } + [[ ! -d ${EROOT}/sys ]] && kernel_is 2 6 && { mkdir "${EROOT}"/sys || die ; } elog "If you are upgrading from a previous kernel, you may be interested" elog "in the following document:" @@ -994,7 +1064,7 @@ unipatch() { extention=${extention/:*/} PIPE_CMD="" case ${extention} in - xz) PIPE_CMD="xz -dc";; + xz) PIPE_CMD="xz -T$(makeopts_jobs) -dc";; lzma) PIPE_CMD="lzma -dc";; bz2) PIPE_CMD="bzip2 -dc";; patch*) PIPE_CMD="cat";; @@ -1074,7 +1144,7 @@ unipatch() { UNIPATCH_DROP+=" 5011_enable-cpu-optimizations-for-gcc8.patch" UNIPATCH_DROP+=" 5012_enable-cpu-optimizations-for-gcc91.patch" UNIPATCH_DROP+=" 5013_enable-cpu-optimizations-for-gcc10.patch" - if [[ ${GCC_MAJOR_VER} -lt 9 ]]; then + if [[ ${GCC_MAJOR_VER} -lt 9 ]] && ! tc-is-clang; then UNIPATCH_DROP+=" 5010_enable-cpu-optimizations-universal.patch" fi # this legacy section should be targeted for removal @@ -1120,14 +1190,14 @@ unipatch() { fi done - #populate KPATCH_DIRS so we know where to look to remove the excludes + # Populate KPATCH_DIRS so we know where to look to remove the excludes x=${KPATCH_DIR} KPATCH_DIR="" for i in $(find ${x} -type d | sort -n); do KPATCH_DIR="${KPATCH_DIR} ${i}" done - #so now lets get rid of the patchno's we want to exclude + # So now lets get rid of the patch numbers we want to exclude UNIPATCH_DROP="${UNIPATCH_EXCLUDE} ${UNIPATCH_DROP}" for i in ${UNIPATCH_DROP}; do ebegin "Excluding Patch #${i}" @@ -1154,7 +1224,7 @@ unipatch() { # addition of a file with the same name as the symlink in the # # same location; this causes the dry-run to fail, see bug #507656. # # # - # https://bugs.gentoo.org/show_bug.cgi?id=507656 # + # https://bugs.gentoo.org/507656 # #################################################################### if [[ -n ${K_NODRYRUN} ]]; then ebegin "Applying ${i/*\//} (-p1)" @@ -1330,7 +1400,16 @@ kernel-2_src_unpack() { # allow ebuilds to massage the source tree after patching but before # we run misc `make` functions below - [[ $(type -t kernel-2_hook_premake) == "function" ]] && kernel-2_hook_premake + if [[ $(type -t kernel-2_hook_premake) == "function" ]]; then + ewarn "The function name: kernel-2_hook_premake is being deprecated and" + ewarn "being changed to: kernel-2_insert_premake to comply with pms policy." + ewarn "See bug #843686 " + ewarn "The call to the old function name will be removed on or about July 1st, 2022 " + ewarn "Please update your ebuild before this date." + kernel-2_hook_premake + else + [[ $(type -t kernel-2_insert_premake) == "function" ]] && kernel-2_insert_premake + fi debug-print "Doing unpack_set_extraversion" @@ -1380,8 +1459,10 @@ kernel-2_src_compile() { cd "${S}" || die if [[ ${K_DEBLOB_AVAILABLE} == 1 ]] && use deblob; then + einfo ">>> Patching deblob script for forcing awk ..." + sed -i '/check="\/bin\/sh $check"/a \ check="$check --use-awk"' \ + "${T}/${DEBLOB_A}" || die "Failed to patch ${DEBLOB_A}" einfo ">>> Running deblob script ..." - python_setup sh "${T}/${DEBLOB_A}" --force || die "Deblob script failed to run!!!" fi } @@ -1454,10 +1535,10 @@ kernel-2_pkg_postrm() { [[ ${ETYPE} == headers ]] && return 0 # If there isn't anything left behind, then don't complain. - [[ -e ${EROOT%/}/usr/src/linux-${KV_FULL} ]] || return 0 + [[ -e ${EROOT}/usr/src/linux-${KV_FULL} ]] || return 0 ewarn "Note: Even though you have successfully unmerged " ewarn "your kernel package, directories in kernel source location: " - ewarn "${EROOT%/}/usr/src/linux-${KV_FULL}" + ewarn "${EROOT}/usr/src/linux-${KV_FULL}" ewarn "with modified files will remain behind. By design, package managers" ewarn "will not remove these modified files and the directories they reside in." ewarn "For more detailed kernel removal instructions, please see: "