Subject: Re: goals for NetBSD binary packages
To: None <tech-pkg@NetBSD.org>
From: Jan Schaumann <jschauma@netmeister.org>
List: tech-pkg
Date: 04/28/2005 12:14:47
--GRPZ8SYKNexpdSJ7
Content-Type: multipart/mixed; boundary="Qxx1br4bt0+wmkIi"
Content-Disposition: inline


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

Jan Schaumann <jschauma@netmeister.org> wrote:
> John Klos <john@ziaspace.com> wrote:
>=20
> > After 25 hours, a 60 MHz m68060 Amiga is still doing up and down
> > dependency files. It'd be nice if all of this work could be done on a
> > fast machine and the slow machines could just do the actual
> > compiling...
>=20
> That should be possible -- you should be able to run 'make bulk-cache'
> in /usr/pkgsrc on a different machine and copy over the files.  We'd
> probably need some glue and a flag to run the bulk-build without
> rebuilding this, but that should not be all too complex.

How about the attached patch?

This way, on a fast machine you can

cd /usr/pkgsrc
make BATCH=3Dyes bulk-cache

then copy the files ${BULK_DBFILE} ${DEPENDSTREEFILE} ${INDEXFILE}
${ORDERFILE} ${SUPPORTSFILE} and ${DEPENDSFILE} onto the slower machine,
set PRESERVE_BULK_CACHE=3Dyes in your build.conf and save a few hours/days
of work.

-Jan

--=20
``Life is too short to stay entirely sober.'' -- Chuck Swiger

--Qxx1br4bt0+wmkIi
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=diff
Content-Transfer-Encoding: quoted-printable

Index: bsd.bulk-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/bulk/bsd.bulk-pkg.mk,v
retrieving revision 1.79
diff -b -u -r1.79 bsd.bulk-pkg.mk
--- bsd.bulk-pkg.mk	11 Apr 2005 11:18:01 -0000	1.79
+++ bsd.bulk-pkg.mk	28 Apr 2005 16:07:32 -0000
@@ -160,7 +160,9 @@
 # Note:  we have to install the BULK_PREREQ packages _before_
 # extracting the depends tree because some packages like
 # xpkgwedge only become DEPENDS if it is installed
-bulk-cache:
+bulk-cache:	${BULK_DBFILE} ${DEPENDSTREEFILE} ${INDEXFILE} ${ORDERFILE} ${=
SUPPORTSFILE} ${DEPENDSFILE}
+
+${BULK_DBFILE}:
 	@${ECHO_MSG} "BULK> Installing BULK_PREREQ packages"
 .for __prereq in ${BULK_PREREQ}
 	cd ${PKGSRCDIR}/${__prereq} && ${MAKE} bulk-install
@@ -168,38 +170,75 @@
 	${RM} -f ${BULK_DBFILE}
 	${TOUCH} ${BULK_DBFILE}
 .if !defined(SPECIFIC_PKGS)
-	@${ECHO} "This file is unused for a full pkgsrc bulk build" >> ${BULK_DBF=
ILE}
-	@${ECHO} "It is only used for a SPECIFIC_PKGS bulk build" >> ${BULK_DBFIL=
E}
-	@${ECHO_MSG} "BULK> Building complete pkgsrc dependency tree (this may ta=
ke a while)."
-	cd ${PKGSRCDIR} && ${SETENV} BMAKE=3D${MAKE} ${SH} mk/bulk/printdepends $=
{BROKENFILE} > ${DEPENDSTREEFILE}
-	@${ECHO_MSG} "BULK> Generating package name <=3D> package directory cross=
 reference file"
-	@${ECHO_MSG} "      (this may take a while)."
-	cd ${PKGSRCDIR} && ${SETENV} BMAKE=3D${MAKE} ${SH} mk/bulk/printindex ${B=
ROKENFILE} > ${INDEXFILE}
+	@${ECHO} "This file is unused for a full pkgsrc bulk build" 	\
+							>> ${BULK_DBFILE}
+	@${ECHO} "It is only used for a SPECIFIC_PKGS bulk build" 	\
+							>> ${BULK_DBFILE}
 .else
 	@${ECHO_MSG} "BULK> Extracting database for SPECIFIC_PKGS subset of pkgsr=
c"
 	@${ECHO_MSG} "      along with their dependencies"
-.for __tmp__ in ${SUBDIR} ${BULK_PREREQ} ${PERL5_PKGSRCDIR:C|.*/([^/]*/[^/=
]*)$|\1|} pkgtools/pkglint
-	cd ${PKGSRCDIR}/${__tmp__} && ${SETENV} BMAKE=3D${MAKE} AWK=3D${AWK} EXPR=
=3D${EXPR} ${SH} ../../mk/scripts/mkdatabase -a -f ${BULK_DBFILE}
-.endfor
+.  for __tmp__ in ${SUBDIR} ${BULK_PREREQ} 				\
+		${PERL5_PKGSRCDIR:C|.*/([^/]*/[^/]*)$|\1|} pkgtools/pkglint
+	cd ${PKGSRCDIR}/${__tmp__} && 					\
+		${SETENV} BMAKE=3D${MAKE} AWK=3D${AWK} EXPR=3D${EXPR} 	\
+			${SH} ../../mk/scripts/mkdatabase -a -f ${BULK_DBFILE}
+.  endfor
+.endif
+
+${DEPENDSTREEFILE}:	${BULK_DBFILE}
+.if !defined(SPECIFIC_PKGS)
+	@${ECHO_MSG} "BULK> Building complete pkgsrc dependency tree (this may ta=
ke a while)."
+	cd ${PKGSRCDIR} && ${SETENV} BMAKE=3D${MAKE} 			\
+		${SH} mk/bulk/printdepends ${BROKENFILE} > ${DEPENDSTREEFILE}
+.else
 	@${ECHO_MSG} "BULK> Extracting dependency tree file"
