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

2021-09-09 Thread Mike Gilbert
On Thu, Sep 9, 2021 at 1:21 PM Robin H. Johnson  wrote:
>
> On Wed, Sep 01, 2021 at 02:44:11PM -0400, Mike Pagano wrote:
> > 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.
> Hi,
>
> This change has broken infra systems where /usr/src/ is empty because
> they use a binary kernel. /proc/config.gz does exist on those systems for this
> use case.
>
> Specifically, any package that uses linux-info to issues warnings via the '~'
> syntax now fails because "getfilevar_noexec VERSION ..." returns empty string.
>
>  * Determining the location of the kernel source code
>  * Unable to find kernel sources at /usr/src/linux
>  * Please make sure that /usr/src/linux points at your running kernel,
>  * (or the kernel you wish to build against).
>  * Alternatively, set the KERNEL_DIR environment variable to the kernel 
> sources location
>  * Unable to calculate Linux Kernel version for build, attempting to use 
> running version
>  * ERROR: app-emulation/docker-20.10.7::gentoo failed (setup phase):
>  *   Unable to determine any Linux Kernel version, please report a bug
>  *
>  * Call stack:
>  *   ebuild.sh, line 127:  Called pkg_setup
>  *   docker-20.10.7.ebuild, line 110:  Called kernel_is 'lt' '4' '5'
>  *   linux-info.eclass, line 405:  Called linux-info_get_any_version
>  *   linux-info.eclass, line 678:  Called die
>  * The specific snippet of code:
>  *  die "Unable to determine any Linux Kernel version, 
> please report a bug"
>
> I'd like to propose that we revert the original CVS change that supported the 
> fallback to getfilevar_noexec:
> https://gitweb.gentoo.org/repo/gentoo/historical.git/commit/eclass/linux-info.eclass?id=ab160a941f5f52c95b47129d3243c693b05401e5

I cannot reproduce this with /proc/config.gz present.

% sudo ebuild docker-20.10.8.ebuild clean setup
 * docker-20.10.8.tar.gz BLAKE2B SHA512 size ;-) ...
  [ ok ]
 * Determining the location of the kernel source code
 * Unable to find kernel sources at /usr/src/linux
 * Please make sure that /usr/src/linux points at your running kernel,
 * (or the kernel you wish to build against).
 * Alternatively, set the KERNEL_DIR environment variable to the
kernel sources location
 * Unable to calculate Linux Kernel version for build, attempting to
use running version
 * Checking for suitable kernel configuration options...
 *   CONFIG_BRIDGE_NETFILTER:is not set when it should be.
 *   CONFIG_IP_NF_TARGET_MASQUERADE: is not set when it should be.
 *   CONFIG_NETFILTER_XT_MATCH_IPVS: is not set when it should be.
 *   CONFIG_IP_VS:   is not set when it should be.
 *   CONFIG_IP_VS_PROTO_TCP: is not set when it should be.
 *   CONFIG_IP_VS_PROTO_UDP: is not set when it should be.
 *   CONFIG_IP_VS_NFCT:  is not set when it should be.
 *   CONFIG_IP_VS_RR:is not set when it should be.
 *   CONFIG_OVERLAY_FS:  is not set when it should be.
 * Please check to make sure these options are set correctly.
 * Failure to do so may cause unexpected problems.



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

2021-09-09 Thread Robin H. Johnson
On Wed, Sep 01, 2021 at 02:44:11PM -0400, Mike Pagano wrote:
> 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.
Hi,

This change has broken infra systems where /usr/src/ is empty because
they use a binary kernel. /proc/config.gz does exist on those systems for this
use case.

Specifically, any package that uses linux-info to issues warnings via the '~'
syntax now fails because "getfilevar_noexec VERSION ..." returns empty string.

 * Determining the location of the kernel source code
 * Unable to find kernel sources at /usr/src/linux
 * Please make sure that /usr/src/linux points at your running kernel, 
 * (or the kernel you wish to build against).
 * Alternatively, set the KERNEL_DIR environment variable to the kernel sources 
location
 * Unable to calculate Linux Kernel version for build, attempting to use 
running version
 * ERROR: app-emulation/docker-20.10.7::gentoo failed (setup phase):
 *   Unable to determine any Linux Kernel version, please report a bug
 * 
 * Call stack:
 *   ebuild.sh, line 127:  Called pkg_setup
 *   docker-20.10.7.ebuild, line 110:  Called kernel_is 'lt' '4' '5'
 *   linux-info.eclass, line 405:  Called linux-info_get_any_version
 *   linux-info.eclass, line 678:  Called die
 * The specific snippet of code:
 *  die "Unable to determine any Linux Kernel version, 
please report a bug"

I'd like to propose that we revert the original CVS change that supported the 
fallback to getfilevar_noexec:
https://gitweb.gentoo.org/repo/gentoo/historical.git/commit/eclass/linux-info.eclass?id=ab160a941f5f52c95b47129d3243c693b05401e5

-- 
Robin Hugh Johnson
Gentoo Linux: Dev, Infra Lead, Foundation Treasurer
E-Mail   : robb...@gentoo.org
GnuPG FP : 11ACBA4F 4778E3F6 E4EDF38E B27B944E 34884E85
GnuPG FP : 7D0B3CEB E9B85B1F 825BCECF EE05E6F6 A48F6136


signature.asc
Description: PGP signature


[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