-Index: portmaster
-===================================================================
---- portmaster	(revision 224747)
-+++ portmaster	(working copy)
-@@ -291,7 +291,13 @@
- 			 unset -v MASTER_RB_LIST;
+--- /usr/local/sbin/portmaster	2011-12-11 21:50:47.000000000 +0100
++++ ~/pkgng/portmaster	2011-12-12 12:23:56.000000000 +0100
+@@ -286,7 +286,13 @@
+ 			 unset -v PM_URB_LIST;
  			 $PM_SU_CMD /usr/bin/nice /usr/bin/make $PM_MAKE_ARGS $*; ); }
  pm_mkdir_s        () { $PM_SU_CMD /bin/mkdir -p $1; }
 -pm_pkg_delete_s   () { $PM_SU_CMD /usr/sbin/pkg_delete $*; }

 	sn=${1#*/} ; sn=${sn%-*} ; sn=${sn%%[0-9]*}
 
 	if ! dir=`grep -l "@comment ORIGIN:${1}$" $pdb/${sn}*/+CONTENTS 2>/dev/null`; then
@@ -1115,36 +1143,64 @@
 	echo '############' > $DI_FILES		# Make the file > 0 bytes
 	echo "===>>> Gathering distinfo list for installed ports"
 	echo ''

 pm_rm_s           () { $PM_SU_CMD /bin/rm $*; }
 pm_rmdir_s        () { $PM_SU_CMD /bin/rmdir $*; }
 pm_unlink_s       () { [ -e "$1" ] && $PM_SU_CMD /bin/unlink $1; }
@@ -490,12 +496,16 @@
 
 	pattern=`globstrip $1`
 
-	glob_dirs=`find $pdb -maxdepth 1 -type d -name ${pattern}\*`
+	if [ -z "${use_pkgng}" ]; then
+		glob_dirs=`find $pdb -maxdepth 1 -type d -name ${pattern}\*`
+	else
+		glob_dirs=`pkg info -qg ${pattern}\*`
+	fi
 	case "$glob_dirs" in
 	# Match a newline in multiple responses from find
 	*'
 '*)		return 2 ;;
-	$pdb/*)	return ;;
+	*)	return ;;
 	esac
 
 	unset glob_dirs
@@ -505,8 +515,12 @@
 origin_from_pdb () {
 	local o
 
