Subject: Re: use of ls in mk/bulk/post-build
To: Todd Vierling <tv@duh.org>
From: Jeremy C. Reed <reed@reedmedia.net>
List: pkgsrc-bulk
Date: 09/01/2005 22:25:47
On Thu, 1 Sep 2005, Todd Vierling wrote:

>> I'm afraid not.  My IRIX machines still have the change to revert it
>> back to use find(1), and I believe Jeremy recently saw the same problem
>> on DragonFlyBSD...
>
> If itworks for you, please commit it.  I don't have a bulk build capable
> host box to test on right now.

I will commit after my bulk build is done. (I already did one before with 
it too.)

Sorry the following is a mess -- I had other junk in there too.

--- mk/bulk/post-build	26 Aug 2005 07:24:53 -0000	1.57
+++ mk/bulk/post-build	2 Sep 2005 05:23:47 -0000
@@ -119,7 +119,7 @@

  # Copy over the output from the build process
  chdir($vars{USR_PKGSRC});
-my_system("/bin/ls -1 $vars{BROKENFILE} $vars{BROKENWRKLOG} */*/$vars{BROKENFILE} */*/$vars{BROKENWRKLOG} 2>/dev/null | $vars{PAX} -r -w -X -p e $vars{FTP}");
+my_system("$vars{FIND} . -name $vars{BROKENFILE} -print -o -name $vars{BROKENWRKLOG} -print | $vars{PAX} -r -w -X -p e $vars{FTP}");

--- mk/bulk/pre-build	26 Aug 2005 07:24:53 -0000	1.50
+++ mk/bulk/pre-build	2 Sep 2005 05:23:47 -0000

...

  	echo Removing all installed packages in $dbdir
  	if [ -d $dbdir ]; then
  		cd $dbdir
-		for pkg in *
+		find $dbdir | while read pkg;
  		do
  			if `${PKG_TOOLS_BIN}/pkg_info -K $dbdir -qe $pkg`; then
  				echo ${PKG_TOOLS_BIN}/pkg_delete -r $pkg
@@ -116,7 +118,7 @@
  		# this should have removed everything.
  		# Now force any broken pkgs to deinstall.
  		#
-		for pkg in *
+		find $dbdir | while read pkg;
  		do
  			if `${PKG_TOOLS_BIN}/pkg_info -K $dbdir -qe $pkg`; then
  				echo ${PKG_TOOLS_BIN}/pkg_delete -f $pkg
@@ -127,34 +129,36 @@
  		# We've tried our best to get rid of the pkgs, now do it
  		# the hard way.  If it wasn't for stuff in $X11BASE, I
  		# wouldn't have hard feelings about this!
-		rm -fr *
+	 	find $dbdir -exec rm "{}" \;
  	fi
  done

...

  # Clean up state files
  cd ${USR_PKGSRC}
  echo Cleaning up leftover state files from previous runs
-rm -f */*/$BROKENF */*/$BRKWRKLOG */*/$BLDLOG
+find ${USR_PKGSRC} -depth 3 \( -name "$BROKENF" -o -name "$BRKWRKLOG" \
+	-o -name "$BLDLOG" \) -exec rm "{}" \;
  rm -f $BROKENF $BRKWRKLOG $BLDLOG $STARTFILE


@@ -253,7 +257,7 @@
  	echo Removing all installed packages in $dbdir
  	if [ -d $dbdir ]; then
  		cd $dbdir
-		for pkg in *
+		find $dbdir | while read pkg;
  		do
  			if `${PKG_TOOLS_BIN}/pkg_info -K $dbdir -qe $pkg`; then
  				echo ${PKG_TOOLS_BIN}/pkg_delete -r $pkg

  Jeremy C. Reed

  	  	 	 BSD News, BSD tutorials, BSD links
 	  	 	 http://www.bsdnewsletter.com/