Subject: clean after etcupdate
To: None <tech-toolchain@netbsd.org>
From: rudolf <netbsd@eq.cz>
List: tech-toolchain
Date: 01/11/2007 00:15:41
This is a multi-part message in MIME format.
--------------060102070405080308070205
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hi,

etcupdate can leave some files (MAKEDEV) in ${SRCDIR}/etc (SRCDIR 
defaults to /usr/src/etc) when invoked without arguments or with "-s 
srcdir". This can make next attempt to build userland from the sources 
unsuccessful.

There are two PRs: 28533 (closed - could not reproduce), 31550 (open), 
which are probably results of this situation - described in detail at 
http://mail-index.netbsd.org/current-users/2006/08/31/0015.html 
(reference from PR/31550).

The attached patch can eliminate this possible source of problems.

Please CC me your replies.

Thanks,

r.

--------------060102070405080308070205
Content-Type: text/x-patch;
 name="etcupdate.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="etcupdate.diff"

--- usr.sbin/etcupdate/etcupdate.orig	2007-01-10 23:25:40.000000000 +0100
+++ usr.sbin/etcupdate/etcupdate	2007-01-10 23:23:45.000000000 +0100
@@ -356,6 +356,23 @@
 	rm -f "._etcupdate_${TEMPROOT}${1}"
 }
 
+# Set the environment for make.
+set_makeenv() {
+	#
+	# INSTALL_DONE=1 prevents installation of unwanted
+	# files (things that are not part of the etc set).
+	# BUILD=1 allows building of files that are wanted.
+	#
+	MAKE_ENV=" 			\
+		DESTDIR=${TEMPROOT}	\
+		MAKE=make		\
+		MTREE=mtree		\
+		TOOL_MTREE=mtree	\
+		INSTALL_DONE=1		\
+		BUILD=1			\
+		USETOOLS=never"
+}
+
 #
 # main()
 #
@@ -535,19 +552,7 @@
 			echo "*** ERROR: Unable to find ${SRCDIR}/etc/Makefile"
 			exit 1
 		fi
-		# Set the environment for make.
-		#
-		# INSTALL_DONE=1 prevents installation of unwanted
-		# files (things that are not part of the etc set).
-		# BUILD=1 allows building of files that are wanted.
-		MAKE_ENV=" 			\
-			DESTDIR=${TEMPROOT}	\
-			MAKE=make		\
-			MTREE=mtree		\
-			TOOL_MTREE=mtree	\
-			INSTALL_DONE=1		\
-			BUILD=1			\
-			USETOOLS=never"
+		set_makeenv
 		echo "*** Populating ${TEMPROOT} from ${SRCDIR}"
 		cd ${SRCDIR}/etc
 		if ! ${VERBOSE}; then
@@ -614,6 +619,18 @@
 	echo "*** Keeping ${TEMPROOT}"
 fi
 
+# Clean up after "make distribution"
+if ! ${BINARYMODE}; then
+	echo "*** Cleaning up in ${SRCDIR}/etc"
+	set_makeenv
+	cd ${SRCDIR}/etc
+	if ! ${VERBOSE}; then
+		eval ${MAKE_ENV} make clean > /dev/null
+	else
+		eval ${MAKE_ENV} make clean
+	fi
+fi
+                        
 # Do some post-installation tasks
 if ${NEED_MTREE}; then
 	if yesno "You have created new directories. Run mtree to set" \

--------------060102070405080308070205--