Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Aug 2021 20:22:59 GMT
From:      Bryan Drewery <bdrewery@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 154492dd1f1d - main - Mk/bsd.port.mk: Clarify UNAME_r failure.
Message-ID:  <202108132022.17DKMxuo007305@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by bdrewery:

URL: https://cgit.FreeBSD.org/ports/commit/?id=154492dd1f1d8c9a8f9c283f830a737c96e64a10

commit 154492dd1f1d8c9a8f9c283f830a737c96e64a10
Author:     Bryan Drewery <bdrewery@FreeBSD.org>
AuthorDate: 2021-08-13 20:10:23 +0000
Commit:     Bryan Drewery <bdrewery@FreeBSD.org>
CommitDate: 2021-08-13 20:22:57 +0000

    Mk/bsd.port.mk: Clarify UNAME_r failure.
    
    An example of this happening is with recent Poudriere changes:
    - Poudriere <= 3.3 used to set UNAME_r in /etc/login.conf's environment
      during *jail creation*.
    - Poudriere >= 3.4 only sets it in the environment during *jail
      runtime*.
    
    Creating a jail with Poudriere 3.4 and then using Poudriere 3.3 on it
    would fail to have UNAME_r properly set.  It would read OSVERSION from
    /usr/include/sys/param.h to find the installed files release.  The ports
    framework, and builds, need `uname` to be correct for the *jail/chroot*
    and not be of the running kernel.
    
    Add a footshoot enabler while here which should not be used for any
    reason as it can create packages targetting the release of the running
    kernel rather than the chroot/jail's expected version.
---
 Mk/bsd.port.mk | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk
index 5bdaf10cec64..390b06262018 100644
--- a/Mk/bsd.port.mk
+++ b/Mk/bsd.port.mk
@@ -1195,7 +1195,11 @@ _OSVERSION_MAJOR=	${OSVERSION:C/([0-9]?[0-9])([0-9][0-9])[0-9]{3}/\1/}
 # Skip if OSVERSION specified on cmdline for testing. Only works for bmake.
 .if !defined(.MAKEOVERRIDES) || !${.MAKEOVERRIDES:MOSVERSION}
 .if ${_OSVERSION_MAJOR} != ${_OSRELEASE:R}
-.error UNAME_r (${_OSRELEASE}) and OSVERSION (${OSVERSION}) do not agree on major version number.
+.if defined(I_DONT_CARE_IF_MY_BUILDS_TARGET_THE_WRONG_RELEASE)
+WARNING+=	"I_DONT_CARE_IF_MY_BUILDS_TARGET_THE_WRONG_RELEASE set: Expect unexpected problems as the chroot/jail file versions do not match what `uname` returns. Thus buids will target the wrong release."
+.else
+.error UNAME_r (${_OSRELEASE}) and OSVERSION (${OSVERSION}) do not agree on major version number: This means your jail or chroot is misconfigured such that the installed files (OSVERION) do not match what `uname -r` (kernel) treturns. Likely setting UNAME_r will resolve the issue. OSVERSION should not be set as it will be read from /usr/include/sys/param.h.
+.endif
 .elif ${_OSVERSION_MAJOR} != ${OSREL:R}
 .error OSREL (${OSREL}) and OSVERSION (${OSVERSION}) do not agree on major version number.
 .endif



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202108132022.17DKMxuo007305>