-	${AWK} '/^(build_)?depends/ {pkgs[$$2] =3D 1; cat=3D$$2; sub(/\/.*/, "", =
cat); \
-		for(i=3D3; i<=3DNF; i=3Di+1){ \
+	${AWK} '							\
+		/^(build_)?depends/ {					\
+			pkgs[$$2] =3D 1;					\
+			cat=3D$$2; 					\
+			sub(/\/.*/, "", cat); 				\
+			for(i=3D3; i<=3DNF; i=3Di+1) { 			\
 			listed[$$2] =3D 1; \
 			sub(/[^:]*:\.\.\/\.\.\//, "", $$i); \
 			sub(/[^:]*:\.\./, cat , $$i); \
 			print $$i " " $$2; \
-		}} END{ \
-		for(pkg in pkgs) {if( pkg in listed ) {} else{ print pkg " " pkg;}} \
+			}						\
+		}							\
+		END{ 							\
+			for(pkg in pkgs) {				\
+				if( pkg in listed ) {} 			\
+				else{ print pkg " " pkg;}		\
+			} 						\
 		}' \
 		${BULK_DBFILE} | ${_SORT} -u > ${DEPENDSTREEFILE}
+.endif
+
+${INDEXFILE}:	${DEPENDSTREEFILE}
+	@${ECHO_MSG} "BULK> Generating package name <=3D> package directory cross=
 reference file"
+	@${ECHO_MSG} "      (this may take a while)."
+.if !defined(SPECIFIC_PKGS)
+	cd ${PKGSRCDIR} && ${SETENV} BMAKE=3D${MAKE} ${SH} mk/bulk/printindex ${B=
ROKENFILE} > ${INDEXFILE}
+.else
 	@${ECHO_MSG} "BULK> Extracting package name <=3D> package directory cross=
 reference file"
 	${AWK} '/^index/ {print $$2 " " $$3 " "}' ${BULK_DBFILE} > ${INDEXFILE}
 .endif
+
+${ORDERFILE}:	${DEPENDSTREEFILE}
 	@${ECHO_MSG} "BULK> Sorting build order."
 	${TSORT} ${DEPENDSTREEFILE} > ${ORDERFILE}
-	@${ECHO_MSG} "BULK> Generating up and down dependency files."
-	${SETENV} SORT=3D${_SORT:Q} ${AWK} -f ${PKGSRCDIR}/mk/bulk/tflat up ${DEP=
ENDSTREEFILE} > ${SUPPORTSFILE}
-	${SETENV} SORT=3D${_SORT:Q} ${AWK} -f ${PKGSRCDIR}/mk/bulk/tflat down ${D=
EPENDSTREEFILE} > ${DEPENDSFILE}
+
+${SUPPORTSFILE}:	${ORDERFILE}
+	@${ECHO_MSG} "BULK> Generating up dependency file."
+	${SETENV} SORT=3D${_SORT:Q} 					\
+	${AWK} -f ${PKGSRCDIR}/mk/bulk/tflat up ${DEPENDSTREEFILE} 	\
+			> ${SUPPORTSFILE}
+
+
+${DEPENDSFILE}:	${ORDERFILE}
+	@${ECHO_MSG} "BULK> Generating down dependency file."
+	${SETENV} SORT=3D${_SORT:Q} 					\
+	${AWK} -f ${PKGSRCDIR}/mk/bulk/tflat down ${DEPENDSTREEFILE} 	\
+			> ${DEPENDSFILE}
=20
 # remove the bulk cache files
 clean-bulk-cache:
Index: build
=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/bulk/build,v
retrieving revision 1.48
diff -b -u -r1.48 build
--- build	14 Jan 2005 15:32:34 -0000	1.48
+++ build	28 Apr 2005 16:07:32 -0000
@@ -276,6 +276,9 @@
 # Create the bulk cache files
 cd ${USR_PKGSRC}
 if [ "x$restart" !=3D "xyes" ]; then
+	if [ "x${PRESERVE_BULK_CACHE}" !=3D "xyes" ]; then
+		rm -f $BULK_DBFILE $DEPENDSTREEFILE $DEPENDSFILE $SUPPORTSFILE $INDEXFIL=
E $ORDERFILE
+	fi
 	cd ${USR_PKGSRC} && ${BMAKE} bulk-cache $makeargs
 	if [ $? !=3D 0 ]; then
 		echo "$0: Cache creation failed.  Aborting build."
Index: build.conf-example
=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/bulk/build.conf-example,v
retrieving revision 1.28
diff -b -u -r1.28 build.conf-example
--- build.conf-example	22 Mar 2005 16:42:52 -0000	1.28
+++ build.conf-example	28 Apr 2005 16:07:32 -0000
@@ -36,6 +36,13 @@
 #CVS_FLAGS=3D"-rnetbsd-2005Q1"
 #CVS_FLAGS=3D"-A"				# pkgsrc-current
=20
+# preserve bulk-cache files
+# can be set to 'yes' or 'no'
+# useful on slow architectures, where you have generated the
+# bulk-cache files on a faster machine by running 'make bulk-cache' from
+# USR_PKGSRC
+PRESERVE_BULK_CACHE=3Dno
+
 # prune distfiles to remove those which are out of date
 # can be set to 'yes' or 'no'.
 PRUNEDISTFILES=3Dno

--Qxx1br4bt0+wmkIi--

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

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

iD8DBQFCcQv3fFtkr68iakwRAp6/AKDPP/iRGl6lDE0oeznsx9QuXwdIaQCgxPrj
8fAgcqAshRytsRmFoBXEpJg=
=Tska
-----END PGP SIGNATURE-----

--GRPZ8SYKNexpdSJ7--