Subject: read-only pkgsrc
To: None <tech-pkg@netbsd.org>
From: Jan Schaumann <jschauma@netmeister.org>
List: tech-pkg
Date: 04/05/2004 10:17:20
--P+33d92oIH25kiaB
Content-Type: multipart/mixed; boundary="Qbvjkv9qwOGw/5Fx"
Content-Disposition: inline


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

Hi,

I think Grant mentioned this before:  at the moment, pkgsrc can't be
read-only because even with WRKOBJDIR set, it will create symlinks for
the workdir.  The attached patch fixes this by allowing the user to set
PKGSRC_READONLY, and, if that is set, default to /tmp as
WRKDIR_BASENAME.  With PKGSRC_READONLY set, we might want to consider
some more defaults: DISTDIR, PACKAGES, ... ?

What else?

-Jan

--=20
   This is so cool I've to go to the bathroom.

--Qbvjkv9qwOGw/5Fx
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="pkgsrc.readonly"
Content-Transfer-Encoding: quoted-printable

Index: bsd.pkg.defaults.mk
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/pkgsrc/mk/bsd.pkg.defaults.mk,v
retrieving revision 1.227
diff -b -u -r1.227 bsd.pkg.defaults.mk
--- bsd.pkg.defaults.mk	4 Apr 2004 07:09:38 -0000	1.227
+++ bsd.pkg.defaults.mk	5 Apr 2004 14:03:49 -0000
@@ -60,6 +60,13 @@
 # Possible: a positive integer
 # Default: 5
=20
+PKGSRC_READONLY?=3D no
+# Consider the pkgsrc tree read-only;  that is, do not create any temporary
+# files in this hierarchy.  If set to yes, implies WRKDIR_BASENAME=3D"" as
+# well as WRKOBJDIR pointing to a writeable file system.
+# Possible: yes, YES, no, NO
+# Default: no
+
 #USETBL=3D
 # Run raw manual pages through tbl(1) before piping through troff(1)
 # when formatting manual pages.
Index: bsd.pkg.mk
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/pkgsrc/mk/bsd.pkg.mk,v
retrieving revision 1.1436
diff -b -u -r1.1436 bsd.pkg.mk
--- bsd.pkg.mk	3 Apr 2004 06:22:39 -0000	1.1436
+++ bsd.pkg.mk	5 Apr 2004 14:03:49 -0000
@@ -2025,15 +2025,17 @@
 	${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${WRKDIR}
 .ifdef WRKOBJDIR
 .  if ${PKGSRC_LOCKTYPE} =3D=3D "sleep" || ${PKGSRC_LOCKTYPE} =3D=3D "once"
-.    if !exists(${LOCKFILE})
+.    if !exists(${LOCKFILE}) && !empty(WRKDIR_BASENAME)
 	${_PKG_SILENT}${_PKG_DEBUG}					\
 	${RM} -f ${WRKDIR_BASENAME} || ${TRUE}
 .    endif
 .  endif
+.  if !empty(WRKDIR_BASENAME)
 	${_PKG_SILENT}${_PKG_DEBUG}					\
 	if ${LN} -s ${WRKDIR} ${WRKDIR_BASENAME} 2>/dev/null; then	\
 		${ECHO} "${WRKDIR_BASENAME} -> ${WRKDIR}";		\
 	fi
+.  endif
 .endif # WRKOBJDIR
=20
 _EXTRACT_SUFFIXES=3D	.tar.gz .tgz .tar.bz2 .tbz .tar.Z .tar _tar.gz
@@ -3712,8 +3714,11 @@
 	fi
 .  ifdef WRKOBJDIR
 	-${_PKG_SILENT}${_PKG_DEBUG}					\
-	${RMDIR} ${BUILD_DIR} 2>/dev/null;				\
+	${RMDIR} ${BUILD_DIR} 2>/dev/null;
+.    if !empty(WRKDIR_BASENAME)                                          =
=20
+	-${_PKG_SILENT}${_PKG_DEBUG}					\
 	${RM} -f ${WRKDIR_BASENAME}
+.    endif
 .  endif
 .endif
=20
Index: bsd.prefs.mk
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/pkgsrc/mk/bsd.prefs.mk,v
retrieving revision 1.158
diff -b -u -r1.158 bsd.prefs.mk
--- bsd.prefs.mk	4 Apr 2004 07:09:38 -0000	1.158
+++ bsd.prefs.mk	5 Apr 2004 14:03:49 -0000
@@ -465,6 +465,12 @@
=20
 _PKGSRC_DEPS?=3D		# empty
=20
+# Set defaults for a read-only pkgsrc tree
+.if !empty(PKGSRC_READONLY:M[yY][eE][sS])
+WRKOBJDIR?=3D		/tmp
+WRKDIR_BASENAME=3D	""
+.endif
+
 # If WRKOBJDIR is set, use that tree to build
 .if defined(WRKOBJDIR)
 BUILD_DIR?=3D		${WRKOBJDIR}/${PKGPATH}

--Qbvjkv9qwOGw/5Fx--

--P+33d92oIH25kiaB
Content-Type: application/pgp-signature
Content-Disposition: inline

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

iD8DBQFAcWpwfFtkr68iakwRAkXtAKD6TltINhQTOM5f23mACRJdXSHc2ACg+eYr
HQyRKPDl5eCNiXCFFthMpvU=
=oqfD
-----END PGP SIGNATURE-----

--P+33d92oIH25kiaB--