Re: PORTS_MODULES fix

2012-06-17 Thread Doug Barton
On 06/09/2012 16:51, Doug Barton wrote:
 Ok, never mind the last one ... this patch I've actually tested. :)

Committed to HEAD and MFC'ed. Thanks everyone for the feedback and help.

Doug

-- 

This .signature sanitized for your protection


___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


PORTS_MODULES fix

2012-06-09 Thread Doug Barton
I have recently tried the PORTS_MODULES knob, and found a problem. The
ports tree searches for some dependencies by finding a binary in PATH,
and that fails since by default /usr/local/ isn't there. The attached
patch fixes that problem.

It would be more robust to use PREFIX there instead of /usr/local
explicitly, but I'm not sure how to unravel the mk maze to get that
value. If anyone has a suggestion for that, I'd be happy to include it.

Any objections to making this change?

Doug

-- 

This .signature sanitized for your protection
Index: kern.post.mk
===
--- kern.post.mk(revision 236818)
+++ kern.post.mk(working copy)
@@ -38,7 +38,7 @@
 
 # Handle out of tree ports 
 .if !defined(NO_MODULES)  defined(PORTS_MODULES)
-PORTSMODULESENV=SYSDIR=${SYSDIR}
+PORTSMODULESENV=SYSDIR=${SYSDIR} PATH=${PATH}:/usr/local/bin:/usr/local/sbin
 .for __target in all install reinstall clean
 ${__target}: ports-${__target}
 ports-${__target}:
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org

Re: PORTS_MODULES fix

2012-06-09 Thread Chris Rees
On 9 June 2012 18:15, Doug Barton do...@freebsd.org wrote:
 I have recently tried the PORTS_MODULES knob, and found a problem. The
 ports tree searches for some dependencies by finding a binary in PATH,
 and that fails since by default /usr/local/ isn't there. The attached
 patch fixes that problem.

 It would be more robust to use PREFIX there instead of /usr/local
 explicitly, but I'm not sure how to unravel the mk maze to get that
 value. If anyone has a suggestion for that, I'd be happy to include it.

As you mention, PREFIX is only defined in ports/Mk, and it'd
definitely be undesirable to be including any of those files :)

The most robust (but unpleasant) solution would be one of the following:

PREFIX?=/usr/local
PORTSMODULESENV=SYSDIR=${SYSDIR} PATH=${PATH}:${PREFIX}/bin:${PREFIX}/sbin

or the equivalent (and perhaps cleaner, not leaving PREFIX defined)

.if !defined(PREFIX)
PORTSMODULESENV=SYSDIR=${SYSDIR} PATH=${PATH}:/usr/local/bin:/usr/local/sbin
.else
PORTSMODULESENV=SYSDIR=${SYSDIR} PATH=${PATH}:${PREFIX}/bin:${PREFIX}/sbin
.endif

Both of these will respect make.conf's setting of PREFIX.

Chris
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: PORTS_MODULES fix

2012-06-09 Thread Matthew Seaman
On 09/06/2012 18:26, Chris Rees wrote:
 On 9 June 2012 18:15, Doug Barton do...@freebsd.org wrote:
 I have recently tried the PORTS_MODULES knob, and found a problem. The
 ports tree searches for some dependencies by finding a binary in PATH,
 and that fails since by default /usr/local/ isn't there. The attached
 patch fixes that problem.

 It would be more robust to use PREFIX there instead of /usr/local
 explicitly, but I'm not sure how to unravel the mk maze to get that
 value. If anyone has a suggestion for that, I'd be happy to include it.
 
 As you mention, PREFIX is only defined in ports/Mk, and it'd
 definitely be undesirable to be including any of those files :)
 
 The most robust (but unpleasant) solution would be one of the following:
 
 PREFIX?=/usr/local
 PORTSMODULESENV=SYSDIR=${SYSDIR} PATH=${PATH}:${PREFIX}/bin:${PREFIX}/sbin
 
 or the equivalent (and perhaps cleaner, not leaving PREFIX defined)
 
 .if !defined(PREFIX)
 PORTSMODULESENV=SYSDIR=${SYSDIR} PATH=${PATH}:/usr/local/bin:/usr/local/sbin
 .else
 PORTSMODULESENV=SYSDIR=${SYSDIR} PATH=${PATH}:${PREFIX}/bin:${PREFIX}/sbin
 .endif
 
 Both of these will respect make.conf's setting of PREFIX.
 

Shouldn't you be looking for LOCALBASE rather than PREFIX in this context?

Cheers,

Matthew


-- 
Dr Matthew J Seaman MA, D.Phil.   7 Priory Courtyard
  Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate
JID: matt...@infracaninophile.co.uk   Kent, CT11 9PW





signature.asc
Description: OpenPGP digital signature


