kern/160443: [patch] make nanobsd builds deterministic and add $SRCCONF knob

Garrett Cooper gcooper at ixsystems.com
Sun Sep 4 00:10:09 UTC 2011


>Number:         160443
>Category:       kern
>Synopsis:       [patch] make nanobsd builds deterministic and add $SRCCONF knob
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Sep 04 00:10:08 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Garrett Cooper
>Release:        9-BETA1
>Organization:
iXsystems, Inc.
>Environment:
FreeBSD fallout.local 9.0-BETA2 FreeBSD 9.0-BETA2 #0 r225239M: Sun Aug 28 22:34:21 PDT 2011     gcooper at fallout.local:/usr/obj/usr/src/sys/FALLOUT  amd64
>Description:
The current incarnation of nanobsd doesn't deal with src.conf properly. In particular, src.conf is included before make.conf, s.t. if SRCCONF is defined in __MAKE_CONF, builds with become non-deterministic and the point of specifying SRCCONF=/dev/null will become null and moot.

The following also adds an environmental knob so people can specify $SRCCONF, if they desire.
>How-To-Repeat:
1. Check out freenas, prior to r7546.
2. echo 'WITHOUT_KERBEROS=' >> /etc/src.conf
3. sh build/do_build.sh

The build will fail with nss_ldap as it requires kerberos support.
>Fix:


Patch attached with submission follows:

Index: tools/tools/nanobsd/nanobsd.sh
===================================================================
--- tools/tools/nanobsd/nanobsd.sh	(revision 224946)
+++ tools/tools/nanobsd/nanobsd.sh	(working copy)
@@ -159,6 +159,10 @@
 # Directory to populate /data from
 NANO_DATADIR=""
 
+# src.conf to use when building the image. Defaults to /dev/null for the sake
+# of determinism.
+SRCCONF=${SRCCONF:=/dev/null}
+
 #######################################################################
 #
 # The functions which do the real work.
@@ -182,7 +186,6 @@
 
 	echo "${CONF_WORLD}" > ${NANO_MAKE_CONF_BUILD}
 	echo "${CONF_BUILD}" >> ${NANO_MAKE_CONF_BUILD}
-	echo "SRCCONF=/dev/null" >> ${NANO_MAKE_CONF_BUILD}
 )
 
 build_world ( ) (
@@ -191,6 +194,7 @@
 
 	cd ${NANO_SRC}
 	env TARGET_ARCH=${NANO_ARCH} ${NANO_PMAKE} \
+		SRCCONF=${SRCCONF} \
 		__MAKE_CONF=${NANO_MAKE_CONF_BUILD} buildworld \
 		> ${MAKEOBJDIRPREFIX}/_.bw 2>&1
 )
@@ -215,9 +219,10 @@
 	# Note: We intentionally build all modules, not only the ones in
 	# NANO_MODULES so the built world can be reused by multiple images.
 	env TARGET_ARCH=${NANO_ARCH} ${NANO_PMAKE} buildkernel \
-		__MAKE_CONF=${NANO_MAKE_CONF_BUILD} \
 		${kernconfdir:+"KERNCONFDIR="}${kernconfdir} \
 		KERNCONF=${kernconf}
+		SRCCONF=${SRCCONF} \
+		__MAKE_CONF=${NANO_MAKE_CONF_BUILD} \
 	) > ${MAKEOBJDIRPREFIX}/_.bk 2>&1
 )
 
@@ -245,7 +250,6 @@
 
 	echo "${CONF_WORLD}" > ${NANO_MAKE_CONF_INSTALL}
 	echo "${CONF_INSTALL}" >> ${NANO_MAKE_CONF_INSTALL}
-	echo "SRCCONF=/dev/null" >> ${NANO_MAKE_CONF_INSTALL}
 )
 
 install_world ( ) (
@@ -256,6 +260,7 @@
 	env TARGET_ARCH=${NANO_ARCH} \
 	${NANO_PMAKE} __MAKE_CONF=${NANO_MAKE_CONF_INSTALL} installworld \
 		DESTDIR=${NANO_WORLDDIR} \
+		SRCCONF=${SRCCONF} \
 		> ${NANO_OBJ}/_.iw 2>&1
 	chflags -R noschg ${NANO_WORLDDIR}
 )
@@ -267,8 +272,10 @@
 
 	cd ${NANO_SRC}
 	env TARGET_ARCH=${NANO_ARCH} \
-	${NANO_PMAKE} __MAKE_CONF=${NANO_MAKE_CONF_INSTALL} distribution \
+	${NANO_PMAKE} distribution \
 		DESTDIR=${NANO_WORLDDIR} \
+		SRCCONF=${SRCCONF} \
+		__MAKE_CONF=${NANO_MAKE_CONF_INSTALL} \
 		> ${NANO_OBJ}/_.etc 2>&1
 	# make.conf doesn't get created by default, but some ports need it
 	# so they can spam it.
@@ -290,10 +297,11 @@
 	cd ${NANO_SRC}
 	env TARGET_ARCH=${NANO_ARCH} ${NANO_PMAKE} installkernel \
 		DESTDIR=${NANO_WORLDDIR} \
-		__MAKE_CONF=${NANO_MAKE_CONF_INSTALL} \
 		${kernconfdir:+"KERNCONFDIR="}${kernconfdir} \
 		KERNCONF=${kernconf} \
 		MODULES_OVERRIDE="${NANO_MODULES}"
+		SRCCONF=${SRCCONF} \
+		__MAKE_CONF=${NANO_MAKE_CONF_INSTALL} \
 	) > ${NANO_OBJ}/_.ik 2>&1
 )
 


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list