  	esac
  
  	if [ -z "$portdir" -a -z "$upg_port" ]; then
-@@ -3069,11 +3267,20 @@
+@@ -3069,11 +3272,20 @@
  
  	case "$arg2" in
  	*/*)	ro_opd=$arg2 ; ro_upg_port=`iport_from_origin $ro_opd` ;;

--- portmaster.orig	2012-01-31 03:17:17.681285114 +0100
+++ portmaster	2012-01-31 16:40:34.671178105 +0100
@@ -292,7 +292,13 @@
 			 unset -v PM_URB_LIST;
 			 $PM_SU_CMD /usr/bin/nice /usr/bin/make $PM_MAKE_ARGS $*; ); }

 		done
 
 		build_only_dl_g=" `uniquify_list $temp_bodlg` "
@@ -2636,15 +2815,23 @@
 	echo ''
 
 	for origin in $PM_URB_ORIGINS; do
-		for req_by in `grep -l DEPORIGIN:${origin}$ $pdb/*/+CONTENTS`; do
-			req_by="${req_by%/+CONTENTS}"
-			req_by="${req_by##*/}"
+		if [ -z "$use_pkgng" ]; then
+			for req_by in `grep -l DEPORIGIN:${origin}$ $pdb/*/+CONTENTS`; do
+				req_by="${req_by%/+CONTENTS}"
+				req_by="${req_by##*/}"
 
-			case " $PM_URB_IPORTS" in *" $req_by "*) continue ;; esac
-			case " $PM_URB_ORIGINS" in *" `origin_from_pdb $req_by` "*) continue ;; esac
+				case " $PM_URB_IPORTS" in *" $req_by "*) continue ;; esac
+				case " $PM_URB_ORIGINS" in *" `origin_from_pdb $req_by` "*) continue ;; esac
 
-			PM_URB_LIST="${PM_URB_LIST} ${req_by}"
-		done
+				PM_URB_LIST="${PM_URB_LIST} ${req_by}"
+			done
+		else
+			for req_by in `pkg query "%rn-%rv" ${origin}`; do
+				case " $PM_URB_IPORTS" in *" $req_by "*) continue ;; esac
+				case " $PM_URB_ORIGINS" in *" `origin_from_pdb $req_by` "*) continue ;; esac
+				PM_URB_LIST="${PM_URB_LIST} ${req_by}"
+			done
+		fi
 	done
 
 	if [ -n "$PM_URB_LIST" ]; then
@@ -2656,7 +2843,11 @@
 
 	for req_by in $PM_URB_LIST; do
 		# Probably not needed, but JIC
-		[ -d "$pdb/$req_by" ] || continue
+		if [ -z "$use_pkgng" ]; then
+			[ -d "$pdb/$req_by" ] || continue
+		else
+			pkg info -e $req_by || continue
+		fi
 
 		pm_v "===>>> $req_by depends on $PM_URB_IPORTS"
 
@@ -2806,9 +2997,16 @@
 		*/*)	origin=$port ;;
 		*)	# If an installed version does not exist at this
 			# point it probably got updated as a dependency
