Subject: pkg/16133: patch to enable OBJOPSYS in WORKDIR for pkgsrc packages
To: None <gnats-bugs@gnats.netbsd.org>
From: Lubomir Sedlacik <salo@Xtrmntr.org>
List: netbsd-bugs
Date: 03/30/2002 21:38:01
>Number:         16133
>Category:       pkg
>Synopsis:       patch to enable OBJOPSYS in WORKDIR for pkgsrc packages
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Mar 30 12:39:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Lubomir Sedlacik
>Release:        NetBSD 1.5ZB
>Organization:
>Environment:
>Description:

imagine a environment where you have dual-booted machine with different
operating systems, both using pkgsrc mounted from remote nfs server.
currently there is no way to define non-colliding WRKDIR for each of these
systems because you can only specify OBJMACHINE, which is for both of them
identical and OBJHOSTNAME, which can be identical too (as it is in my case).

this patch provides a simple mechanism to solve this issue by adding value of
$LOWER_OPSYS to the end of WRKDIR_BASENAME either for $OBJMACHINE or
$OBJHOSTNAME used.

to enable this feature one need to define OBJOPSYS in /etc/mk.conf

>How-To-Repeat:
>Fix:

--- bsd.pkg.mk.orig	Wed Mar 27 15:06:11 2002
+++ bsd.pkg.mk	Sat Mar 30 21:17:30 2002
@@ -409,14 +409,24 @@
 
 # If OBJHOSTNAME is set, use first component of hostname in directory name
 # If OBJMACHINE is set, use ${MACHINE_ARCH} in the working directory name
+# If OBJOPSYS is set and either OBJHOSTNAME or OBJMACHINE is set, append
+# ${LOWER_OPSYS} to the working directory name
 .if defined(OBJHOSTNAME)
 .  if !defined(_HOSTNAME)
 _HOSTNAME!= ${UNAME} -n
 MAKEFLAGS+= _HOSTNAME=${_HOSTNAME}
 .  endif
+.  if defined(OBJOPSYS)
+WRKDIR_BASENAME?=	work.${_HOSTNAME:C|\..*||}.${LOWER_OPSYS}
+.  else
 WRKDIR_BASENAME?=	work.${_HOSTNAME:C|\..*||}
+.  endif
 .elif defined(OBJMACHINE)
+.  if defined(OBJOPSYS)
+WRKDIR_BASENAME?=	work.${MACHINE_ARCH}.${LOWER_OPSYS}
+.  else
 WRKDIR_BASENAME?=	work.${MACHINE_ARCH}
+.  endif
 .else
 WRKDIR_BASENAME?=	work
 .endif

--- bsd.pkg.defaults.mk.orig	Wed Mar 27 15:06:11 2002
+++ bsd.pkg.defaults.mk	Sat Mar 30 21:32:23 2002
@@ -31,6 +31,13 @@
 # Possible: defined, not defined
 # Default: not defined
 
+#OBJOPSYS=
+# use operating system-specific object directories, e.g. work.localhost.netbsd,
+# work.sparc.solaris, work.i386.netbsd
+# Used only if either OBJHOSTNAME or OBJMACHINE is set (see above).
+# Possible: defined, not defined
+# Default: not defined
+
 PKGSRC_LOCKTYPE?= none
 # The type of locking which will be done if competing processes attempt to
 # do work on one package directory simultaneously.
>Release-Note:
>Audit-Trail:
>Unformatted: