[gentoo-dev] [PATCH] Support Makefiles that set variables to a non-static value

2021-09-01 Thread Mike Pagano

Previously, the kernel Makefile had to define version variables
as static string literals to be read.
This change will allow varibles defined as non-static values
to be read.

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

Signed-off-by: Mike Pagano 
---
 eclass/linux-info.eclass | 13 +
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/eclass/linux-info.eclass b/eclass/linux-info.eclass
index 8edd17c31..0b6df1bf5 100644
--- a/eclass/linux-info.eclass
+++ b/eclass/linux-info.eclass
@@ -539,14 +539,11 @@ get_version() {
 
 	# And contrary to existing functions I feel we shouldn't trust the

# directory name to find version information as this seems insane.
-   # So we parse ${KERNEL_MAKEFILE}.  We should be able to trust that
-   # the Makefile is simple enough to use the noexec extract function.
-   # This has been true for every release thus far, and it's faster
-   # than using make to evaluate the Makefile every time.
-   KV_MAJOR=$(getfilevar_noexec VERSION "${KERNEL_MAKEFILE}")
-   KV_MINOR=$(getfilevar_noexec PATCHLEVEL "${KERNEL_MAKEFILE}")
-   KV_PATCH=$(getfilevar_noexec SUBLEVEL "${KERNEL_MAKEFILE}")
-   KV_EXTRA=$(getfilevar_noexec EXTRAVERSION "${KERNEL_MAKEFILE}")
+   # So we parse ${KERNEL_MAKEFILE}.
+   KV_MAJOR=$(getfilevar VERSION "${KERNEL_MAKEFILE}")
+   KV_MINOR=$(getfilevar PATCHLEVEL "${KERNEL_MAKEFILE}")
+   KV_PATCH=$(getfilevar SUBLEVEL "${KERNEL_MAKEFILE}")
+   KV_EXTRA=$(getfilevar EXTRAVERSION "${KERNEL_MAKEFILE}")
 
 	if [ -z "${KV_MAJOR}" -o -z "${KV_MINOR}" -o -z "${KV_PATCH}" ]

then
--
2.32.0




[gentoo-dev] [PATCH v2 4/4] cmake.eclass: Default CMAKE_BUILD_TYPE=RelWithDebInfo in EAPI 8

2021-09-01 Thread Andreas Sturmlechner
Signed-off-by: Michał Górny 
Signed-off-by: Andreas Sturmlechner 
---
 eclass/cmake.eclass | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/eclass/cmake.eclass b/eclass/cmake.eclass
index 4203b9364cc..42a6f95201a 100644
--- a/eclass/cmake.eclass
+++ b/eclass/cmake.eclass
@@ -42,14 +42,19 @@ inherit flag-o-matic multiprocessing ninja-utils 
toolchain-funcs xdg-utils
 # Eclass can use different cmake binary than the one provided in by system.
 : ${CMAKE_BINARY:=cmake}
 
+[[ ${EAPI} == 7 ]] && : ${CMAKE_BUILD_TYPE:=Gentoo}
 # @ECLASS-VARIABLE: CMAKE_BUILD_TYPE
 # @DESCRIPTION:
 # Set to override default CMAKE_BUILD_TYPE. Only useful for packages
 # known to make use of "if (CMAKE_BUILD_TYPE MATCHES xxx)".
 # If about to be set - needs to be set before invoking cmake_src_configure.
-# You usually do *NOT* want nor need to set it as it pulls CMake default
-# build-type specific compiler flags overriding make.conf.
-: ${CMAKE_BUILD_TYPE:=Gentoo}
+#
+# The default is RelWithDebInfo as that is least likely to append undesirable
+# flags. However, you may still need to sed CMake files or choose a different
+# build type to achieve desirable results.
+#
+# In EAPI 7, the default was non-standard build type of Gentoo.
+: ${CMAKE_BUILD_TYPE:=RelWithDebInfo}
 
 # @ECLASS-VARIABLE: CMAKE_IN_SOURCE_BUILD
 # @DEFAULT_UNSET
-- 
2.33.0



signature.asc
Description: This is a digitally signed message part.


[gentoo-dev] [PATCH v2 3/4] cmake.eclass: Enable CMAKE_INSTALL_ALWAYS

2021-09-01 Thread Andreas Sturmlechner
Bug: https://bugs.gentoo.org/735820
Signed-off-by: Andreas Sturmlechner 
---
 eclass/cmake.eclass | 5 +
 1 file changed, 5 insertions(+)

diff --git a/eclass/cmake.eclass b/eclass/cmake.eclass
index 7a8059ba071..4203b9364cc 100644
--- a/eclass/cmake.eclass
+++ b/eclass/cmake.eclass
@@ -535,6 +535,11 @@ cmake_src_configure() {
echo 'set(CMAKE_COLOR_MAKEFILE OFF CACHE BOOL "pretty colors 
during make" FORCE)' >> "${common_config}" || die
fi
 
+   # See bug 735820
+   if [[ ${EAPI} != 7 ]]; then
+   echo 'set(CMAKE_INSTALL_ALWAYS 1)' >> "${common_config}" || die
+   fi
+
# Wipe the default optimization flags out of CMake
if [[ ${CMAKE_BUILD_TYPE} != Gentoo ]]; then
cat >> ${common_config} <<- _EOF_ || die
-- 
2.33.0



signature.asc
Description: This is a digitally signed message part.


[gentoo-dev] [PATCH v2 2/4] cmake.eclass: Enforce CMAKE_REMOVE_MODULES_LIST be an array

2021-09-01 Thread Andreas Sturmlechner
Signed-off-by: Andreas Sturmlechner 
---
 eclass/cmake.eclass | 28 
 1 file changed, 20 insertions(+), 8 deletions(-)

diff --git a/eclass/cmake.eclass b/eclass/cmake.eclass
index 137dbc66017..7a8059ba071 100644
--- a/eclass/cmake.eclass
+++ b/eclass/cmake.eclass
@@ -66,11 +66,23 @@ inherit flag-o-matic multiprocessing ninja-utils 
toolchain-funcs xdg-utils
 : ${CMAKE_MAKEFILE_GENERATOR:=ninja}
 
 # @ECLASS-VARIABLE: CMAKE_REMOVE_MODULES_LIST
+# @PRE_INHERIT
+# @DEFAULT_UNSET
 # @DESCRIPTION:
-# Array of CMake modules that will be removed in ${CMAKE_USE_DIR}
-# (in EAPI-7: ${S}) during src_prepare, in order to force packages to use the
-# system version.  Set to empty to disable removing modules entirely.
-: ${CMAKE_REMOVE_MODULES_LIST:=FindBLAS FindLAPACK}
+# Array of .cmake modules to be removed in ${CMAKE_USE_DIR} (in EAPI-7: ${S})
+# during src_prepare, in order to force packages to use the system version.
+# By default, contains "FindBLAS" and "FindLAPACK".
+# Set to empty to disable removing modules entirely.
+if [[ ${CMAKE_REMOVE_MODULES_LIST} ]]; then
+   if [[ ${EAPI} != 7 ]]; then
+   [[ ${CMAKE_REMOVE_MODULES_LIST@a} == *a* ]] ||
+   die "CMAKE_REMOVE_MODULES_LIST must be an array"
+   fi
+else
+   if ! [[ ${CMAKE_REMOVE_MODULES_LIST@a} == *a* && 
${#CMAKE_REMOVE_MODULES_LIST[@]} -eq 0 ]]; then
+   CMAKE_REMOVE_MODULES_LIST=( FindBLAS FindLAPACK )
+   fi
+fi
 
 # @ECLASS-VARIABLE: CMAKE_USE_DIR
 # @DESCRIPTION:
@@ -108,7 +120,7 @@ inherit flag-o-matic multiprocessing ninja-utils 
toolchain-funcs xdg-utils
 
 [[ ${CMAKE_MIN_VERSION} ]] && die "CMAKE_MIN_VERSION is banned; if necessary, 
set BDEPEND=\">=dev-util/cmake-${CMAKE_MIN_VERSION}\" directly"
 [[ ${CMAKE_BUILD_DIR} ]] && die "The ebuild must be migrated to BUILD_DIR"
-[[ ${CMAKE_REMOVE_MODULES} ]] && die "CMAKE_REMOVE_MODULES is banned, set 
CMAKE_REMOVE_MODULES_LIST=\"\" instead"
+[[ ${CMAKE_REMOVE_MODULES} ]] && die "CMAKE_REMOVE_MODULES is banned, set 
CMAKE_REMOVE_MODULES_LIST array instead"
 [[ ${CMAKE_UTILS_QA_SRC_DIR_READONLY} ]] && die "Use CMAKE_QA_SRC_DIR_READONLY 
instead"
 [[ ${WANT_CMAKE} ]] && die "WANT_CMAKE has been removed and is a no-op"
 [[ ${PREFIX} ]] && die "PREFIX has been removed and is a no-op"
@@ -353,10 +365,10 @@ cmake_src_prepare() {
fi
 
local modules_list
-   if [[ $(declare -p CMAKE_REMOVE_MODULES_LIST) == "declare -a"* ]]; then
-   modules_list=( "${CMAKE_REMOVE_MODULES_LIST[@]}" )
-   else
+   if [[ ${EAPI} == 7 && $(declare -p CMAKE_REMOVE_MODULES_LIST) != 
"declare -a"* ]]; then
modules_list=( ${CMAKE_REMOVE_MODULES_LIST} )
+   else
+   modules_list=( "${CMAKE_REMOVE_MODULES_LIST[@]}" )
fi
 
local name
-- 
2.33.0



signature.asc
Description: This is a digitally signed message part.


[gentoo-dev] [PATCH v2 1/4] cmake.eclass: Support EAPI-8

2021-09-01 Thread Andreas Sturmlechner
Move supported EAPI check on top, EXPORT_FUNCTIONS below guard.

Switch to using current working directory instead of ${S}
when initializing ${CMAKE_USE_DIR} and ${BUILD_DIR}.

Sort inherits.

Raise baseline cmake version to 3.20.5.

Bug: https://bugs.gentoo.org/704524
Thanks-to: Arfrever Frehtes Taifersar Arahesis 
Signed-off-by: Andreas Sturmlechner 
---
 eclass/cmake.eclass | 95 +
 1 file changed, 62 insertions(+), 33 deletions(-)

diff --git a/eclass/cmake.eclass b/eclass/cmake.eclass
index 4bd09459ea6..137dbc66017 100644
--- a/eclass/cmake.eclass
+++ b/eclass/cmake.eclass
@@ -9,7 +9,7 @@
 # Maciej Mrozowski 
 # (undisclosed contributors)
 # Original author: Zephyrus (zephy...@mirach.it)
-# @SUPPORTED_EAPIS: 7
+# @SUPPORTED_EAPIS: 7 8
 # @BLURB: common ebuild functions for cmake-based packages
 # @DESCRIPTION:
 # The cmake eclass makes creating ebuilds for cmake-based packages much easier.
@@ -17,16 +17,25 @@
 # out-of-source builds (default), in-source builds and an implementation of the
 # well-known use_enable function for CMake.
 
+case ${EAPI} in
+   7|8) ;;
+   *) die "${ECLASS}: EAPI=${EAPI:-0} is not supported" ;;
+esac
+
 if [[ -z ${_CMAKE_ECLASS} ]]; then
 _CMAKE_ECLASS=1
 
+inherit flag-o-matic multiprocessing ninja-utils toolchain-funcs xdg-utils
+
 # @ECLASS-VARIABLE: BUILD_DIR
+# @DEFAULT_UNSET
 # @DESCRIPTION:
 # Build directory where all cmake processed files should be generated.
 # For in-source build it's fixed to ${CMAKE_USE_DIR}.
 # For out-of-source build it can be overridden, by default it uses
-# ${WORKDIR}/${P}_build.
-: ${BUILD_DIR:=${WORKDIR}/${P}_build}
+# ${CMAKE_USE_DIR}_build (in EAPI-7: ${WORKDIR}/${P}_build).
+[[ ${EAPI} == 7 ]] && : ${BUILD_DIR:=${WORKDIR}/${P}_build}
+# EAPI-8: set inside _cmake_check_build_dir
 
 # @ECLASS-VARIABLE: CMAKE_BINARY
 # @DESCRIPTION:
@@ -58,16 +67,16 @@ _CMAKE_ECLASS=1
 
 # @ECLASS-VARIABLE: CMAKE_REMOVE_MODULES_LIST
 # @DESCRIPTION:
-# Array of CMake modules that will be removed in $S during src_prepare,
-# in order to force packages to use the system version.
-# Set to "none" to disable removing modules entirely.
+# Array of CMake modules that will be removed in ${CMAKE_USE_DIR}
+# (in EAPI-7: ${S}) during src_prepare, in order to force packages to use the
+# system version.  Set to empty to disable removing modules entirely.
 : ${CMAKE_REMOVE_MODULES_LIST:=FindBLAS FindLAPACK}
 
 # @ECLASS-VARIABLE: CMAKE_USE_DIR
 # @DESCRIPTION:
 # Sets the directory where we are working with cmake, for example when
 # application uses autotools and only one plugin needs to be done by cmake.
-# By default it uses ${S}.
+# By default it uses current working directory (in EAPI-7: ${S}).
 
 # @ECLASS-VARIABLE: CMAKE_VERBOSE
 # @DESCRIPTION:
@@ -93,18 +102,9 @@ _CMAKE_ECLASS=1
 # @USER_VARIABLE
 # @DEFAULT_UNSET
 # @DESCRIPTION:
-# After running cmake_src_prepare, sets ${S} to read-only. This is
-# a user flag and should under _no circumstances_ be set in the ebuild.
-# Helps in improving QA of build systems that write to source tree.
-
-case ${EAPI} in
-   7) ;;
-   *) die "EAPI=${EAPI:-0} is not supported" ;;
-esac
-
-inherit toolchain-funcs ninja-utils flag-o-matic multiprocessing xdg-utils
-
-EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install
+# After running cmake_src_prepare, sets ${CMAKE_USE_DIR} (in EAPI-7: ${S}) to
+# read-only. This is a user flag and should under _no circumstances_ be set in
+# the ebuild. Helps in improving QA of build systems that write to source tree.
 
 [[ ${CMAKE_MIN_VERSION} ]] && die "CMAKE_MIN_VERSION is banned; if necessary, 
set BDEPEND=\">=dev-util/cmake-${CMAKE_MIN_VERSION}\" directly"
 [[ ${CMAKE_BUILD_DIR} ]] && die "The ebuild must be migrated to BUILD_DIR"
@@ -127,7 +127,7 @@ case ${CMAKE_MAKEFILE_GENERATOR} in
 esac
 
 if [[ ${PN} != cmake ]]; then
-   BDEPEND+=" dev-util/cmake"
+   BDEPEND+=" >=dev-util/cmake-3.20.5"
 fi
 
 # @FUNCTION: cmake_run_in
@@ -264,14 +264,22 @@ cmake-utils_useno() { _cmake_banned_func "" "$@" ; }
 # @DESCRIPTION:
 # Determine using IN or OUT source build
 _cmake_check_build_dir() {
-   : ${CMAKE_USE_DIR:=${S}}
+   if [[ ${EAPI} == 7 ]]; then
+   : ${CMAKE_USE_DIR:=${S}}
+   else
+   : ${CMAKE_USE_DIR:=${PWD}}
+   fi
if [[ -n ${CMAKE_IN_SOURCE_BUILD} ]]; then
# we build in source dir
BUILD_DIR="${CMAKE_USE_DIR}"
+   else
+   : ${BUILD_DIR:=${CMAKE_USE_DIR}_build}
fi
 
+   einfo "Source directory (CMAKE_USE_DIR): \"${CMAKE_USE_DIR}\""
+   einfo "Build directory  (BUILD_DIR): \"${BUILD_DIR}\""
+
mkdir -p "${BUILD_DIR}" || die
-   einfo "Working in BUILD_DIR: \"$BUILD_DIR\""
 }
 
 # @FUNCTION: _cmake_modify-cmakelists
@@ -320,12 +328,14 @@ _cmake_modify-cmakelists() {
 cmake_src_prepare() {
debug-print-function ${FUNCNAME} "$@"
 
-   # FIXME: workaround from 

Re: [gentoo-dev] [PATCH 0/9] drop the go-module_pkg_postinst function

2021-09-01 Thread William Hubbs
On Sun, Aug 29, 2021 at 11:33:17AM -0500, William Hubbs wrote:
> It seems to me that we don't need this function any longer since the go
> ebuild displays a message when it is upgraded or downgraded explaining
> how to rebuild go packages, so I would like to remove it.
> 
> This patch series contains all of the changes I could find that need to
> happen to allow the removal.

This series has been added to the tree.

Thanks,

William


signature.asc
Description: PGP signature


Re: [gentoo-dev] [PATCH eclass2manpage] Add @PROVIDES tag to indicate transitive eclass inheritance

2021-09-01 Thread Michał Górny
On Sun, 2021-08-29 at 11:17 +0200, Michał Górny wrote:
> Add a @PROVIDES eclassdoc tag that can be used to indicate that
> a particular eclass transitively provides the functions from another
> eclass and therefore ebuilds inheriting it do not have to explicitly
> inherit the other eclass.
> 
> For example, distutils-r1 provides python-r1/python-single-r1, and all
> python*-r1 eclasse provide python-utils-r1.
> 
> This data will be used to drive pkgcheck checks for missing inherits.
> 

Merged.  Expect new pkgcore+pkgcheck release in a few days.

-- 
Best regards,
Michał Górny





Re: [gentoo-dev] [PATCH] go-module.eclass: drop --mod=readonly from GOFLAGS

2021-09-01 Thread William Hubbs
On Sat, Aug 28, 2021 at 08:12:53PM -0500, William Hubbs wrote:
> As of go 1.16, --mod=readonly is the default, so we don't need to
> specify it.
> https://golang.org/ref/mod#build-commands
> https://golang.org/doc/go1.16
> 
> Signed-off-by: William Hubbs 
> ---
>  eclass/go-module.eclass | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)

This is in the tree.

Thanks,

William


signature.asc
Description: PGP signature


[gentoo-dev] [PATCH] cmake-multilib.eclass: Support EAPI-8, add guard

2021-09-01 Thread Andreas Sturmlechner
Move EXPORT_FUNCTIONS below guard.

Signed-off-by: Andreas Sturmlechner 
---
 eclass/cmake-multilib.eclass | 27 +--
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/eclass/cmake-multilib.eclass b/eclass/cmake-multilib.eclass
index 6b38d260655..c848e3882f5 100644
--- a/eclass/cmake-multilib.eclass
+++ b/eclass/cmake-multilib.eclass
@@ -6,7 +6,7 @@
 # Michał Górny 
 # @AUTHOR:
 # Author: Michał Górny 
-# @SUPPORTED_EAPIS: 7
+# @SUPPORTED_EAPIS: 7 8
 # @BLURB: cmake wrapper for multilib builds
 # @DESCRIPTION:
 # The cmake-multilib.eclass provides a glue between cmake.eclass(5)
@@ -19,21 +19,23 @@
 # in multilib-minimal, yet they ought to call appropriate cmake
 # phase rather than 'default'.
 
+[[ ${EAPI} == 7 ]] && : ${CMAKE_ECLASS:=cmake-utils}
 # @ECLASS-VARIABLE: CMAKE_ECLASS
 # @PRE_INHERIT
 # @DESCRIPTION:
-# Default is "cmake-utils" for compatibility in EAPI-7. Specify "cmake" for
-# ebuilds that ported to cmake.eclass already. Future EAPI is "cmake" only.
-: ${CMAKE_ECLASS:=cmake-utils}
+# Only "cmake" is supported in EAPI-8 and later.
+# In EAPI-7, default is "cmake-utils" for compatibility. Specify "cmake" for
+# ebuilds that ported to cmake.eclass already.
+: ${CMAKE_ECLASS:=cmake}
 
 # @ECLASS-VARIABLE: _CMAKE_ECLASS_IMPL
 # @INTERNAL
 # @DESCRIPTION:
-# Default is "cmake" for future EAPI. Cleanup once EAPI-7 support is gone.
+# TODO: Cleanup once EAPI-7 support is gone.
 _CMAKE_ECLASS_IMPL=cmake
 
-case ${EAPI:-0} in
-   7)
+case ${EAPI} in
+   7|8)
case ${CMAKE_ECLASS} in
cmake-utils|cmake) ;;
*)
@@ -43,16 +45,17 @@ case ${EAPI:-0} in
esac
_CMAKE_ECLASS_IMPL=${CMAKE_ECLASS}
;;
-   *) die "EAPI=${EAPI} is not supported" ;;
+   *) die "${ECLASS}: EAPI=${EAPI:-0} is not supported" ;;
 esac
 
 if [[ ${CMAKE_IN_SOURCE_BUILD} ]]; then
die "${ECLASS}: multilib support requires out-of-source builds."
 fi
 
-inherit ${_CMAKE_ECLASS_IMPL} multilib-minimal
+if [[ -z ${_CMAKE_MULTILIB_ECLASS} ]]; then
+_CMAKE_MULTILIB_ECLASS=1
 
-EXPORT_FUNCTIONS src_configure src_compile src_test src_install
+inherit ${_CMAKE_ECLASS_IMPL} multilib-minimal
 
 cmake-multilib_src_configure() {
local _cmake_args=( "${@}" )
@@ -93,3 +96,7 @@ cmake-multilib_src_install() {
 multilib_src_install() {
${_CMAKE_ECLASS_IMPL}_src_install "${_cmake_args[@]}"
 }
+
+fi
+
+EXPORT_FUNCTIONS src_configure src_compile src_test src_install
-- 
2.33.0


signature.asc
Description: This is a digitally signed message part.