[gentoo-dev] [PATCH] Transitional changes to the kernel-2 eclass to support future CPU OPT

2021-04-29 Thread mpagano
From: Mike Pagano 

The CPU OPT patch now contains gcc ver checks within
the patch itself. This transitional change is to start supporting
just that patch while trying not to break the older versions.

The target state eclass code will *only* need the three line
gcc version check.  We should be able to slowly remove the 
legacy code as we stabilize kernels and remove old ones from the tree.

This will put cpu opt patch support in a much more maintainable state.

---
 eclass/kernel-2.eclass | 29 +++--
 1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass
index 67ad4acc1..f676e8421 100644
--- a/eclass/kernel-2.eclass
+++ b/eclass/kernel-2.eclass
@@ -1241,8 +1241,32 @@ unipatch() {
local GCC_MAJOR_VER=$(gcc-major-version)
local GCC_MINOR_VER=$(gcc-minor-version)
 
-   # optimization patch for gcc < 8.X and kernel > 4.13
-   if kernel_is ge 4 13 ; then 
+   # this section should be the target state to handle the 
cpu opt
+   # patch for kernels > 4.19.189, 5.4.115, 5.10.33 and 
5.11.17,
+   # 5.12.0 and gcc >= 9  The patch now handles the
+   # gcc version enabled on the system through the Kconfig 
file as
+   # 'depends'. The legacy section can hopefully be 
retired in the future
+   # Note the patch for 4.19-5.8 version are the same and 
the patch for 
+   # 5.8+ version is the same
+   # eventually we can remove everything except the gcc 
ver <9 check
+   # based on stablization, time, kernel removals or a 
combo of all three
+   if ((kernel_is eq 4 19 && kernel_is gt 4 19 189) ||
+   (kernel_is eq 5 4 && kernel_is gt 5 4 115) ||
+   (kernel_is eq 5 10 && kernel_is gt 5 10 33) ||
+   (kernel_is eq 5 11 && kernel_is gt 5 11 17) ||
+   (kernel_is eq 5 12 && kernel_is gt 5 12 0)); 
then
+   UNIPATCH_DROP+=" 
5010_enable-additional-cpu-optimizations-for-gcc.patch"
+   UNIPATCH_DROP+=" 
5010_enable-additional-cpu-optimizations-for-gcc-4.9.patch"
+   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
+   UNIPATCH_DROP+=" 
5010_enable-cpu-optimizations-universal.patch"
+   fi
+   # this legacy section should be targeted for 
removal
+   # optimization patch for gcc < 8.X and kernel > 
4.13 and <  4.19
+   elif kernel_is ge 4 13; then
+   UNIPATCH_DROP+=" 
5010_enable-cpu-optimizations-universal.patch"
if [[ ${GCC_MAJOR_VER} -lt 8 ]] && [[ 
${GCC_MAJOR_VER} -gt 4 ]]; then
UNIPATCH_DROP+=" 
5011_enable-cpu-optimizations-for-gcc8.patch"
UNIPATCH_DROP+=" 
5012_enable-cpu-optimizations-for-gcc91.patch"
@@ -1272,6 +1296,7 @@ unipatch() {
UNIPATCH_DROP+=" 
5013_enable-cpu-optimizations-for-gcc10.patch"
fi
else
+   UNIPATCH_DROP+=" 
5010_enable-cpu-optimizations-universal.patch"
UNIPATCH_DROP+=" 
5010_enable-additional-cpu-optimizations-for-gcc.patch"
UNIPATCH_DROP+=" 
5010_enable-additional-cpu-optimizations-for-gcc-4.9.patch"
UNIPATCH_DROP+=" 
5011_enable-cpu-optimizations-for-gcc8.patch"
-- 
2.26.3




[gentoo-dev] [PATCH v2] Transitional changes to the kernel-2 eclass to support future CPU OPT

2021-04-29 Thread mpagano
From: Mike Pagano 

Thanks, Ulm, for the review. I have modified the code as suggested.

The CPU OPT patch now contains gcc ver checks within
the patch itself. This transitional change is to start supporting
just that patch while trying not to break the older versions.

The target state eclass code will *only* need the three line
gcc version check.  We should be able to slowly remove the
legacy code as we stabilize kernels and remove old ones from the tree.

This will put cpu opt patch support in a much more maintainable state.


Signed-off-by: Mike Pagano 
---
 eclass/kernel-2.eclass | 29 +++--
 1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass
index 67ad4acc1..f1f23f6a0 100644
--- a/eclass/kernel-2.eclass
+++ b/eclass/kernel-2.eclass
@@ -1241,8 +1241,32 @@ unipatch() {
local GCC_MAJOR_VER=$(gcc-major-version)
local GCC_MINOR_VER=$(gcc-minor-version)
 
-   # optimization patch for gcc < 8.X and kernel > 4.13
-   if kernel_is ge 4 13 ; then 
+   # this section should be the target state to handle the 
cpu opt
+   # patch for kernels > 4.19.189, 5.4.115, 5.10.33 and 
5.11.17,
+   # 5.12.0 and gcc >= 9  The patch now handles the
+   # gcc version enabled on the system through the Kconfig 
file as
+   # 'depends'. The legacy section can hopefully be 
retired in the future
+   # Note the patch for 4.19-5.8 version are the same and 
the patch for 
+   # 5.8+ version is the same
+   # eventually we can remove everything except the gcc 
ver <9 check
+   # based on stablization, time, kernel removals or a 
combo of all three
+   if ( kernel_is eq 4 19 && kernel_is gt 4 19 189 ) ||
+   ( kernel_is eq 5 4 && kernel_is gt 5 4 115 ) ||
+   ( kernel_is eq 5 10 && kernel_is gt 5 10 33 ) ||
+   ( kernel_is eq 5 11 && kernel_is gt 5 11 17 ) ||
+   ( kernel_is eq 5 12 && kernel_is gt 5 12 0 ); 
then
+   UNIPATCH_DROP+=" 
5010_enable-additional-cpu-optimizations-for-gcc.patch"
+   UNIPATCH_DROP+=" 
5010_enable-additional-cpu-optimizations-for-gcc-4.9.patch"
+   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
+   UNIPATCH_DROP+=" 
5010_enable-cpu-optimizations-universal.patch"
+   fi
+   # this legacy section should be targeted for 
removal
+   # optimization patch for gcc < 8.X and kernel > 
4.13 and <  4.19
+   elif kernel_is ge 4 13; then
+   UNIPATCH_DROP+=" 
5010_enable-cpu-optimizations-universal.patch"
if [[ ${GCC_MAJOR_VER} -lt 8 ]] && [[ 
${GCC_MAJOR_VER} -gt 4 ]]; then
UNIPATCH_DROP+=" 
5011_enable-cpu-optimizations-for-gcc8.patch"
UNIPATCH_DROP+=" 
5012_enable-cpu-optimizations-for-gcc91.patch"
@@ -1272,6 +1296,7 @@ unipatch() {
UNIPATCH_DROP+=" 
5013_enable-cpu-optimizations-for-gcc10.patch"
fi
else
+   UNIPATCH_DROP+=" 
5010_enable-cpu-optimizations-universal.patch"
UNIPATCH_DROP+=" 
5010_enable-additional-cpu-optimizations-for-gcc.patch"
UNIPATCH_DROP+=" 
5010_enable-additional-cpu-optimizations-for-gcc-4.9.patch"
UNIPATCH_DROP+=" 
5011_enable-cpu-optimizations-for-gcc8.patch"
-- 
2.26.3




[gentoo-dev] [PATCH] Create default implementation of pkg_pretend, move CONFIG_CHECK

2021-05-30 Thread mpagano
From: Mike Pagano 

As the purpose of pkg_pretend is to run sanity checks during
dependency calculation time, provide the default implementation
and perform CONFIG_CHECK within it.

See bug #759238

Signed-off-by: Mike Pagano 
---
 eclass/linux-mod.eclass | 17 -
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/eclass/linux-mod.eclass b/eclass/linux-mod.eclass
index 11b0fd0cf..42e541ed1 100644
--- a/eclass/linux-mod.eclass
+++ b/eclass/linux-mod.eclass
@@ -135,7 +135,7 @@
 # It's a read-only variable. It contains the extension of the kernel modules.
 
 inherit eutils linux-info multilib toolchain-funcs
-EXPORT_FUNCTIONS pkg_setup pkg_preinst pkg_postinst src_install src_compile 
pkg_postrm
+EXPORT_FUNCTIONS pkg_setup pkg_preinst pkg_pretend pkg_postinst src_install 
src_compile pkg_postrm
 
 case ${MODULES_OPTIONAL_USE_IUSE_DEFAULT:-n} in
   [nNfF]*|[oO][fF]*|0|-) _modules_optional_use_iuse_default='' ;;
@@ -157,7 +157,7 @@ RDEPEND="
)
${MODULES_OPTIONAL_USE:+)}"
 DEPEND="${RDEPEND}
-${MODULES_OPTIONAL_USE}${MODULES_OPTIONAL_USE:+? (}
+   ${MODULES_OPTIONAL_USE}${MODULES_OPTIONAL_USE:+? (}
sys-apps/sed
kernel_linux? ( virtual/linux-sources virtual/libelf )
${MODULES_OPTIONAL_USE:+)}"
@@ -567,6 +567,16 @@ find_module_params() {
 # default ebuild functions
 # 
 
+# @FUNCTION: linux-mod_pkg_pretend
+# @DESCRIPTION:
+# Check the CONFIG_CHECK options 
+linux-mod_pkg_pretend() {
+
+   debug-print-function ${FUNCNAME} $*
+   # External modules use kernel symbols (bug #591832, #759238)
+   CONFIG_CHECK+=" !TRIM_UNUSED_KSYMS"
+}
+
 # @FUNCTION: linux-mod_pkg_setup
 # @DESCRIPTION:
 # It checks the CONFIG_CHECK options (see linux-info.eclass(5)), verifies that 
the kernel is
@@ -589,9 +599,6 @@ linux-mod_pkg_setup() {
return
fi
 
-   # External modules use kernel symbols (bug #591832)
-   CONFIG_CHECK+=" !TRIM_UNUSED_KSYMS"
-
linux-info_pkg_setup;
require_configured_kernel
check_kernel_built;
-- 
2.31.1




[gentoo-dev] [PATCH] kernel-2.eclass: Fix einfo/elog messages

2021-06-15 Thread mpagano
From: Mike Pagano 

Fix einfo/elog messages to be more aligned with guidance outlined 
in the devmanual

Bug: https://bugs.gentoo.org/795354

Reported-by: Pacho Ramos
Signed-off-by: Mike Pagano 
---
 eclass/kernel-2.eclass | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass
index 20c83b37c..1210940b1 100644
--- a/eclass/kernel-2.eclass
+++ b/eclass/kernel-2.eclass
@@ -783,7 +783,7 @@ compile_headers() {
 
if kernel_is 2 4; then
yes "" | make oldconfig ${xmakeopts}
-   elog ">>> make oldconfig complete"
+   einfo ">>> make oldconfig complete"
make dep ${xmakeopts}
elif kernel_is 2 6; then
# 2.6.18 introduces headers_install which means we dont need any
@@ -905,7 +905,7 @@ install_sources() {
 
cd "${S}" || die
dodir /usr/src
-   elog ">>> Copying sources ..."
+   einfo ">>> Copying sources ..."
 
file="$(find ${WORKDIR} -iname "docs" -type d)"
if [[ -n ${file} ]]; then
@@ -1488,7 +1488,7 @@ kernel-2_src_compile() {
[[ ${ETYPE} == headers ]] && compile_headers
 
if [[ ${K_DEBLOB_AVAILABLE} == 1 ]] && use deblob; then
-   elog ">>> Running deblob script ..."
+   einfo ">>> Running deblob script ..."
python_setup
sh "${T}/${DEBLOB_A}" --force || die "Deblob script failed to 
run!!!"
fi
@@ -1548,7 +1548,7 @@ kernel-2_pkg_setup() {
fi
 
[[ ${ETYPE} == headers ]] && setup_headers
-   [[ ${ETYPE} == sources ]] && elog ">>> Preparing to unpack ..."
+   [[ ${ETYPE} == sources ]] && einfo ">>> Preparing to unpack ..."
 }
 
 # @FUNCTION: kernel-2_pkg_postrm
-- 
2.31.1




[gentoo-dev] [PATCH] kernel-2.eclass: Add EAPI 8 support

2021-07-18 Thread mpagano
From: Mike Pagano 

Signed-off-by: Mike Pagano 
---
 eclass/kernel-2.eclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass
index 831dd5b5d..f94dd9c43 100644
--- a/eclass/kernel-2.eclass
+++ b/eclass/kernel-2.eclass
@@ -8,7 +8,7 @@
 # John Mylchreest 
 # Mike Pagano 
 # 
-# @SUPPORTED_EAPIS: 6 7
+# @SUPPORTED_EAPIS: 6 7 8
 # @BLURB: Eclass for kernel packages
 # @DESCRIPTION:
 # This is the kernel.eclass rewrite for a clean base regarding the 2.6
@@ -201,7 +201,7 @@
 inherit estack toolchain-funcs
 [[ ${EAPI:-0} == 6 ]] && inherit eapi7-ver
 case ${EAPI:-0} in
-   6|7)
+   6|7|8)
EXPORT_FUNCTIONS src_{unpack,prepare,compile,install,test} \
pkg_{setup,preinst,postinst,postrm} ;;
*) die "${ECLASS}: EAPI ${EAPI} not supported" ;;
-- 
2.31.1