Re: PORTS_MODULES fix

2012-06-09 Thread Doug Barton
-BEGIN PGP SIGNED MESSAGE-
Hash: RIPEMD160

On 06/09/2012 10:40, Matthew Seaman wrote:
 On 09/06/2012 18:26, Chris Rees wrote:
 On 9 June 2012 18:15, Doug Barton do...@freebsd.org wrote:
 I have recently tried the PORTS_MODULES knob, and found a
 problem. The ports tree searches for some dependencies by
 finding a binary in PATH, and that fails since by default
 /usr/local/ isn't there. The attached patch fixes that
 problem.
 
 It would be more robust to use PREFIX there instead of
 /usr/local explicitly, but I'm not sure how to unravel the mk
 maze to get that value. If anyone has a suggestion for that,
 I'd be happy to include it.
 
 As you mention, PREFIX is only defined in ports/Mk, and it'd 
 definitely be undesirable to be including any of those files :)
 
 The most robust (but unpleasant) solution would be one of the
 following:
 
 PREFIX?=/usr/local PORTSMODULESENV=SYSDIR=${SYSDIR}
 PATH=${PATH}:${PREFIX}/bin:${PREFIX}/sbin
 
 or the equivalent (and perhaps cleaner, not leaving PREFIX
 defined)
 
 .if !defined(PREFIX) PORTSMODULESENV=SYSDIR=${SYSDIR}
 PATH=${PATH}:/usr/local/bin:/usr/local/sbin .else 
 PORTSMODULESENV=SYSDIR=${SYSDIR}
 PATH=${PATH}:${PREFIX}/bin:${PREFIX}/sbin .endif
 
 Both of these will respect make.conf's setting of PREFIX.
 
 
 Shouldn't you be looking for LOCALBASE rather than PREFIX in this
 context?

Both good points. New and improved attached.

Doug

- -- 

This .signature sanitized for your protection
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.19 (FreeBSD)

iEYEAREDAAYFAk/TkJkACgkQyIakK9Wy8Pv36QCeMyL31kOIIwYX/6rCoKFqhufW
unsAnjoUG31Cr5TB0GZ1YPv4+zGuz+XY
=mM5z
-END PGP SIGNATURE-
Index: kern.post.mk
===
--- kern.post.mk(revision 236818)
+++ kern.post.mk(working copy)
@@ -38,7 +38,9 @@
 
 # Handle out of tree ports 
 .if !defined(NO_MODULES)  defined(PORTS_MODULES)
-PORTSMODULESENV=SYSDIR=${SYSDIR}
+# The ports tree looks for dependencies in PATH, so we need to accommodate
+LOCALBASE?=/usr/local
+PORTSMODULESENV=SYSDIR=${SYSDIR} 
PATH=${PATH}:${LOCALBASE}/bin:${LOCALBASE}/sbin
 .for __target in all install reinstall clean
 ${__target}: ports-${__target}
 ports-${__target}:
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org

Re: PORTS_MODULES fix

2012-06-09 Thread Garrett Cooper
On Sat, Jun 9, 2012 at 11:06 AM, Doug Barton do...@freebsd.org wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: RIPEMD160

 On 06/09/2012 10:40, Matthew Seaman wrote:
 On 09/06/2012 18:26, Chris Rees wrote:
 On 9 June 2012 18:15, Doug Barton do...@freebsd.org wrote:
 I have recently tried the PORTS_MODULES knob, and found a
 problem. The ports tree searches for some dependencies by
 finding a binary in PATH, and that fails since by default
 /usr/local/ isn't there. The attached patch fixes that
 problem.

 It would be more robust to use PREFIX there instead of
 /usr/local explicitly, but I'm not sure how to unravel the mk
 maze to get that value. If anyone has a suggestion for that,
 I'd be happy to include it.

 As you mention, PREFIX is only defined in ports/Mk, and it'd
 definitely be undesirable to be including any of those files :)

 The most robust (but unpleasant) solution would be one of the
 following:

 PREFIX?=/usr/local PORTSMODULESENV=SYSDIR=${SYSDIR}
 PATH=${PATH}:${PREFIX}/bin:${PREFIX}/sbin

 or the equivalent (and perhaps cleaner, not leaving PREFIX
 defined)

 .if !defined(PREFIX) PORTSMODULESENV=SYSDIR=${SYSDIR}
 PATH=${PATH}:/usr/local/bin:/usr/local/sbin .else
 PORTSMODULESENV=SYSDIR=${SYSDIR}
 PATH=${PATH}:${PREFIX}/bin:${PREFIX}/sbin .endif

 Both of these will respect make.conf's setting of PREFIX.


 Shouldn't you be looking for LOCALBASE rather than PREFIX in this
 context?

 Both good points. New and improved attached.

