NetBSD Problem Report #16133

Received: (qmail 2767 invoked from network); 30 Mar 2002 20:38:18 -0000
Message-Id: <20020330203801.BA5FD1D199@otaku.Xtrmntr.org>
Date: Sat, 30 Mar 2002 21:38:01 +0100 (CET)
From: Lubomir Sedlacik <salo@Xtrmntr.org>
Reply-To: salo@Xtrmntr.org
To: gnats-bugs@gnats.netbsd.org
Subject: patch to enable OBJOPSYS in WORKDIR for pkgsrc packages
X-Send-Pr-Version: 3.95

>Number:         16133
>Category:       pkg
>Synopsis:       patch to enable OBJOPSYS in WORKDIR for pkgsrc packages
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    agc
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Mar 30 20:39:00 +0000 2002
>Closed-Date:    Fri May 17 17:18:05 +0000 2002
>Last-Modified:  Wed May 13 13:21:17 +0000 2015
>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:

From: woods@weird.com (Greg A. Woods)
To: salo@Xtrmntr.org
Cc: gnats-bugs@gnats.netbsd.org (NetBSD GNATS submissions and followups),
	netbsd-bugs@NetBSD.ORG (NetBSD Bugs and PR posting List)
Subject: Re: pkg/16133: patch to enable OBJOPSYS in WORKDIR for pkgsrc packages
Date: Sat, 30 Mar 2002 17:42:15 -0500 (EST)

 [ On Saturday, March 30, 2002 at 21:38:01 (+0100), Lubomir Sedlacik wrote: ]
 > Subject: pkg/16133: patch to enable OBJOPSYS in WORKDIR for pkgsrc packages
 >
 > 
 > 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).

 Certainly there's an easy way to solve this!  You just have to go back
 one level to use a switchable WRKOBJDIR -- i.e. a common setting of
 WRKOBJDIR that points to a location where a unique-per-system symlink
 can be used.

 All you'll need is a startup script run automatically at boot in each
 system to swap the target of a single local symlink.  That symlink is of
 course pointed to by the setting of WRKOBJDIR.  Eg. like this (line
 numbers approximate):

 Index: bsd.pkg.defaults.mk
 ===================================================================
 RCS file: /cvs/master/m-NetBSD/main/pkgsrc/mk/bsd.pkg.defaults.mk,v
 retrieving revision 1.47
 diff -c -r1.47 bsd.pkg.defaults.mk
 *** bsd.pkg.defaults.mk 26 Mar 2002 08:24:59 -0000      1.47
 --- bsd.pkg.defaults.mk 28 Mar 2002 05:19:26 -0000
 ***************
 *** 66,75 ****
   # Possible: defined, not defined
   # Default: not defined

 ! #WRKOBJDIR=   /usr/tmp
   # build here instead of in pkgsrc
 ! # Possible: any path
 ! # Default: not defined

   LOCALBASE?=   /usr/pkg
   # Where non-X-based packages will be installed
 --- 77,87 ----
   # Possible: defined, not defined
   # Default: not defined

 ! WRKOBJDIR?=   /var/package-obj
   # build here instead of in pkgsrc
 ! # Possible: any path you like (can be a symlink)
 ! # Note: must remain constant for all hosts sharing 
 ! # Default: /var/package-obj

   LOCALBASE?=   /usr/pkg
   # Where non-X-based packages will be installed


 Then during boot just make the /var/package-obj symlink point to the
 (local?) heirarchy that's appropriate for the currently booting system.


 Using just a single symlink pointed to by WRKOBJDIR also means that
 there only has to be one common shared convenience symlinks in the
 source tree (i.e. in /usr/pkgsrc) even if you use the same pkgsrc tree
 simultaneously via NFS on multiple systems.

 However if you do simultaneous builds on multiple system from a shared
 NFS server you will also need this patch (as I discussed a while back in
 tech-pkg) (line numbers are very approximate):

 Index: bsd.pkg.mk
 ===================================================================
 RCS file: /cvs/master/m-NetBSD/main/pkgsrc/mk/bsd.pkg.mk,v
 retrieving revision 1.954
 diff -c -r1.954 bsd.pkg.mk
 *** bsd.pkg.mk  26 Mar 2002 16:31:27 -0000      1.954
 --- bsd.pkg.mk  28 Mar 2002 05:48:43 -0000
 ***************
 *** 1516,1529 ****
   .endif
         ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${WRKDIR}
   .ifdef WRKOBJDIR
 - .  if ${PKGSRC_LOCKTYPE} == "sleep" || ${PKGSRC_LOCKTYPE} == "once"
 - .    if !exists(${LOCKFILE})
 -       ${_PKG_SILENT}${_PKG_DEBUG}                                     \
 -       ${RM} -f ${WRKDIR_BASENAME} || ${TRUE}
 - .    endif
 - .  endif
         ${_PKG_SILENT}${_PKG_DEBUG}                                     \
 !       if ${LN} -s ${WRKDIR} ${WRKDIR_BASENAME} 2>/dev/null; then      \
                 ${ECHO} "${WRKDIR_BASENAME} -> ${WRKDIR}";              \
         fi
   .endif # WRKOBJDIR
 --- 1594,1603 ----
   .endif
         ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${WRKDIR}
   .ifdef WRKOBJDIR
         ${_PKG_SILENT}${_PKG_DEBUG}                                     \
 !       if [ ! -h ${WRKDIR_BASENAME} ]; then                            \
 !               ${RM} -rf ${WRKDIR_BASENAME};                           \
 !               ${LN} -s ${WRKDIR} ${WRKDIR_BASENAME};                  \
                 ${ECHO} "${WRKDIR_BASENAME} -> ${WRKDIR}";              \
         fi
   .endif # WRKOBJDIR
 ***************
 *** 2744,2752 ****
                 fi;                                                     \
         fi
   .  ifdef WRKOBJDIR
 !       -${_PKG_SILENT}${_PKG_DEBUG}                                    \
 !       ${RMDIR} ${BUILD_DIR} 2>/dev/null;                              \
 !       ${RM} -f ${WRKDIR_BASENAME}
   .  endif
   .endif

 --- 2847,2853 ----
                 fi;                                                     \
         fi
   .  ifdef WRKOBJDIR
 !       -${_PKG_SILENT}${_PKG_DEBUG}${RMDIR} ${BUILD_DIR} 2>/dev/null;
   .  endif
   .endif



 -- 
 								Greg A. Woods

 +1 416 218-0098;  <gwoods@acm.org>;  <g.a.woods@ieee.org>;  <woods@robohack.ca>
 Planix, Inc. <woods@planix.com>; VE3TCP; Secrets of the Weird <woods@weird.com>

