eclass/kernel-2: Sync with Gentoo

It's from Gentoo commit c47ceebdc3239de7b1f5acda4ce8882c850779b4.
This commit is contained in:
Krzesimir Nowak 2022-10-21 10:57:15 +02:00
parent 4935a404f3
commit 9e7df3d422

View File

@ -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 # Distributed under the terms of the GNU General Public License v2
# @ECLASS: kernel-2.eclass # @ECLASS: kernel-2.eclass
@ -8,7 +8,7 @@
# John Mylchreest <johnm@gentoo.org> # John Mylchreest <johnm@gentoo.org>
# Mike Pagano <mpagano@gentoo.org> # Mike Pagano <mpagano@gentoo.org>
# <so many, many others, please add yourself> # <so many, many others, please add yourself>
# @SUPPORTED_EAPIS: 6 7 8 # @SUPPORTED_EAPIS: 7 8
# @BLURB: Eclass for kernel packages # @BLURB: Eclass for kernel packages
# @DESCRIPTION: # @DESCRIPTION:
# This is the kernel.eclass rewrite for a clean base regarding the 2.6 # This is the kernel.eclass rewrite for a clean base regarding the 2.6
@ -17,40 +17,144 @@
# added functionality: # added functionality:
# unipatch - a flexible, singular method to extract, add and remove patches. # 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 # @DEFAULT_UNSET
# @DESCRIPTION: # @DESCRIPTION:
# When setting the EXTRAVERSION variable, it should # Used as a comparison kernel version, which is used when
# add PV to the end. # PV doesnt reflect the genuine kernel version.
# this is useful for things like wolk. IE: # This gets set to the portage style versioning. ie:
# EXTRAVERSION would be something like : -wolk-4.19-r1 # 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 # @DEFAULT_UNSET
# @DESCRIPTION: # @DESCRIPTION:
# if this is set then patch --dry-run will not # if this is set then patch --dry-run will not
# be run. Certain patches will fail with this parameter # be run. Certain patches will fail with this parameter
# See bug #507656 # See bug #507656
# @ECLASS-VARIABLE: K_NOSETEXTRAVERSION # @ECLASS_VARIABLE: K_NOSETEXTRAVERSION
# @DEFAULT_UNSET # @DEFAULT_UNSET
# @DESCRIPTION: # @DESCRIPTION:
# if this is set then EXTRAVERSION will not be # if this is set then EXTRAVERSION will not be
# automatically set within the kernel Makefile # automatically set within the kernel Makefile
# @ECLASS-VARIABLE: K_NOUSENAME # @ECLASS_VARIABLE: K_NOUSENAME
# @DEFAULT_UNSET # @DEFAULT_UNSET
# @DESCRIPTION: # @DESCRIPTION:
# if this is set then EXTRAVERSION will not include the # if this is set then EXTRAVERSION will not include the
# first part of ${PN} in EXTRAVERSION # first part of ${PN} in EXTRAVERSION
# @ECLASS-VARIABLE: K_NOUSEPR # @ECLASS_VARIABLE: K_NOUSEPR
# @DEFAULT_UNSET # @DEFAULT_UNSET
# @DESCRIPTION: # @DESCRIPTION:
# if this is set then EXTRAVERSION will not include the # if this is set then EXTRAVERSION will not include the
# anything based on ${PR}. # 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 # @DEFAULT_UNSET
# @DESCRIPTION: # @DESCRIPTION:
# if the patchset is prepatched (ie: pf-sources, # if the patchset is prepatched (ie: pf-sources,
@ -58,123 +162,93 @@
# patchset version for and not use it as a true package # patchset version for and not use it as a true package
# revision # revision
# @ECLASS-VARIABLE: K_EXTRAEINFO # @ECLASS_VARIABLE: K_SECURITY_UNSUPPORTED
# @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
# @DEFAULT_UNSET # @DEFAULT_UNSET
# @DESCRIPTION: # @DESCRIPTION:
# If set, this kernel is unsupported by Gentoo Security # If set, this kernel is unsupported by Gentoo Security
# to the current eclass maintainer :) # to the current eclass maintainer :)
# @ECLASS-VARIABLE: K_DEBLOB_AVAILABLE # @ECLASS_VARIABLE: K_SYMLINK
# @DEFAULT_UNSET # @DEFAULT_UNSET
# @DESCRIPTION: # @DESCRIPTION:
# A value of "0" will disable all of the optional deblob # if this is set, then forcably create symlink anyway
# code. If empty, will be set to "1" if deblobbing is
# possible. Test ONLY for "1".
# @ECLASS-VARIABLE: K_DEBLOB_TAG # @ECLASS_VARIABLE: K_USEPV
# @DEFAULT_UNSET # @DEFAULT_UNSET
# @DESCRIPTION: # @DESCRIPTION:
# This will be the version of deblob script. It's a upstream SVN tag # When setting the EXTRAVERSION variable, it should
# such asw -gnu or -gnu1. # 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 # @DEFAULT_UNSET
# @DESCRIPTION: # @DESCRIPTION:
# This kernel was already deblobbed elsewhere. # Apply genpatches to kernel source. Provide any
# If false, either optional deblobbing will be available # combination of "base", "extras" or "experimental".
# or the license will note the inclusion of linux-firmware code.
# @ECLASS-VARIABLE: K_LONGTERM # @ECLASS_VARIABLE: KERNEL_URI
# @DEFAULT_UNSET # @DEFAULT_UNSET
# @DESCRIPTION: # @DESCRIPTION:
# If set, the eclass will search for the kernel source # Upstream kernel src URI
# in the long term directories on the upstream servers
# as the location has been changed by upstream
# @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 <KV_MAJOR>.<KV_MINOR>.<KV_PATCH
# @ECLASS_VARIABLE: KV_MINOR
# @DEFAULT_UNSET
# @OUTPUT_VARIABLE
# @DESCRIPTION:
# Kernel minor version from <KV_MAJOR>.<KV_MINOR>.<KV_PATCH
# @ECLASS_VARIABLE: KV_PATCH
# @DEFAULT_UNSET
# @OUTPUT_VARIABLE
# @DESCRIPTION:
# Kernel patch version from <KV_MAJOR>.<KV_MINOR>.<KV_PATCH
# @ECLASS_VARIABLE: LINUX_HOSTCFLAGS
# @DEFAULT_UNSET # @DEFAULT_UNSET
# @DESCRIPTION: # @DESCRIPTION:
# this should be a space separated list of ARCH's which # Default cflags if not already set
# can be supported by the headers ebuild
# @ECLASS-VARIABLE: UNIPATCH_LIST # @ECLASS_VARIABLE: OKV
# @DEFAULT_UNSET # @DEFAULT_UNSET
# @DESCRIPTION: # @DESCRIPTION:
# space delimetered list of patches to be applied to the kernel # Original Kernel Version (2.6.0/2.6.0-test11)
# @ECLASS-VARIABLE: UNIPATCH_EXCLUDE # @ECLASS_VARIABLE: RELEASE
# @DEFAULT_UNSET
# @DESCRIPTION:
# Representative of the kernel release tag (-rc3/-git3)
# @ECLASS_VARIABLE: RELEASETYPE
# @DEFAULT_UNSET
# @DESCRIPTION:
# The same as RELEASE but with its numerics stripped (-rc/-git)
# @ECLASS_VARIABLE: UNIPATCH_DOCS
# @DEFAULT_UNSET
# @DESCRIPTION:
# space delimemeted list of docs to be installed to
# the doc dir
# @ECLASS_VARIABLE: UNIPATCH_EXCLUDE
# @DEFAULT_UNSET # @DEFAULT_UNSET
# @DESCRIPTION: # @DESCRIPTION:
# An addition var to support exlusion based completely # An addition var to support exlusion based completely
@ -182,13 +256,22 @@
# this should _NOT_ be used from the ebuild as this is # this should _NOT_ be used from the ebuild as this is
# reserved for end users passing excludes from the cli # reserved for end users passing excludes from the cli
# @ECLASS-VARIABLE: UNIPATCH_DOCS # @ECLASS_VARIABLE: UNIPATCH_LIST
# @DEFAULT_UNSET # @DEFAULT_UNSET
# @DESCRIPTION: # @DESCRIPTION:
# space delimemeted list of docs to be installed to # space delimetered list of patches to be applied to the kernel
# the doc dir
# @ECLASS-VARIABLE: UNIPATCH_STRICTORDER # @ECLASS_VARIABLE: UNIPATCH_LIST_DEFAULT
# @INTERNAL
# @DESCRIPTION:
# Upstream kernel patch archive
# @ECLASS_VARIABLE: UNIPATCH_LIST_GENPATCHES
# @INTERNAL
# @DESCRIPTION:
# List of genpatches archives to apply to the kernel
# @ECLASS_VARIABLE: UNIPATCH_STRICTORDER
# @DEFAULT_UNSET # @DEFAULT_UNSET
# @DESCRIPTION: # @DESCRIPTION:
# if this is set places patches into directories of # if this is set places patches into directories of
@ -198,11 +281,10 @@
# If you do change them, there is a chance that we will not fix resulting bugs; # If you do change them, there is a chance that we will not fix resulting bugs;
# that of course does not mean we're not willing to help. # that of course does not mean we're not willing to help.
inherit estack toolchain-funcs inherit estack multiprocessing toolchain-funcs
[[ ${EAPI} == 6 ]] && inherit eapi7-ver
case ${EAPI} in case ${EAPI} in
6|7|8) ;; 7|8) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac esac
@ -295,7 +377,7 @@ handle_genpatches() {
UNIPATCH_LIST_GENPATCHES+=" ${DISTDIR}/${tarball}" UNIPATCH_LIST_GENPATCHES+=" ${DISTDIR}/${tarball}"
debug-print "genpatches tarball: ${tarball}" debug-print "genpatches tarball: ${tarball}"
fi fi
GENPATCHES_URI+=" ${use_cond_start}$(echo https://dev.gentoo.org/~{alicef,mpagano,whissi}/dist/genpatches/${tarball})${use_cond_end}" GENPATCHES_URI+=" ${use_cond_start}$(echo https://dev.gentoo.org/~{alicef,mpagano}/dist/genpatches/${tarball})${use_cond_end}"
done done
} }
@ -564,7 +646,7 @@ kernel_is() {
eq) operator="-eq"; shift;; eq) operator="-eq"; shift;;
*) operator="-eq";; *) operator="-eq";;
esac esac
[[ $# -gt 3 ]] && die "Error in kernel-2_kernel_is(): too many parameters" [[ $# -gt 3 ]] && die "Error in ${ECLASS}_${FUNCNAME}(): too many parameters"
ver_test \ ver_test \
"${KV_MAJOR:-0}.${KV_MINOR:-0}.${KV_PATCH:-0}" \ "${KV_MAJOR:-0}.${KV_MINOR:-0}.${KV_PATCH:-0}" \
@ -574,8 +656,6 @@ kernel_is() {
# Capture the sources type and set DEPENDs # Capture the sources type and set DEPENDs
if [[ ${ETYPE} == sources ]]; then if [[ ${ETYPE} == sources ]]; then
[[ ${EAPI} == 6 ]] && DEPEND="!build? ( sys-apps/sed )" ||
BDEPEND="!build? ( sys-apps/sed )"
RDEPEND="!build? ( RDEPEND="!build? (
app-arch/cpio app-arch/cpio
dev-lang/perl dev-lang/perl
@ -589,20 +669,12 @@ if [[ ${ETYPE} == sources ]]; then
)" )"
SLOT="${PVR}" SLOT="${PVR}"
DESCRIPTION="Sources based on the Linux Kernel." DESCRIPTION="Sources based on the Linux Kernel"
IUSE="symlink build" IUSE="symlink build"
# Bug #266157, deblob for libre support # Bug #266157, deblob for libre support
if [[ -z ${K_PREDEBLOBBED} ]]; then if [[ -z ${K_PREDEBLOBBED} ]]; then
# deblob less than 5.10 require python 2.7
if kernel_is lt 5 10; then
K_DEBLOB_AVAILABLE=0
fi
if [[ ${K_DEBLOB_AVAILABLE} == 1 ]]; then if [[ ${K_DEBLOB_AVAILABLE} == 1 ]]; then
PYTHON_COMPAT=( python3_{6..10} )
inherit python-any-r1
IUSE="${IUSE} deblob" IUSE="${IUSE} deblob"
# Reflect that kernels contain firmware blobs unless otherwise # Reflect that kernels contain firmware blobs unless otherwise
@ -610,8 +682,6 @@ if [[ ${ETYPE} == sources ]]; then
# tree has been dropped from the kernel. # tree has been dropped from the kernel.
kernel_is lt 4 14 && LICENSE+=" !deblob? ( linux-firmware )" kernel_is lt 4 14 && LICENSE+=" !deblob? ( linux-firmware )"
BDEPEND+=" deblob? ( ${PYTHON_DEPS} )"
if [[ -n KV_MINOR ]]; then if [[ -n KV_MINOR ]]; then
DEBLOB_PV="${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}" DEBLOB_PV="${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
else else
@ -692,7 +762,7 @@ env_setup_xmakeopts() {
elif type -p ${CHOST}-ar >/dev/null; then elif type -p ${CHOST}-ar >/dev/null; then
xmakeopts="${xmakeopts} CROSS_COMPILE=${CHOST}-" xmakeopts="${xmakeopts} CROSS_COMPILE=${CHOST}-"
fi 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 export xmakeopts
} }
@ -780,10 +850,10 @@ install_headers() {
local ddir=$(kernel_header_destdir) local ddir=$(kernel_header_destdir)
env_setup_xmakeopts 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 # 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 return 0
} }
@ -810,7 +880,7 @@ install_sources() {
done done
fi fi
mv "${WORKDIR}"/linux* "${ED%/}"/usr/src || die mv "${WORKDIR}"/linux* "${ED}"/usr/src || die
if [[ -n ${UNIPATCH_DOCS} ]]; then if [[ -n ${UNIPATCH_DOCS} ]]; then
for i in ${UNIPATCH_DOCS}; do 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 we are to forcably symlink, delete it if it already exists first.
if [[ ${K_SYMLINK} -gt 0 ]]; then if [[ ${K_SYMLINK} -gt 0 ]]; then
if [[ -e ${EROOT%/}/usr/src/linux && ! -L ${EROOT%/}/usr/src/linux ]] ; then if [[ -e ${EROOT}/usr/src/linux && ! -L ${EROOT}/usr/src/linux ]] ; then
die "${EROOT%/}/usr/src/linux exist and is not a symlink" die "${EROOT}/usr/src/linux exists and is not a symlink"
fi fi
ln -snf linux-${KV_FULL} "${EROOT%/}"/usr/src/linux || die ln -snf linux-${KV_FULL} "${EROOT}"/usr/src/linux || die
fi fi
# Don't forget to make directory for sysfs # 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 "If you are upgrading from a previous kernel, you may be interested"
elog "in the following document:" elog "in the following document:"
@ -994,7 +1064,7 @@ unipatch() {
extention=${extention/:*/} extention=${extention/:*/}
PIPE_CMD="" PIPE_CMD=""
case ${extention} in case ${extention} in
xz) PIPE_CMD="xz -dc";; xz) PIPE_CMD="xz -T$(makeopts_jobs) -dc";;
lzma) PIPE_CMD="lzma -dc";; lzma) PIPE_CMD="lzma -dc";;
bz2) PIPE_CMD="bzip2 -dc";; bz2) PIPE_CMD="bzip2 -dc";;
patch*) PIPE_CMD="cat";; patch*) PIPE_CMD="cat";;
@ -1074,7 +1144,7 @@ unipatch() {
UNIPATCH_DROP+=" 5011_enable-cpu-optimizations-for-gcc8.patch" UNIPATCH_DROP+=" 5011_enable-cpu-optimizations-for-gcc8.patch"
UNIPATCH_DROP+=" 5012_enable-cpu-optimizations-for-gcc91.patch" UNIPATCH_DROP+=" 5012_enable-cpu-optimizations-for-gcc91.patch"
UNIPATCH_DROP+=" 5013_enable-cpu-optimizations-for-gcc10.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" UNIPATCH_DROP+=" 5010_enable-cpu-optimizations-universal.patch"
fi fi
# this legacy section should be targeted for removal # this legacy section should be targeted for removal
@ -1120,14 +1190,14 @@ unipatch() {
fi fi
done 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} x=${KPATCH_DIR}
KPATCH_DIR="" KPATCH_DIR=""
for i in $(find ${x} -type d | sort -n); do for i in $(find ${x} -type d | sort -n); do
KPATCH_DIR="${KPATCH_DIR} ${i}" KPATCH_DIR="${KPATCH_DIR} ${i}"
done 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}" UNIPATCH_DROP="${UNIPATCH_EXCLUDE} ${UNIPATCH_DROP}"
for i in ${UNIPATCH_DROP}; do for i in ${UNIPATCH_DROP}; do
ebegin "Excluding Patch #${i}" ebegin "Excluding Patch #${i}"
@ -1154,7 +1224,7 @@ unipatch() {
# addition of a file with the same name as the symlink in the # # 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. # # 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 if [[ -n ${K_NODRYRUN} ]]; then
ebegin "Applying ${i/*\//} (-p1)" ebegin "Applying ${i/*\//} (-p1)"
@ -1330,7 +1400,16 @@ kernel-2_src_unpack() {
# allow ebuilds to massage the source tree after patching but before # allow ebuilds to massage the source tree after patching but before
# we run misc `make` functions below # 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" debug-print "Doing unpack_set_extraversion"
@ -1380,8 +1459,10 @@ kernel-2_src_compile() {
cd "${S}" || die cd "${S}" || die
if [[ ${K_DEBLOB_AVAILABLE} == 1 ]] && use deblob; then 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 ..." einfo ">>> Running deblob script ..."
python_setup
sh "${T}/${DEBLOB_A}" --force || die "Deblob script failed to run!!!" sh "${T}/${DEBLOB_A}" --force || die "Deblob script failed to run!!!"
fi fi
} }
@ -1454,10 +1535,10 @@ kernel-2_pkg_postrm() {
[[ ${ETYPE} == headers ]] && return 0 [[ ${ETYPE} == headers ]] && return 0
# If there isn't anything left behind, then don't complain. # 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 "Note: Even though you have successfully unmerged "
ewarn "your kernel package, directories in kernel source location: " 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 "with modified files will remain behind. By design, package managers"
ewarn "will not remove these modified files and the directories they reside in." ewarn "will not remove these modified files and the directories they reside in."
ewarn "For more detailed kernel removal instructions, please see: " ewarn "For more detailed kernel removal instructions, please see: "