Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Jun 2015 16:47:53 +0200
From:      "Julian H. Stacey" <jhs@berklix.com>
To:        olli hauer <ohauer@gmx.de>
Cc:        freebsd-ports@freebsd.org
Subject:   Re: bsd.port.mk reduce error to warning for UNAME_r OSVERSION mismatch
Message-ID:  <201506261448.t5QElrFE050070@fire.js.berklix.net>
In-Reply-To: Your message "Thu, 18 Jun 2015 06:28:40 %2B0200." <558248F8.6060604@gmx.de>

next in thread | previous in thread | raw e-mail | index | archive | help
Sorry for my delay replying, Thanks to 
olli hauer wrote Thu Jun 18 04:28:49 UTC 2015 :

> On 2015-06-16 17:06, Julian H. Stacey wrote:
> > bsd.port.mk test below is too agressive, let's have it just Warn, not Fail.
> > Also prefix text "Error: " or "Warning: " make it obvious which is happening.
> > 
> > It seems likely people may have different opinions if it should
> > just Warn or Error, so kets add an environent switch to stear that decision.
> > Which way the default setting of switch should be, I won't suggest
> > (in hope of enhancing chance of agreement to add the switch :-)
> > Whoever adds the switch could decide ?
> > 
> > Background:
> >   	current fails to make my /usr/ports/graphics/libspiro
> >   	I contacted cc'd MAINTAINER= who wrote me
> > 	"my poudriere is running on 10"
> > 	I dont run poudriere, but have a native 10 partition
> > 	so simply did a chroot ...
> > I ran:
> > cd /s2; head -1 /etc/motd

To correct myself:	cd /s2; chroot /s2 ; head -1 /etc/motd

> > 	# FreeBSD 10.1-RELEASE (LAPR.small) #0: Sat Feb 28 16:29:20 CET 2015
> > cd /usr/ports/graphics/libspiro
> > make clean
> > 	make: "/usr/ports/Mk/bsd.port.mk" line 1214: UNAME_r (11.0-CURRENT) and OSVERSION (1001000) do not agree on major version number.
> > make
> > 	make: "/usr/ports/Mk/bsd.port.mk" line 1214: UNAME_r (11.0-CURRENT) and OSVERSION (1001000) do not agree on major version number.
> > 
> > Same forced error can be seen on current lines 1197 & 1199.
> > 
> > After I patched out the failing bsd.port.mk error I could continue my test 
> > of the port & see the port build with 10 src & ports on an 11 kernel.
> > 
> 
> Patching bsd.port.mk is not the way to go, set the following environment vars before starting a build inside the jail
> - UNAME_r=10.1-RELEASE-p10
> - UNAME_v=FreeBSD 10.1-RELEASE-p10
> - OSVERSION=1001000
> 
> For example in the login.conf of the jail
> 
> default:\
>         :setenv=UNAME_r=10.1-RELEASE-p10,UNAME_v=FreeBSD 10.1-RELEASE-p10,OSVERSION=1001000:\
> 	...

Thanks for the syntax Olli, I've noted it for use on a slim sharing jail,
But what I perhaps didn't make sufficiently clear above last time:
It's a _chroot_ to a total complete working bootable partition.  
It's not appropriate to edit bsd.port.mk 
It should not be necessary to assert any environment varables.
(+ it's un-necessarily hard work to deduce different numbers to feed env vars
to test each different complete bootable partition).

bsd.port.mk should simply Not break, but Does break.

The diff below both improves the error report, 
& optionaly fixes errors to warnings.

http://www.berklix.com/~jhs/src/bsd/fixes/FreeBSD/ports/gen/Mk/bsd.port.mk.error_to_warn.REL=11.0-CURRENT.diff

====
*** ports/Mk/bsd.port.mko	Tue Jun 16 17:10:28 2015
--- ports/Mk/bsd.port.mk	Fri Jun 19 16:19:28 2015
***************
*** 1194,1202 ****
  # Skip if OSVERSION specified on cmdline for testing. Only works for bmake.
  .if !defined(.MAKEOVERRIDES) || !${.MAKEOVERRIDES:MOSVERSION}
  .if ${_OSVERSION_MAJOR} != ${UNAMER:R}
! .error UNAME_r (${UNAMER}) and OSVERSION (${OSVERSION}) do not agree on major version number.
  .elif ${_OSVERSION_MAJOR} != ${OSREL:R}
! .error OSREL (${OSREL}) and OSVERSION (${OSVERSION}) do not agree on major version number.
  .endif
  .endif
  
--- 1194,1210 ----
  # Skip if OSVERSION specified on cmdline for testing. Only works for bmake.
  .if !defined(.MAKEOVERRIDES) || !${.MAKEOVERRIDES:MOSVERSION}
  .if ${_OSVERSION_MAJOR} != ${UNAMER:R}
! .ifndef BERKLIX
! .error Fatal Error: UNAME_r (${UNAMER}) and OSVERSION (${OSVERSION}) do not agree on major version number.
! .else
! .warning Warning: UNAME_r (${UNAMER}) and OSVERSION (${OSVERSION}) do not agree on major version number.
! .endif
  .elif ${_OSVERSION_MAJOR} != ${OSREL:R}
! .ifndef BERKLIX
! .error Fatal Error: OSREL (${OSREL}) and OSVERSION (${OSVERSION}) do not agree on major version number.
! .else
! .warning Warning: OSREL (${OSREL}) and OSVERSION (${OSVERSION}) do not agree on major version number.
! .endif
  .endif
  .endif
  
====

Cheers,
Julian
--
Julian Stacey,  BSD Linux Unix Net Sys Eng Consultant Munich http://berklix.com
 Reply after previous text, like a play - Not before, which looses context.
 Indent previous text with "> "		Insert new lines before 80 chars.
 Send plain text, Not quoted-printable, Not HTML, Not ms.doc, Not base64.



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