From: Lubomir Sedlacik <salo@Xtrmntr.org>
To: NetBSD GNATS submissions and followups <gnats-bugs@gnats.netbsd.org>,
	NetBSD Bugs and PR posting List <netbsd-bugs@NetBSD.ORG>
Cc: "Greg A. Woods" <woods@weird.com>
Subject: Re: pkg/16133: patch to enable OBJOPSYS in WORKDIR for pkgsrc packages
Date: Sat, 30 Mar 2002 23:58:01 +0100

 --J2SCkAp4GZ/dPZZf
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable

 hi,

 On Sat, Mar 30, 2002 at 05:42:15PM -0500, Greg A. Woods wrote:
 > Certainly there's an easy way to solve this!  You just have to go back
 > one level to use a switchable WRKOBJDIR -- i.e. a common setting of
 > WRKOBJDIR that points to a location where a unique-per-system symlink
 > can be used.
 >
 > All you'll need is a startup script run automatically at boot in each
 > system to swap the target of a single local symlink.  That symlink is
 > of course pointed to by the setting of WRKOBJDIR.  Eg. like this (line
 > numbers approximate):

 my WRKOBJDIR is on NFS server.

 [...]

 > Using just a single symlink pointed to by WRKOBJDIR also means that
 > there only has to be one common shared convenience symlinks in the
 > source tree (i.e. in /usr/pkgsrc) even if you use the same pkgsrc tree
 > simultaneously via NFS on multiple systems.
 >=20
 > However if you do simultaneous builds on multiple system from a shared
 > NFS server you will also need this patch (as I discussed a while back
 > in tech-pkg) (line numbers are very approximate):

 [...]

 your easy way looks very complicated for me :)

 i still think that my idea is somewhat simpler and solves more
 situations, like mentioned WRKOBJDIR on the same NFS server (i have
 JavaStations and other diskless clients too).

 thanks for your opinion,

 regards,

 --=20
 -- Lubomir Sedlacik <salo@Xtrmntr.org>   ASCII Ribbon campaign against  /"\=
  --
 --                  <salo@silcnet.org>   e-mail in gratuitous HTML and  \ /=
  --
 --                                       Microsoft proprietary formats   X =
  --
 -- PGPkey: http://Xtrmntr.org/salo.pgp                                  / \=
  --
 -- Key Fingerprint: DBEC 8BEC 9A90 ECEC 0FEF  716E 59CE B70B 7E3B 70E2     =
  --

 --J2SCkAp4GZ/dPZZf
 Content-Type: application/pgp-signature
 Content-Disposition: inline

 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.0.6 (NetBSD)
 Comment: For info see http://www.gnupg.org

 iD8DBQE8pkL4Wc63C347cOIRAswPAKCp2Qf8GJztn2Za+1a5fpJal21pwgCgz+8o
 yg8GDjlUVG45k9nNfunWxjQ=
 =gl3F
 -----END PGP SIGNATURE-----

 --J2SCkAp4GZ/dPZZf--