Looks like my patch, only with LOCALBASE being tunable and with
with ${LOCALBASE}/sbin (in short I found a few different bugs from you
a few months ago):
http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/161452 .
Thanks!
-Garrett
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: PORTS_MODULES fix

2012-06-09 Thread Doug Barton
Ok, after reading your PR and discussion on IRC I have the following 
which incorporates all the suggestions so far. I haven't actually tested 
this yet, but if people agree that this is the right direction to go I 
will before I commit it of course.


Doug

--

It's always a long day; 86400 doesn't fit into a short.

Breadth of IT experience, and depth of knowledge in the DNS.
Yours for the right price.  :)  http://SupersetSolutions.com/
Index: kern.post.mk
===
--- kern.post.mk(revision 236818)
+++ kern.post.mk(working copy)
@@ -36,9 +36,30 @@
 .endif
 .endfor
 
-# Handle out of tree ports 
+# Handle ports (as defined by the user) that build kernel modules
 .if !defined(NO_MODULES)  defined(PORTS_MODULES)
-PORTSMODULESENV=SYSDIR=${SYSDIR}
+#
+# The ports tree needs some environment variables defined to match the new 
kernel
+#
+# Ports search for some dependencies in PATH, so add the location of the 
installed files
+LOCALBASE?=/usr/local
+# SRC_BASE is how the ports tree refers to the location of the base source 
files
+.if !defined(SRC_BASE)
+SRC_BASE!= realpath ${SYSDIR:H}/
+.endif
+# OSVERSION is used by some ports to determine build options
+.if !defined(OSRELDATE)
+# Definition copied from src/Makefile.inc1
+OSRELDATE!=awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
+   ${MAKEOBJDIRPREFIX}${SRC_BASE}/include/osreldate.h
+.endif
+# Keep the related ports builds in the obj directory so that they are only 
rebuilt once per kernel build
+WRKDIRPREFIX?= ${MAKEOBJDIRPREFIX}${SRC_BASE}/sys/${KERNCONF}/${__i}
+PORTSMODULESENV=\
+   PATH=   ${PATH}:${LOCALBASE}/bin:${LOCALBASE}/sbin \
+   SRC_BASE=   ${SRC_BASE} \
+   OSVERSION=  ${OSRELDATE} \
+   WRKDIRPREFIX=   ${WRKDIRPREFIX}
 .for __target in all install reinstall clean
 ${__target}: ports-${__target}
 ports-${__target}:
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org

Re: PORTS_MODULES fix

2012-06-09 Thread Doug Barton
Ok, never mind the last one ... this patch I've actually tested. :)

Doug

-- 

This .signature sanitized for your protection


Index: kern.post.mk
===
--- kern.post.mk(revision 236818)
+++ kern.post.mk(working copy)
@@ -36,9 +36,30 @@
 .endif
 .endfor
 
-# Handle out of tree ports 
+# Handle ports (as defined by the user) that build kernel modules
 .if !defined(NO_MODULES)  defined(PORTS_MODULES)
-PORTSMODULESENV=SYSDIR=${SYSDIR}
+#
+# The ports tree needs some environment variables defined to match the new 
kernel
+#
+# Ports search for some dependencies in PATH, so add the location of the 
installed files
+LOCALBASE?=/usr/local
+# SRC_BASE is how the ports tree refers to the location of the base source 
files
+.if !defined(SRC_BASE)
+SRC_BASE!= realpath ${SYSDIR:H}/
+.endif
+# OSVERSION is used by some ports to determine build options
+.if !defined(OSRELDATE)
+# Definition copied from src/Makefile.inc1
+OSRELDATE!=awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
+   ${MAKEOBJDIRPREFIX}${SRC_BASE}/include/osreldate.h
+.endif
+# Keep the related ports builds in the obj directory so that they are only 
rebuilt once per kernel build
+WRKDIRPREFIX?= ${MAKEOBJDIRPREFIX}${SRC_BASE}/sys/${KERNCONF}
+PORTSMODULESENV=\
+   PATH=${PATH}:${LOCALBASE}/bin:${LOCALBASE}/sbin \
+   SRC_BASE=${SRC_BASE} \
+   OSVERSION=${OSRELDATE} \
+   WRKDIRPREFIX=${WRKDIRPREFIX}
 .for __target in all install reinstall clean
 ${__target}: ports-${__target}
 ports-${__target}:
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org

Re: PORTS_MODULES fix

2012-06-09 Thread Garrett Cooper
On Jun 9, 2012, at 4:51 PM, Doug Barton wrote:

 Ok, never mind the last one ... this patch I've actually tested. :)

This one looks good :) (and fixes the item I briefly mentioned in IRC); 
I'll test it one out.
Thanks!
-Garrett___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org