Index: src/port/port.1
===================================================================
--- src/port/port.1	(revision 24893)
+++ src/port/port.1	(working copy)
@@ -235,6 +235,8 @@
 In batch and interactive mode, exit on the first error encountered. Otherwise, errors during batch execution are simply reported.
 .It Fl p
 Despite any errors encountered, proceed to process multiple ports and commands.
+.It Fl y
+Perform a dry run. All of the steps to build the ports and their dependencies are computed, but not actually performed. With the verbose flag, every step is reported; otherwise there is just one message per port, which allows you to easily determine the recursive deps of a port (and the order in which they will be built).
 .It Fl t
 enable trace mode debug facilities on platforms that support it (MacOS X). This feature is two-folded. It consists in automatically detecting and reporting undeclared dependencies based on what files the port reads or what programs the port executes. In verbose mode, it will also report unused dependencies for each stage of the port installation. It also consists in forbidding and reporting file creation and file writes outside allowed directories (temporary directories and ${workpath}).
 .El
Index: src/port/port.tcl
===================================================================
--- src/port/port.tcl	(revision 24893)
+++ src/port/port.tcl	(working copy)
@@ -136,7 +136,7 @@
 	global cmdname
 	global action_array
 	
-	set syntax { [-bcdfiknopqRstuvx] [-D portdir] [-F cmdfile] action [privopts] [actionflags]
+	set syntax { [-bcdfiknopqRstuvxy] [-D portdir] [-F cmdfile] action [privopts] [actionflags]
 [[portname|pseudo-portname|port-url] [@version] [+-variant]... [option=value]...]...
 }
 
@@ -2249,6 +2249,7 @@
 					c { set global_options(ports_autoclean) yes		}
 					k { set global_options(ports_autoclean) no		}
 					t { set global_options(ports_trace) yes			}
+					y { set global_options(ports_dryrun) yes                }
 					F { # Name a command file to process
 						advance
 						if {[moreargs]} {
Index: src/port1.0/portutil.tcl
===================================================================
--- src/port1.0/portutil.tcl	(revision 24893)
+++ src/port1.0/portutil.tcl	(working copy)
@@ -977,9 +977,11 @@
 }
 
 ########### Internal Dependency Manipulation Procedures ###########
+global ports_dry_last_skipped
+set ports_dry_last_skipped ""
 
 proc target_run {ditem} {
-    global target_state_fd portpath portname portversion portrevision portvariants ports_force variations workpath ports_trace PortInfo
+    global target_state_fd portpath portname portversion portrevision portvariants ports_force variations workpath ports_trace PortInfo ports_dryrun ports_dry_last_skipped
     set result 0
     set skipped 0
     set procedure [ditem_key $ditem procedure]
@@ -1048,6 +1050,18 @@
 			}
 			
 		}
+
+		# Of course, if this is a dry run, don't do the task:
+		if {[info exists ports_dryrun] && $ports_dryrun == "yes"} {
+		    # only one message per portname
+		    if {$portname != $ports_dry_last_skipped} {
+			    ui_msg "For $portname: skipping $name (dry run)"
+			    set ports_dry_last_skipped $portname
+                    } else {
+			ui_info "    .. and skipping $name"
+		    }
+                    set skipped 1
+                }
 			
 		# otherwise execute the task.
 		if {$skipped == 0} {
@@ -1368,7 +1382,7 @@
 }
 
 proc eval_variants {variations target} {
-    global all_variants ports_force PortInfo
+    global all_variants ports_force ports_dryrun PortInfo
     set dlist $all_variants
     set result 0
     upvar $variations upvariations
@@ -1417,7 +1431,8 @@
 		if {[check_statefile_variants upvariations $state_fd]} {
 			ui_error "Requested variants do not match original selection.\nPlease perform 'port clean $portname' or specify the force option."
 			set result 1
-		} else {
+		} elseif {!([info exists ports_dryrun]
+			    && $ports_dryrun == "yes")} {
 			# Write variations out to the statefile
 			foreach key [array names upvariations *] {
 			write_statefile variant $upvariations($key)$key $state_fd