State-Changed-From-To: open->feedback 
State-Changed-By: agc 
State-Changed-When: Thu May 16 08:21:56 PDT 2002 
State-Changed-Why:  
I've set the PR into feedback state, since I have a suggestion: 

You could accomplist the desired effect by setting WRKDIR_BASENAME to 
work.${OPSYS} in /etc/mk.conf. 



Responsible-Changed-From-To: pkg-manager->agc 
Responsible-Changed-By: agc 
Responsible-Changed-When: Thu May 16 08:21:56 PDT 2002 
Responsible-Changed-Why:  
agc requested feedback from submitter 

From: Thomas Klausner <wiz@danbala.ifoer.tuwien.ac.at>
To: Lubomir Sedlacik <salo@Xtrmntr.org>
Cc: agc@netbsd.org, gnats-bugs@netbsd.org
Subject: Re: pkg/16133
Date: Thu, 16 May 2002 19:19:11 +0200

 On Thu, May 16, 2002 at 07:13:12PM +0200, Lubomir Sedlacik wrote:
 > On Thu, May 16, 2002 at 03:24:18PM -0000, agc@netbsd.org wrote:
 > > You could accomplist the desired effect by setting WRKDIR_BASENAME to
 > > work.${OPSYS} in /etc/mk.conf.
 [...]
 > now, you can set OBJHOSTNAME on client1 and client2 and OPSYS on
 > client3, but this will fail again when you have client4 with the same
 > environment as client3--another collision.

 Why not just use both, like work.${OBJHOSTNAME}.${OPSYS}?

 Bye,
  Thomas

 -- 
 Thomas Klausner - wiz@danbala.tuwien.ac.at
 When all other means of communication fail, try words.

From: Lubomir Sedlacik <salo@Xtrmntr.org>
To: Thomas Klausner <wiz@danbala.ifoer.tuwien.ac.at>
Cc: agc@netbsd.org, gnats-bugs@netbsd.org
Subject: Re: pkg/16133
Date: Fri, 17 May 2002 19:15:01 +0200

 --St7VIuEGZ6dlpu13
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable

 On Thu, May 16, 2002 at 07:19:11PM +0200, Thomas Klausner wrote:
 > On Thu, May 16, 2002 at 07:13:12PM +0200, Lubomir Sedlacik wrote:
 > > On Thu, May 16, 2002 at 03:24:18PM -0000, agc@netbsd.org wrote:
 > > > You could accomplist the desired effect by setting WRKDIR_BASENAME to
 > > > work.${OPSYS} in /etc/mk.conf.
 > [...]
 > > now, you can set OBJHOSTNAME on client1 and client2 and OPSYS on
 > > client3, but this will fail again when you have client4 with the same
 > > environment as client3--another collision.
 >=20
 > Why not just use both, like work.${OBJHOSTNAME}.${OPSYS}?

 yes, you are right.. it seems that i wanted to reinvent the wheel here..
 i should take a break and relax for few days ;). thank you and sorry for
 bothering you. i think we can close this PR. thanks everyone involved,
 the show is over.

 regards,

 --=20
 -- Lubomir Sedlacik <salo@Xtrmntr.org>   ASCII Ribbon campaign against  /"\=
  --
 --                  <salo@silcnet.org>   e-mail in gratuitous HTML and  \ /=
  --
 --                                       Microsoft proprietary formats   X =
  --
 -- PGPkey: http://Xtrmntr.org/salo.pgp                                  / \=
  --
 -- Key Fingerprint: DBEC 8BEC 9A90 ECEC 0FEF  716E 59CE B70B 7E3B 70E2     =
  --

 --St7VIuEGZ6dlpu13
 Content-Type: application/pgp-signature
 Content-Disposition: inline

 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.0.7 (NetBSD)

 iD8DBQE85TqVWc63C347cOIRAhFfAJ49vpfRXZyiiDjKSkHdsUk1gLD66ACg5JWY
 +0yVmySFcBrX+6O6Oz9PeK8=
 =hPbK
 -----END PGP SIGNATURE-----

 --St7VIuEGZ6dlpu13--
State-Changed-From-To: feedback->closed 
State-Changed-By: wiz 
State-Changed-When: Fri May 17 10:17:40 PDT 2002 
State-Changed-Why:  
Found an existing way that satisfies the submitter. 
Thanks for the PR. 

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.