[78062] trunk/base

jmr at macports.org jmr at macports.org
Thu Apr 21 14:07:51 PDT 2011


Revision: 78062
          http://trac.macports.org/changeset/78062
Author:   jmr at macports.org
Date:     2011-04-21 14:07:51 -0700 (Thu, 21 Apr 2011)
Log Message:
-----------
implement subports

Modified Paths:
--------------
    trunk/base/portmgr/jobs/port_binary_distributable.tcl
    trunk/base/portmgr/packaging/dpkgall.tcl
    trunk/base/portmgr/packaging/packageall.tcl
    trunk/base/portmgr/packaging/rpmall.tcl
    trunk/base/src/macports1.0/macports.tcl
    trunk/base/src/package1.0/portarchivefetch.tcl
    trunk/base/src/package1.0/portdmg.tcl
    trunk/base/src/package1.0/portdpkg.tcl
    trunk/base/src/package1.0/portmdmg.tcl
    trunk/base/src/package1.0/portmpkg.tcl
    trunk/base/src/package1.0/portpkg.tcl
    trunk/base/src/package1.0/portrpm.tcl
    trunk/base/src/package1.0/portsrpm.tcl
    trunk/base/src/package1.0/portunarchive.tcl
    trunk/base/src/port/port.tcl
    trunk/base/src/port/portindex.tcl
    trunk/base/src/port1.0/portactivate.tcl
    trunk/base/src/port1.0/portbuild.tcl
    trunk/base/src/port1.0/portchecksum.tcl
    trunk/base/src/port1.0/portclean.tcl
    trunk/base/src/port1.0/portconfigure.tcl
    trunk/base/src/port1.0/portdeactivate.tcl
    trunk/base/src/port1.0/portdestroot.tcl
    trunk/base/src/port1.0/portdistcheck.tcl
    trunk/base/src/port1.0/portdistfiles.tcl
    trunk/base/src/port1.0/portextract.tcl
    trunk/base/src/port1.0/portfetch.tcl
    trunk/base/src/port1.0/portinstall.tcl
    trunk/base/src/port1.0/portlint.tcl
    trunk/base/src/port1.0/portlivecheck.tcl
    trunk/base/src/port1.0/portmain.tcl
    trunk/base/src/port1.0/portmirror.tcl
    trunk/base/src/port1.0/portpatch.tcl
    trunk/base/src/port1.0/portstartupitem.tcl
    trunk/base/src/port1.0/porttest.tcl
    trunk/base/src/port1.0/portuninstall.tcl
    trunk/base/src/port1.0/portutil.tcl
    trunk/base/src/registry2.0/portuninstall.tcl

Modified: trunk/base/portmgr/jobs/port_binary_distributable.tcl
===================================================================
--- trunk/base/portmgr/jobs/port_binary_distributable.tcl	2011-04-21 21:04:08 UTC (rev 78061)
+++ trunk/base/portmgr/jobs/port_binary_distributable.tcl	2011-04-21 21:07:51 UTC (rev 78062)
@@ -66,7 +66,7 @@
         return {}
     }
     array set portInfo [lindex $portSearchResult 1]
-    set mport [mportopen $portInfo(porturl) {} $variantInfo]
+    set mport [mportopen $portInfo(porturl) [list subport $portName] $variantInfo]
     array unset portInfo
     array set portInfo [mportinfo $mport]
     mportclose $mport

Modified: trunk/base/portmgr/packaging/dpkgall.tcl
===================================================================
--- trunk/base/portmgr/packaging/dpkgall.tcl	2011-04-21 21:04:08 UTC (rev 78061)
+++ trunk/base/portmgr/packaging/dpkgall.tcl	2011-04-21 21:07:51 UTC (rev 78062)
@@ -439,6 +439,9 @@
 			continue
 		}
 
+        # open correct subport
+        set options(subport) $portinfo(name)
+
 		# Skip un-supported ports
 		if {[info exists portinfo(platforms)] && ${anyplatform_flag} != "true"} {
 			if {[lsearch $portinfo(platforms) $platformString] == -1} {
@@ -690,6 +693,7 @@
 	set variations ""
 
 	foreach port [get_required_ports] {
+	    set options(subport) $port
 		if {[catch {do_portexec $port [array get options] [array get variants] activate} result]} {
 			global errorInfo
 			ui_debug "$errorInfo"

Modified: trunk/base/portmgr/packaging/packageall.tcl
===================================================================
--- trunk/base/portmgr/packaging/packageall.tcl	2011-04-21 21:04:08 UTC (rev 78061)
+++ trunk/base/portmgr/packaging/packageall.tcl	2011-04-21 21:07:51 UTC (rev 78062)
@@ -398,6 +398,7 @@
 
 	# Turn on verbose output for the build
 	set ui_options(ports_verbose) yes
+	set options(subport) $name
 	if {[catch {set workername [mportopen $porturl [array get options] [array get variations] yes]} result] ||
 		$result == 1} {
 		global errorInfo

Modified: trunk/base/portmgr/packaging/rpmall.tcl
===================================================================
--- trunk/base/portmgr/packaging/rpmall.tcl	2011-04-21 21:04:08 UTC (rev 78061)
+++ trunk/base/portmgr/packaging/rpmall.tcl	2011-04-21 21:07:51 UTC (rev 78062)
@@ -450,6 +450,7 @@
 			}
 			array set prebuildinfo [lindex $search 1]
 			set ui_options(ports_verbose) yes
+			set options(subport) ${prebuild}
 			if {[catch {set workername [mportopen $prebuildinfo(porturl) [array get options] [array get variations] yes]} result] ||
 				$result == 1} {
 				global errorInfo
@@ -470,6 +471,7 @@
 
 	# Turn on verbose output for the build
 	set ui_options(ports_verbose) yes
+	set options(subport) $name
 	if {[catch {set workername [mportopen $porturl [array get options] [array get variations]]} result] ||
 		$result == 1} {
 		global errorInfo

Modified: trunk/base/src/macports1.0/macports.tcl
===================================================================
--- trunk/base/src/macports1.0/macports.tcl	2011-04-21 21:04:08 UTC (rev 78061)
+++ trunk/base/src/macports1.0/macports.tcl	2011-04-21 21:07:51 UTC (rev 78062)
@@ -134,7 +134,7 @@
 
     ui_debug "Starting logging for $portname"
 
-    set logname [macports::getportlogpath $portpath]
+    set logname [file join [macports::getportlogpath $portpath] $portname]
     file mkdir $logname
     set logname [file join $logname "main.log"]
 
@@ -1240,14 +1240,17 @@
     global macports::portdbpath macports::portconf macports::open_mports auto_path
 
     # Look for an already-open MPort with the same URL.
-    # XXX: should compare options and variations here too.
     # if found, return the existing reference and bump the refcount.
     if {$nocache != ""} {
         set mport {}
     } else {
         set mport [dlist_search $macports::open_mports porturl $porturl]
+        set mport [dlist_search $mport variations $variations]
+        set mport [dlist_search $mport options $options]
     }
     if {$mport != {}} {
+        # just in case more than one somehow matches
+        set mport [lindex $mport 0]
         set refcnt [ditem_key $mport refcnt]
         incr refcnt
         ditem_key $mport refcnt $refcnt
@@ -1325,7 +1328,7 @@
     foreach v $minusvariant {
         lappend variations $v "-"
     }
-    
+    lappend options subport $name
     return [mportopen "file://${portfile_dir}/" $options $variations]
 }
 
@@ -1796,11 +1799,11 @@
     return 0
 }
 
-proc macports::getportbuildpath {id} {
+proc macports::getportbuildpath {id {portname ""}} {
     global macports::portdbpath
     regsub {://} $id {.} port_path
     regsub -all {/} $port_path {_} port_path
-    return [file join $portdbpath build $port_path]
+    return [file join $portdbpath build $port_path $portname]
 }
 
 proc macports::getportlogpath {id} {
@@ -1814,8 +1817,8 @@
     return [file join $portbuildpath work]
 }
 
-proc macports::getportworkpath_from_portdir {portpath} {
-    return [macports::getportworkpath_from_buildpath [macports::getportbuildpath $portpath]]
+proc macports::getportworkpath_from_portdir {portpath {portname ""}} {
+    return [macports::getportworkpath_from_buildpath [macports::getportbuildpath $portpath $portname]]
 }
 
 proc macports::getindex {source} {
@@ -2429,6 +2432,8 @@
         array set optionsarray [ditem_key $mport options]
         # avoid propagating requested flag from parent
         set optionsarray(ports_requested) 0
+        # subport will be different for deps
+        unset optionsarray(subport)
         set options [array get optionsarray]
         set variations [ditem_key $mport variations]
         set required_archs [$workername eval get_canonical_archs]
@@ -2490,10 +2495,13 @@
                     ui_error "Dependency '$dep_portname' not found."
                     return 1
                 }
+                lappend options subport $dep_portname
                 # Figure out the subport. Check the open_mports list first, since
                 # we potentially leak mport references if we mportopen each time,
                 # because mportexec only closes each open mport once.
                 set subport [dlist_search $macports::open_mports porturl $dep_portinfo(porturl)]
+                set subport [dlist_search $subport options $options]
+                set subport [dlist_search $subport variations $variations]
                 
                 if {$subport == {}} {
                     # We haven't opened this one yet.
@@ -2866,6 +2874,7 @@
 proc macports::_upgrade {portname dspec variationslist optionslist {depscachename ""}} {
     global macports::global_variations
     array set options $optionslist
+    set options(subport) $portname
 
     if {![string match "" $depscachename]} {
         upvar $depscachename depscache
@@ -3095,6 +3104,7 @@
 
     array set interp_options [array get options]
     set interp_options(ports_requested) $requestedflag
+    set interp_options(subport) $newname
 
     if {[catch {set workername [mportopen $porturl [array get interp_options] [array get variations]]} result]} {
         global errorInfo

Modified: trunk/base/src/package1.0/portarchivefetch.tcl
===================================================================
--- trunk/base/src/package1.0/portarchivefetch.tcl	2011-04-21 21:04:08 UTC (rev 78061)
+++ trunk/base/src/package1.0/portarchivefetch.tcl	2011-04-21 21:07:51 UTC (rev 78062)
@@ -62,14 +62,14 @@
 default archive_sites macports_archives
 default archive_sites.listfile {"archive_sites.tcl"}
 default archive_sites.listpath {"port1.0/fetch"}
-default archive.subdir {${name}}
+default archive.subdir {${subport}}
 
 set_ui_prefix
 
 # Checks possible archive files to assemble url lists for later fetching
 proc portarchivefetch::checkarchivefiles {urls} {
     global all_archive_files archivefetch.fulldestpath portarchivetype \
-           name version revision portvariants archive_sites
+           version revision portvariants archive_sites
     upvar $urls fetch_urls
 
     # Define archive directory path
@@ -238,7 +238,7 @@
         return 0
     }
     if {[info exists ports_binary_only] && $ports_binary_only == "yes"} {
-        return -code error "archivefetch failed for [option name] @[option version]_[option revision][option portvariants]"
+        return -code error "archivefetch failed for [option subport] @[option version]_[option revision][option portvariants]"
     } else {
         return 0
     }
@@ -251,12 +251,12 @@
 
 proc portarchivefetch::archivefetch_start {args} {
     variable archivefetch_urls
-    global UI_PREFIX name all_archive_files ports_source_only
+    global UI_PREFIX subport all_archive_files ports_source_only
     if {![tbool ports_source_only]} {
         portarchivefetch::checkfiles archivefetch_urls
     }
     if {[info exists all_archive_files] && [llength $all_archive_files] > 0} {
-        ui_msg "$UI_PREFIX [format [msgcat::mc "Fetching archive for %s"] $name]"
+        ui_msg "$UI_PREFIX [format [msgcat::mc "Fetching archive for %s"] $subport]"
     }
 }
 

Modified: trunk/base/src/package1.0/portdmg.tcl
===================================================================
--- trunk/base/src/package1.0/portdmg.tcl	2011-04-21 21:04:08 UTC (rev 78061)
+++ trunk/base/src/package1.0/portdmg.tcl	2011-04-21 21:07:51 UTC (rev 78062)
@@ -44,15 +44,15 @@
 set_ui_prefix
 
 proc portdmg::dmg_main {args} {
-    global name version revision package.destpath UI_PREFIX
+    global subport version revision package.destpath UI_PREFIX
 
-    ui_msg "$UI_PREFIX [format [msgcat::mc "Creating disk image for %s-%s"] ${name} ${version}]"
+    ui_msg "$UI_PREFIX [format [msgcat::mc "Creating disk image for %s-%s"] ${subport} ${version}]"
 
     if {[getuid] == 0 && [geteuid] != 0} {
 		setegid 0; seteuid 0
 	}
 
-    return [package_dmg $name $version $revision]
+    return [package_dmg $subport $version $revision]
 }
 
 proc portdmg::package_dmg {portname portversion portrevision} {

Modified: trunk/base/src/package1.0/portdpkg.tcl
===================================================================
--- trunk/base/src/package1.0/portdpkg.tcl	2011-04-21 21:04:08 UTC (rev 78061)
+++ trunk/base/src/package1.0/portdpkg.tcl	2011-04-21 21:07:51 UTC (rev 78062)
@@ -54,16 +54,16 @@
 proc portdpkg::main {args} {
 	global UI_PREFIX destpath os.arch os.platform
     
-	ui_msg "$UI_PREFIX [format [msgcat::mc "Creating dpkg for %s-%s"] [option name] [option version]]"
+	ui_msg "$UI_PREFIX [format [msgcat::mc "Creating dpkg for %s-%s"] [option subport] [option version]]"
 
 	# get deplist
-	set deps [make_dependency_list [option name]]
+	set deps [make_dependency_list [option subport]]
 	set deps [lsort -unique $deps]
 	foreach dep $deps {
 		set name [lindex [split $dep /] 0]
 		set vers [lindex [split $dep /] 1]
 		# don't re-package ourself
-		if {$name != [option name]} {
+		if {$name != [option subport]} {
 			lappend dependencies "${name} (>= ${vers})"
 		}
 	}
@@ -114,7 +114,7 @@
 	} elseif {[exists description]} {
 		set pkg_long_description " [option description]\n"
 	} else {
-		set pkg_long_description " [option name]\n"
+		set pkg_long_description " [option subport]\n"
 	}
 
 	if {[exists homepage]} {
@@ -141,7 +141,7 @@
 		set pkg_arch "${os.platform}-${pkg_arch}"
 	}
 
-	puts $controlfd "Package: [option name]"
+	puts $controlfd "Package: [option subport]"
 	puts $controlfd "Architecture: ${pkg_arch}"
 	puts $controlfd "Version: ${pkg_version}"
 	puts $controlfd "Section: ${pkg_category}"

Modified: trunk/base/src/package1.0/portmdmg.tcl
===================================================================
--- trunk/base/src/package1.0/portmdmg.tcl	2011-04-21 21:04:08 UTC (rev 78061)
+++ trunk/base/src/package1.0/portmdmg.tcl	2011-04-21 21:07:51 UTC (rev 78062)
@@ -44,15 +44,15 @@
 set_ui_prefix
 
 proc portmdmg::mdmg_main {args} {
-    global name version revision package.destpath UI_PREFIX
+    global subport version revision package.destpath UI_PREFIX
 
-    ui_msg "$UI_PREFIX [format [msgcat::mc "Creating disk image for %s-%s"] ${name} ${version}]"
+    ui_msg "$UI_PREFIX [format [msgcat::mc "Creating disk image for %s-%s"] ${subport} ${version}]"
 
     if {[getuid] == 0 && [geteuid] != 0} {
 		setegid 0; seteuid 0
 	}
 
-    return [package_mdmg $name $version $revision]
+    return [package_mdmg $subport $version $revision]
 }
 
 proc portmdmg::package_mdmg {portname portversion portrevision} {

Modified: trunk/base/src/package1.0/portmpkg.tcl
===================================================================
--- trunk/base/src/package1.0/portmpkg.tcl	2011-04-21 21:04:08 UTC (rev 78061)
+++ trunk/base/src/package1.0/portmpkg.tcl	2011-04-21 21:07:51 UTC (rev 78062)
@@ -47,12 +47,12 @@
 set_ui_prefix
 
 proc portmpkg::mpkg_main {args} {
-    global name version revision package.destpath package.flat UI_PREFIX
+    global subport version revision package.destpath package.flat UI_PREFIX
 
     # Make sure the destination path exists.
     system "mkdir -p ${package.destpath}"
 
-    return [package_mpkg $name $version $revision]
+    return [package_mpkg $subport $version $revision]
 }
 
 proc portmpkg::make_dependency_list {portname} {

Modified: trunk/base/src/package1.0/portpkg.tcl
===================================================================
--- trunk/base/src/package1.0/portpkg.tcl	2011-04-21 21:04:08 UTC (rev 78061)
+++ trunk/base/src/package1.0/portpkg.tcl	2011-04-21 21:07:51 UTC (rev 78062)
@@ -51,11 +51,11 @@
 set_ui_prefix
 
 proc portpkg::pkg_main {args} {
-    global name version revision package.type package.destpath package.flat UI_PREFIX
+    global subport version revision package.type package.destpath package.flat UI_PREFIX
 
-    ui_msg "$UI_PREFIX [format [msgcat::mc "Creating pkg for %s-%s"] ${name} ${version}]"
+    ui_msg "$UI_PREFIX [format [msgcat::mc "Creating pkg for %s-%s"] ${subport} ${version}]"
 
-    return [package_pkg $name $version $revision]
+    return [package_pkg $subport $version $revision]
 }
 
 proc portpkg::package_pkg {portname portversion portrevision} {

Modified: trunk/base/src/package1.0/portrpm.tcl
===================================================================
--- trunk/base/src/package1.0/portrpm.tcl	2011-04-21 21:04:08 UTC (rev 78061)
+++ trunk/base/src/package1.0/portrpm.tcl	2011-04-21 21:07:51 UTC (rev 78062)
@@ -51,11 +51,11 @@
 set_ui_prefix
 
 proc portrpm::rpm_main {args} {
-    global name version revision UI_PREFIX
+    global subport version revision UI_PREFIX
     
-    ui_msg "$UI_PREFIX [format [msgcat::mc "Creating RPM package for %s-%s"] ${name} ${version}]"
+    ui_msg "$UI_PREFIX [format [msgcat::mc "Creating RPM package for %s-%s"] ${subport} ${version}]"
     
-    return [rpm_pkg $name $version $revision]
+    return [rpm_pkg $subport $version $revision]
 }
 
 proc portrpm::rpm_pkg {portname portversion portrevision} {

Modified: trunk/base/src/package1.0/portsrpm.tcl
===================================================================
--- trunk/base/src/package1.0/portsrpm.tcl	2011-04-21 21:04:08 UTC (rev 78061)
+++ trunk/base/src/package1.0/portsrpm.tcl	2011-04-21 21:07:51 UTC (rev 78062)
@@ -47,11 +47,11 @@
 set_ui_prefix
 
 proc portsrpm::srpm_main {args} {
-    global name version revision UI_PREFIX
+    global subport version revision UI_PREFIX
     
-    ui_msg "$UI_PREFIX [format [msgcat::mc "Creating SRPM package for %s-%s"] ${name} ${version}]"
+    ui_msg "$UI_PREFIX [format [msgcat::mc "Creating SRPM package for %s-%s"] ${subport} ${version}]"
     
-    return [srpm_pkg $name $version $revision]
+    return [srpm_pkg $subport $version $revision]
 }
 
 proc portsrpm::srpm_pkg {portname portversion portrevision} {

Modified: trunk/base/src/package1.0/portunarchive.tcl
===================================================================
--- trunk/base/src/package1.0/portunarchive.tcl	2011-04-21 21:04:08 UTC (rev 78061)
+++ trunk/base/src/package1.0/portunarchive.tcl	2011-04-21 21:07:51 UTC (rev 78062)
@@ -63,7 +63,7 @@
 proc portunarchive::unarchive_init {args} {
     global target_state_fd unarchive.skip \
            ports_force ports_source_only ports_binary_only \
-           name version revision portvariants \
+           subport version revision portvariants \
            unarchive.type unarchive.file unarchive.path
 
     # Determine if unarchive should be skipped
@@ -71,13 +71,13 @@
     if {[check_statefile target org.macports.unarchive $target_state_fd]} {
         return 0
     } elseif {[info exists ports_source_only] && $ports_source_only == "yes"} {
-        ui_debug "Skipping unarchive ($name) since source-only is set"
+        ui_debug "Skipping unarchive ($subport) since source-only is set"
         set skipped 1
     } elseif {[check_statefile target org.macports.destroot $target_state_fd]} {
-        ui_debug "Skipping unarchive ($name) since destroot completed"
+        ui_debug "Skipping unarchive ($subport) since destroot completed"
         set skipped 1
     } elseif {[info exists ports_force] && $ports_force == "yes"} {
-        ui_debug "Skipping unarchive ($name) since force is set"
+        ui_debug "Skipping unarchive ($subport) since force is set"
         set skipped 1
     } else {
         set found 0
@@ -96,9 +96,9 @@
             ui_debug "Found [string toupper ${unarchive.type}] archive: ${unarchive.path}"
         } else {
             if {[info exists ports_binary_only] && $ports_binary_only == "yes"} {
-                return -code error "Archive for ${name} ${version}_${revision}${portvariants} not found, required when binary-only is set!"
+                return -code error "Archive for ${subport} ${version}_${revision}${portvariants} not found, required when binary-only is set!"
             } else {
-                ui_debug "Skipping unarchive ($name) since no suitable archive found"
+                ui_debug "Skipping unarchive ($subport) since no suitable archive found"
                 set skipped 1
             }
         }
@@ -110,7 +110,7 @@
 }
 
 proc portunarchive::unarchive_start {args} {
-    global UI_PREFIX name version revision portvariants \
+    global UI_PREFIX subport version revision portvariants \
            unarchive.type unarchive.skip
 
     if {${unarchive.skip}} {
@@ -122,7 +122,7 @@
         elevateToRoot "unarchive"
     }
 
-    ui_msg "$UI_PREFIX [format [msgcat::mc "Unpacking ${unarchive.type} archive for %s %s_%s%s"] $name $version $revision $portvariants]"
+    ui_msg "$UI_PREFIX [format [msgcat::mc "Unpacking ${unarchive.type} archive for %s %s_%s%s"] $subport $version $revision $portvariants]"
 
     return 0
 }
@@ -268,7 +268,7 @@
 }
 
 proc portunarchive::unarchive_finish {args} {
-    global UI_PREFIX target_state_fd unarchive.file name workpath destpath unarchive.skip
+    global UI_PREFIX target_state_fd unarchive.file subport workpath destpath unarchive.skip
 
     if {${unarchive.skip}} {
         return 0
@@ -276,7 +276,7 @@
 
     # Reset state file with archive version
     close $target_state_fd
-    set statefile [file join $workpath .macports.${name}.state]
+    set statefile [file join $workpath .macports.${subport}.state]
     file copy -force [file join $destpath "+STATE"] $statefile
     file mtime $statefile [clock seconds]
     chownAsRoot $statefile

Modified: trunk/base/src/port/port.tcl
===================================================================
--- trunk/base/src/port/port.tcl	2011-04-21 21:04:08 UTC (rev 78061)
+++ trunk/base/src/port/port.tcl	2011-04-21 21:07:51 UTC (rev 78062)
@@ -933,7 +933,7 @@
     set porturl $portinfo(porturl)
 
     # open portfile
-    if {[catch {set mport [mportopen $porturl {} [array get global_variations]]} result]} {
+    if {[catch {set mport [mportopen $porturl [list subport $portname] [array get global_variations]]} result]} {
         ui_debug "$::errorInfo"
         return -code error "Unable to open port: $result"
     }
@@ -979,7 +979,7 @@
                     set porturl $portinfo(porturl)
                 
                     # open its portfile
-                    if {[catch {set mport [mportopen $porturl {} [array get global_variations]]} result]} {
+                    if {[catch {set mport [mportopen $porturl [list subport $depname] [array get global_variations]]} result]} {
                         ui_debug "$::errorInfo"
                         ui_error "Unable to open port: $result"
                         continue
@@ -1807,11 +1807,15 @@
                     set merged_variations($variation) $value 
                 } 
             }
+            if {![info exists options(subport)]} {
+                set options(subport) $portname
+            }
  
             if {[catch {set mport [mportopen $porturl [array get options] [array get merged_variations]]} result]} {
                 ui_debug "$::errorInfo"
                 break_softcontinue "Unable to open port: $result" 1 status
             }
+            unset options(subport)
             array unset portinfo
             array set portinfo [mportinfo $mport]
             mportclose $mport
@@ -1838,6 +1842,7 @@
             platforms       1
             variants        1
             conflicts       1
+            subports        1
         "
 
         # Label map for pretty printing
@@ -1858,6 +1863,7 @@
             license     License
             conflicts   "Conflicts with"
             replaced_by "Replaced by"
+            subports    "Sub-ports"
         }
 
         # Wrap-length map for pretty printing
@@ -1877,6 +1883,7 @@
             license 22
             conflicts 22
             maintainers 22
+            subports 22
         }
 
         # Interpret a convenient field abbreviation
@@ -1930,6 +1937,7 @@
         if {![llength $opts_todo]} {
             set opts_todo {ports_info_heading
                 ports_info_replaced_by
+                ports_info_subports
                 ports_info_variants 
                 ports_info_skip_line
                 ports_info_long_description ports_info_homepage 
@@ -2151,6 +2159,9 @@
                 set merged_variations($variation) $value 
             } 
         }
+        if {![info exists options(subport)]} {
+            set options(subport) $portname
+        }
 
         # Open the Portfile associated with this port.
         if {[catch {set mport [mportopen $porturl [array get options] \
@@ -2651,6 +2662,9 @@
                     set merged_variations($variation) $value 
                 } 
             }
+            if {![info exists options(subport)]} {
+                set options(subport) $portname
+            }
             if {[catch {set mport [mportopen $porturl [array get options] [array get merged_variations]]} result]} {
                 ui_debug "$::errorInfo"
                 break_softcontinue "Unable to open port: $result" 1 status
@@ -2729,6 +2743,7 @@
                     array unset portinfo
                     array set portinfo [lindex $result 1]
                     set porturl $portinfo(porturl)
+                    set options(subport) $depname
                     
                     # open the portfile if requested
                     if {!([info exists options(ports_${action}_index)] && $options(ports_${action}_index) eq "yes")} {
@@ -3121,6 +3136,9 @@
         }
 
         if {!([info exists options(ports_variants_index)] && $options(ports_variants_index) eq "yes")} {
+            if {![info exists options(subport)]} {
+                set options(subport) $portname
+            }
             if {[catch {set mport [mportopen $porturl [array get options] [array get variations]]} result]} {
                 ui_debug "$::errorInfo"
                 break_softcontinue "Unable to open port: $result" 1 status
@@ -3521,7 +3539,7 @@
 
                 work {
                     # output the path to the port's work directory
-                    set workpath [macports::getportworkpath_from_portdir $portdir]
+                    set workpath [macports::getportworkpath_from_portdir $portdir $portname]
                     if {[file exists $workpath]} {
                         puts $workpath
                     }
@@ -3667,6 +3685,9 @@
         } else {
             set target $action
         }
+        if {![info exists options(subport)]} {
+            set options(subport) $portname
+        }
         if {[catch {set workername [mportopen $porturl [array get options] [array get requested_variations]]} result]} {
             global errorInfo
             ui_debug "$errorInfo"

Modified: trunk/base/src/port/portindex.tcl
===================================================================
--- trunk/base/src/port/portindex.tcl	2011-04-21 21:04:08 UTC (rev 78061)
+++ trunk/base/src/port/portindex.tcl	2011-04-21 21:07:51 UTC (rev 78062)
@@ -60,6 +60,26 @@
                 puts -nonewline $fd $line
 
                 incr stats(skipped)
+
+                # also reuse the entries for its subports
+                array set portinfo $line
+                if {![info exists portinfo(subports)]} {
+                    return
+                }
+                foreach sub $portinfo(subports) {
+                    set offset $qindex([string tolower $sub])
+                    seek $oldfd $offset
+                    gets $oldfd line
+                    set name [lindex $line 0]
+                    set len [lindex $line 1]
+                    set line [read $oldfd $len]
+    
+                    puts $fd [list $name $len]
+                    puts -nonewline $fd $line
+    
+                    incr stats(skipped)
+                }
+
                 return
             }
         } catch {*} {
@@ -100,7 +120,8 @@
         }
 
         foreach availkey [array names portinfo] {
-            if {![info exists keepkeys($availkey)]} {
+            # store list of subports for top-level ports only
+            if {![info exists keepkeys($availkey)] && $availkey != "subports"} {
                 unset portinfo($availkey)
             }
         }
@@ -112,6 +133,34 @@
         if {$mtime > $newest} {
             set newest $mtime
         }
+        # now index this portfile's subports (if any)
+        if {![info exists portinfo(subports)]} {
+            return
+        }
+        foreach sub $portinfo(subports) {
+            incr stats(total)
+            set prefix {\${prefix}}
+            if {[catch {set interp [mportopen file://[file join $directory $portdir] [concat $port_options subport $sub]]} result]} {
+                puts stderr "Failed to parse file $portdir/Portfile with subport '${sub}': $result"
+                set prefix $save_prefix
+                incr stats(failed)
+            } else {
+                set prefix $save_prefix
+                array set portinfo [mportinfo $interp]
+                mportclose $interp
+                set portinfo(portdir) $portdir
+                puts "Adding subport $sub"
+                foreach availkey [array names portinfo] {
+                    if {![info exists keepkeys($availkey)]} {
+                        unset portinfo($availkey)
+                    }
+                }
+                set output [array get portinfo]
+                set len [expr [string length $output] + 1]
+                puts $fd [list $portinfo(name) $len]
+                puts $fd $output
+            }
+        }
     }
 }
 

Modified: trunk/base/src/port1.0/portactivate.tcl
===================================================================
--- trunk/base/src/port1.0/portactivate.tcl	2011-04-21 21:04:08 UTC (rev 78061)
+++ trunk/base/src/port1.0/portactivate.tcl	2011-04-21 21:07:51 UTC (rev 78062)
@@ -58,9 +58,9 @@
 }
 
 proc portactivate::activate_main {args} {
-    global env name version revision portvariants user_options PortInfo
+    global env subport version revision portvariants user_options PortInfo
 
-    registry_activate $name "${version}_${revision}${portvariants}" [array get user_options]
+    registry_activate $subport "${version}_${revision}${portvariants}" [array get user_options]
 
     # Display notes at the end of the activation phase.
     if {[info exists PortInfo(notes)] && $PortInfo(notes) ne {}} {

Modified: trunk/base/src/port1.0/portbuild.tcl
===================================================================
--- trunk/base/src/port1.0/portbuild.tcl	2011-04-21 21:04:08 UTC (rev 78061)
+++ trunk/base/src/port1.0/portbuild.tcl	2011-04-21 21:07:51 UTC (rev 78062)
@@ -153,7 +153,7 @@
 proc portbuild::build_start {args} {
     global UI_PREFIX
 
-    ui_notice "$UI_PREFIX [format [msgcat::mc "Building %s"] [option name]]"
+    ui_notice "$UI_PREFIX [format [msgcat::mc "Building %s"] [option subport]]"
 }
 
 proc portbuild::build_main {args} {

Modified: trunk/base/src/port1.0/portchecksum.tcl
===================================================================
--- trunk/base/src/port1.0/portchecksum.tcl	2011-04-21 21:04:08 UTC (rev 78061)
+++ trunk/base/src/port1.0/portchecksum.tcl	2011-04-21 21:07:51 UTC (rev 78062)
@@ -191,7 +191,7 @@
 proc portchecksum::checksum_start {args} {
     global UI_PREFIX
 
-    ui_notice "$UI_PREFIX [format [msgcat::mc "Verifying checksum(s) for %s"] [option name]]"
+    ui_notice "$UI_PREFIX [format [msgcat::mc "Verifying checksum(s) for %s"] [option subport]]"
 }
 
 # checksum_main

Modified: trunk/base/src/port1.0/portclean.tcl
===================================================================
--- trunk/base/src/port1.0/portclean.tcl	2011-04-21 21:04:08 UTC (rev 78061)
+++ trunk/base/src/port1.0/portclean.tcl	2011-04-21 21:07:51 UTC (rev 78062)
@@ -52,7 +52,7 @@
 proc portclean::clean_start {args} {
     global UI_PREFIX
 
-    ui_notice "$UI_PREFIX [format [msgcat::mc "Cleaning %s"] [option name]]"
+    ui_notice "$UI_PREFIX [format [msgcat::mc "Cleaning %s"] [option subport]]"
 }
 
 proc portclean::clean_main {args} {
@@ -66,13 +66,13 @@
 
     if {[info exists ports_clean_all] && $ports_clean_all == "yes" || \
         [info exists ports_clean_dist] && $ports_clean_dist == "yes"} {
-        ui_info "$UI_PREFIX [format [msgcat::mc "Removing distfiles for %s"] [option name]]"
+        ui_info "$UI_PREFIX [format [msgcat::mc "Removing distfiles for %s"] [option subport]]"
         clean_dist
     }
     if {[info exists ports_clean_all] && $ports_clean_all == "yes" || \
         [info exists ports_clean_work] && $ports_clean_work == "yes" || \
         !([info exists ports_clean_logs] && $ports_clean_logs == "yes")} {
-         ui_info "$UI_PREFIX [format [msgcat::mc "Removing work directory for %s"] [option name]]"
+         ui_info "$UI_PREFIX [format [msgcat::mc "Removing work directory for %s"] [option subport]]"
          clean_work
     }
     if {(([info exists ports_clean_logs] && $ports_clean_logs == "yes") || ($keeplogs == "no"))
@@ -88,7 +88,7 @@
 # This is crude, but works.
 #
 proc portclean::clean_dist {args} {
-    global ports_force name distpath dist_subdir distfiles patchfiles usealtworkpath portdbpath altprefix
+    global name ports_force distpath dist_subdir distfiles patchfiles usealtworkpath portdbpath altprefix
 
     # remove known distfiles for sure (if they exist)
     set count 0
@@ -199,26 +199,29 @@
 }
 
 proc portclean::clean_work {args} {
-    global portbuildpath worksymlink usealtworkpath altprefix portpath
+    global portbuildpath subbuildpath worksymlink usealtworkpath altprefix portpath
 
-    if {[file isdirectory $portbuildpath]} {
-        ui_debug "Removing directory: ${portbuildpath}"
-        if {[catch {delete $portbuildpath} result]} {
+    if {[file isdirectory $subbuildpath]} {
+        ui_debug "Removing directory: ${subbuildpath}"
+        if {[catch {delete $subbuildpath} result]} {
             ui_debug "$::errorInfo"
             ui_error "$result"
         }
+        # silently fail if non-empty (other subports might be using portbuildpath)
+        catch {file delete $portbuildpath}
     } else {
-        ui_debug "No work directory found to remove at ${portbuildpath}"
+        ui_debug "No work directory found to remove at ${subbuildpath}"
     }
 
-    if {!$usealtworkpath && [file isdirectory ${altprefix}${portbuildpath}]} {
-        ui_debug "Removing directory: ${altprefix}${portbuildpath}"
-        if {[catch {delete ${altprefix}${portbuildpath}} result]} {
+    if {!$usealtworkpath && [file isdirectory ${altprefix}${subbuildpath}]} {
+        ui_debug "Removing directory: ${altprefix}${subbuildpath}"
+        if {[catch {delete ${altprefix}${subbuildpath}} result]} {
             ui_debug "$::errorInfo"
             ui_error "$result"
         }
+        catch {file delete ${altprefix}${portbuildpath}}
     } else {
-        ui_debug "No work directory found to remove at ${altprefix}${portbuildpath}"
+        ui_debug "No work directory found to remove at ${altprefix}${subbuildpath}"
     }
 
     # Clean symlink, if necessary
@@ -236,7 +239,7 @@
     return 0
 }
 proc portclean::clean_logs {args} {
-    global portpath portbuildpath worksymlink name portverbose keeplogs prefix
+    global portpath portbuildpath worksymlink portverbose keeplogs prefix
     set logpath [getportlogpath $portpath]
   	if {[file isdirectory $logpath]} {
         ui_debug "Removing directory: ${logpath}"

Modified: trunk/base/src/port1.0/portconfigure.tcl
===================================================================
--- trunk/base/src/port1.0/portconfigure.tcl	2011-04-21 21:04:08 UTC (rev 78061)
+++ trunk/base/src/port1.0/portconfigure.tcl	2011-04-21 21:07:51 UTC (rev 78062)
@@ -189,7 +189,7 @@
 proc portconfigure::configure_start {args} {
     global UI_PREFIX configure.compiler
     
-    ui_notice "$UI_PREFIX [format [msgcat::mc "Configuring %s"] [option name]]"
+    ui_notice "$UI_PREFIX [format [msgcat::mc "Configuring %s"] [option subport]]"
 
     set name ""
     switch -exact ${configure.compiler} {

Modified: trunk/base/src/port1.0/portdeactivate.tcl
===================================================================
--- trunk/base/src/port1.0/portdeactivate.tcl	2011-04-21 21:04:08 UTC (rev 78061)
+++ trunk/base/src/port1.0/portdeactivate.tcl	2011-04-21 21:07:51 UTC (rev 78062)
@@ -57,7 +57,7 @@
 }
 
 proc portdeactivate::deactivate_main {args} {
-    global name version revision portvariants user_options
-    registry_deactivate $name "${version}_${revision}${portvariants}" [array get user_options]
+    global subport version revision portvariants user_options
+    registry_deactivate $subport "${version}_${revision}${portvariants}" [array get user_options]
     return 0
 }

Modified: trunk/base/src/port1.0/portdestroot.tcl
===================================================================
--- trunk/base/src/port1.0/portdestroot.tcl	2011-04-21 21:04:08 UTC (rev 78061)
+++ trunk/base/src/port1.0/portdestroot.tcl	2011-04-21 21:07:51 UTC (rev 78062)
@@ -69,7 +69,7 @@
 default destroot.keepdirs ""
 default destroot.violate_mtree no
 
-default startupitem.name        {${name}}
+default startupitem.name        {${subport}}
 default startupitem.uniquename  {org.macports.${startupitem.name}}
 default startupitem.plist       {${startupitem.uniquename}.plist}
 default startupitem.location    LaunchDaemons
@@ -98,12 +98,12 @@
 }
 
 proc portdestroot::destroot_start {args} {
-    global UI_PREFIX prefix name porturl destroot os.platform destroot.clean portsharepath
+    global UI_PREFIX prefix subport porturl destroot os.platform destroot.clean portsharepath
     global destroot.umask destroot.asroot euid egid
     global applications_dir frameworks_dir
     variable oldmask
 
-    ui_notice "$UI_PREFIX [format [msgcat::mc "Staging %s into destroot"] ${name}]"
+    ui_notice "$UI_PREFIX [format [msgcat::mc "Staging %s into destroot"] ${subport}]"
 
     # start gsoc08-privileges
     if { [getuid] == 0 && [geteuid] != 0 } {
@@ -145,7 +145,7 @@
 }
 
 proc portdestroot::destroot_finish {args} {
-    global UI_PREFIX destroot prefix name startupitem.create destroot.violate_mtree
+    global UI_PREFIX destroot prefix subport startupitem.create destroot.violate_mtree
     global applications_dir frameworks_dir destroot.keepdirs
     global os.platform os.version
     variable oldmask
@@ -168,8 +168,8 @@
         if {![file isdirectory ${path}]} {
             xinstall -m 0755 -d ${path}
         }
-        if {![file exists ${path}/.turd_${name}]} {
-            xinstall -c -m 0644 /dev/null ${path}/.turd_${name}
+        if {![file exists ${path}/.turd_${subport}]} {
+            xinstall -c -m 0644 /dev/null ${path}/.turd_${subport}
         }
     }
     fs-traverse -depth dir ${destroot} {
@@ -185,7 +185,7 @@
                   alternative destroot mechanism in the Portfile."
         ui_error "Files might have been installed directly into your system,\
                   check before proceeding."
-        return -code error "Staging $name into destroot failed"
+        return -code error "Staging $subport into destroot failed"
     }
 
     # Compress all manpages with gzip (instead)
@@ -194,7 +194,7 @@
     set gunzip "$gzip -d"
     set bunzip2 "[findBinary bzip2 ${portutil::autoconf::bzip2_path}] -d"
     if {[file isdirectory ${manpath}] && [file type ${manpath}] == "directory"} {
-        ui_info "$UI_PREFIX [format [msgcat::mc "Compressing man pages for %s"] ${name}]"
+        ui_info "$UI_PREFIX [format [msgcat::mc "Compressing man pages for %s"] ${subport}]"
         set found 0
         set manlinks [list]
         foreach mandir [readdir "${manpath}"] {
@@ -342,12 +342,12 @@
 
         # abort here only so all violations can be observed
         if { ${mtree_violation} != "no" } {
-            ui_warn "[format [msgcat::mc "%s violates the layout of the ports-filesystems!"] [option name]]"
+            ui_warn "[format [msgcat::mc "%s violates the layout of the ports-filesystems!"] [option subport]]"
             ui_warn "Please fix or indicate this misbehavior (if it is intended), it will be an error in future releases!"
             # error "mtree violation!"
         }
     } else {
-        ui_warn "[format [msgcat::mc "%s installs files outside the common directory structure."] [option name]]"
+        ui_warn "[format [msgcat::mc "%s installs files outside the common directory structure."] [option subport]]"
     }
 
     # Restore umask

Modified: trunk/base/src/port1.0/portdistcheck.tcl
===================================================================
--- trunk/base/src/port1.0/portdistcheck.tcl	2011-04-21 21:04:08 UTC (rev 78061)
+++ trunk/base/src/port1.0/portdistcheck.tcl	2011-04-21 21:07:51 UTC (rev 78062)
@@ -59,7 +59,7 @@
     global distcheck.type
     global fetch.type
     global fetch.ignore_sslcert
-    global name portpath
+    global subport portpath
 
     set port_moddate [file mtime ${portpath}/Portfile]
 
@@ -91,16 +91,16 @@
                     ui_debug [format [msgcat::mc "Checking %s from %s"] $distfile $site]
                     set file_url [portfetch::assemble_url $site $distfile]
                     if {[catch {set urlnewer [eval curl isnewer $curl_options {$file_url} $port_moddate]} error]} {
-                        ui_warn "couldn't fetch $file_url for $name ($error)"
+                        ui_warn "couldn't fetch $file_url for $subport ($error)"
                     } else {
                         if {$urlnewer} {
-                            ui_warn "port $name: $file_url is newer than portfile"
+                            ui_warn "port $subport: $file_url is newer than portfile"
                         }
                         incr count
                     }
                 }
                 if {$count == 0} {
-                    ui_error "no mirror had $distfile for $name"
+                    ui_error "no mirror had $distfile for $subport"
                 }
             } elseif {${distcheck.type} == "filesize"} {
                 set count 0
@@ -108,18 +108,18 @@
                     ui_debug [format [msgcat::mc "Checking %s from %s"] $distfile $site]
                     set file_url [portfetch::assemble_url $site $distfile]
                     if {[catch {set urlsize [eval curl getsize $curl_options {$file_url}]} error]} {
-                        ui_warn "couldn't fetch $file_url for $name ($error)"
+                        ui_warn "couldn't fetch $file_url for $subport ($error)"
                     } else {
                         incr count
                         if {$urlsize > 0} {
-                            ui_info "port $name: $distfile $urlsize bytes"
+                            ui_info "port $subport: $distfile $urlsize bytes"
                             incr totalsize $urlsize
                             break
                         }
                     }
                 }
                 if {$count == 0} {
-                    ui_error "no mirror had $distfile for $name"
+                    ui_error "no mirror had $distfile for $subport"
                 }
             } else {
                 ui_error "unknown distcheck.type ${distcheck.type}"
@@ -141,7 +141,7 @@
                 set size [expr $totalsize / (1024.0*1024.0*1024.0)]
                 set humansize [format "%.1fG" $size]
             }
-            ui_msg "$name: $humansize"
+            ui_msg "$subport: $humansize"
         }
     }
 }

Modified: trunk/base/src/port1.0/portdistfiles.tcl
===================================================================
--- trunk/base/src/port1.0/portdistfiles.tcl	2011-04-21 21:04:08 UTC (rev 78061)
+++ trunk/base/src/port1.0/portdistfiles.tcl	2011-04-21 21:07:51 UTC (rev 78062)
@@ -48,8 +48,8 @@
 set_ui_prefix
 
 proc portdistfiles::distfiles_start {args} {
-    global UI_PREFIX name
-    ui_notice "$UI_PREFIX [format [msgcat::mc "Distfiles for %s"] ${name}]"
+    global UI_PREFIX subport
+    ui_notice "$UI_PREFIX [format [msgcat::mc "Distfiles for %s"] ${subport}]"
 }
 
 proc portdistfiles::distfiles_main {args} {

Modified: trunk/base/src/port1.0/portextract.tcl
===================================================================
--- trunk/base/src/port1.0/portextract.tcl	2011-04-21 21:04:08 UTC (rev 78061)
+++ trunk/base/src/port1.0/portextract.tcl	2011-04-21 21:07:51 UTC (rev 78062)
@@ -36,7 +36,7 @@
 
 set org.macports.extract [target_new org.macports.extract portextract::extract_main]
 target_provides ${org.macports.extract} extract
-target_requires ${org.macports.extract} fetch checksum
+target_requires ${org.macports.extract} main fetch checksum
 target_prerun ${org.macports.extract} portextract::extract_start
 
 namespace eval portextract {
@@ -76,7 +76,7 @@
 proc portextract::extract_start {args} {
     global UI_PREFIX extract.dir extract.mkdir use_bzip2 use_lzma use_xz use_zip use_7z use_dmg
 
-    ui_notice "$UI_PREFIX [format [msgcat::mc "Extracting %s"] [option name]]"
+    ui_notice "$UI_PREFIX [format [msgcat::mc "Extracting %s"] [option subport]]"
 
     # should the distfiles be extracted to worksrcpath instead?
     if {[tbool extract.mkdir]} {

Modified: trunk/base/src/port1.0/portfetch.tcl
===================================================================
--- trunk/base/src/port1.0/portfetch.tcl	2011-04-21 21:04:08 UTC (rev 78061)
+++ trunk/base/src/port1.0/portfetch.tcl	2011-04-21 21:07:51 UTC (rev 78062)
@@ -518,9 +518,9 @@
 }
 
 proc portfetch::fetch_start {args} {
-    global UI_PREFIX name distpath
+    global UI_PREFIX subport distpath
 
-    ui_notice "$UI_PREFIX [format [msgcat::mc "Fetching %s"] $name]"
+    ui_notice "$UI_PREFIX [format [msgcat::mc "Fetching %s"] $subport]"
 
     # create and chown $distpath
     if {![file isdirectory $distpath]} {

Modified: trunk/base/src/port1.0/portinstall.tcl
===================================================================
--- trunk/base/src/port1.0/portinstall.tcl	2011-04-21 21:04:08 UTC (rev 78061)
+++ trunk/base/src/port1.0/portinstall.tcl	2011-04-21 21:07:51 UTC (rev 78062)
@@ -53,9 +53,9 @@
 set_ui_prefix
 
 proc portinstall::install_start {args} {
-    global UI_PREFIX name version revision portvariants
+    global UI_PREFIX subport version revision portvariants
     global prefix registry_open registry.format registry.path
-    ui_notice "$UI_PREFIX [format [msgcat::mc "Installing %s @%s_%s%s"] $name $version $revision $portvariants]"
+    ui_notice "$UI_PREFIX [format [msgcat::mc "Installing %s @%s_%s%s"] $subport $version $revision $portvariants]"
     
     # start gsoc08-privileges
     if {![file writable $prefix] || ([getuid] == 0 && [geteuid] != 0)} {
@@ -106,10 +106,11 @@
 }
 
 proc portinstall::create_archive {location archive.type} {
-    global workpath destpath portpath name version revision portvariants \
+    global workpath destpath portpath subport version revision portvariants \
            epoch os.platform PortInfo installPlist \
            archive.env archive.cmd archive.pre_args archive.args \
-           archive.post_args archive.dir
+           archive.post_args archive.dir \
+           depends_fetch depends_extract depends_build depends_lib depends_run
     set archive.env {}
     set archive.cmd {}
     set archive.pre_args {}
@@ -238,7 +239,7 @@
 
     # Copy state file into destroot for archiving
     # +STATE contains a copy of the MacPorts state information
-    set statefile [file join $workpath .macports.${name}.state]
+    set statefile [file join $workpath .macports.${subport}.state]
     file copy -force $statefile [file join $destpath "+STATE"]
 
     # Copy Portfile into destroot for archiving
@@ -273,8 +274,8 @@
     # files and checksums
     set control [list]
     set fd [open [file join $destpath "+CONTENTS"] w]
-    puts $fd "@name ${name}-${version}_${revision}${portvariants}"
-    puts $fd "@portname ${name}"
+    puts $fd "@name ${subport}-${version}_${revision}${portvariants}"
+    puts $fd "@portname ${subport}"
     puts $fd "@portepoch ${epoch}"
     puts $fd "@portversion ${version}"
     puts $fd "@portrevision ${revision}"
@@ -286,28 +287,24 @@
             puts $fd "@portvariant +${v}"
         }
     }
-    set res [mport_lookup $name]
-    if {[llength $res] < 2} {
-        ui_error "Port $name not found"
-    } else {
-        array set portinfo [lindex $res 1]
-        foreach key "depends_lib depends_run" {
-             if {[info exists portinfo($key)]} {
-                 foreach depspec $portinfo($key) {
-                     set depname [lindex [split $depspec :] end]
-                     set dep [mport_lookup $depname]
-                     if {[llength $dep] < 2} {
-                         ui_error "Dependency $dep not found"
-                     } else {
-                         array set portinfo [lindex $dep 1]
-                         set depver $portinfo(version)
-                         set deprev $portinfo(revision)
-                         puts $fd "@pkgdep ${depname}-${depver}_${deprev}"
-                     }
+
+    foreach key "depends_lib depends_run" {
+         if {[info exists $key]} {
+             foreach depspec [set $key] {
+                 set depname [lindex [split $depspec :] end]
+                 set dep [mport_lookup $depname]
+                 if {[llength $dep] < 2} {
+                     ui_error "Dependency $dep not found"
+                 } else {
+                     array set portinfo [lindex $dep 1]
+                     set depver $portinfo(version)
+                     set deprev $portinfo(revision)
+                     puts $fd "@pkgdep ${depname}-${depver}_${deprev}"
                  }
              }
-        }
+         }
     }
+
     # also save the contents for our own use later
     set installPlist {}
     fs-traverse -depth fullpath $destpath {
@@ -341,7 +338,7 @@
         # TODO: split contents into <buildinfo> (new) and <package> (current)
         #       see existing <portpkg> for the matching source package layout
 
-        putel $sd name ${name}
+        putel $sd name ${subport}
         putel $sd epoch ${epoch}
         putel $sd version ${version}
         putel $sd revision ${revision}
@@ -372,20 +369,14 @@
 
             # Emit dependencies provided by this package
             puts $sd "<provides>"
-                set name ${name}
                 puts $sd "<item>"
-                putel $sd name $name
+                putel $sd name $subport
                 putel $sd major 0
                 putel $sd minor 0
                 puts $sd "</item>"
             puts $sd "</provides>"
-            
-    set res [mport_lookup $name]
-    if {[llength $res] < 2} {
-        ui_error "Dependency $name not found"
-    } else {
-    array set portinfo [lindex $res 1]
 
+
             # Emit build, library, and runtime dependencies
             puts $sd "<requires>"
             foreach {key type} {
@@ -395,17 +386,16 @@
                 depends_lib "library"
                 depends_run "runtime"
             } {
-                if {[info exists portinfo($key)]} {
-                    set name [lindex [split $portinfo($key) :] end]
+                if {[info exists $key]} {
+                    set depname [lindex [split [set $key] :] end]
                     puts $sd "<item type=\"$type\">"
-                    putel $sd name $name
+                    putel $sd name $depname
                     putel $sd major 0
                     putel $sd minor 0
                     puts $sd "</item>"
                 }
             }
             puts $sd "</requires>"
-    }
 
         puts $sd "</xpkg>"
         close $sd
@@ -486,7 +476,7 @@
 }
 
 proc portinstall::install_main {args} {
-    global name version portpath categories description long_description \
+    global subport version portpath categories description long_description \
     homepage depends_run package-install workdir workpath \
     worksrcdir UI_PREFIX destroot revision maintainers user_options \
     portvariants negated_variants targets depends_lib PortInfo epoch license \
@@ -528,7 +518,7 @@
 
         registry::write {
 
-            set regref [registry::entry create $name $version $revision $portvariants $epoch]
+            set regref [registry::entry create $subport $version $revision $portvariants $epoch]
 
             $regref requested $user_options(ports_requested)
             $regref os_platform ${os.platform}
@@ -560,7 +550,7 @@
         }
     } else {
         # Begin the registry entry
-        set regref [registry_new $name $version $revision $portvariants $epoch]
+        set regref [registry_new $subport $version $revision $portvariants $epoch]
         if {[info exists negated_variants]} {
             registry_prop_store $regref negated_variants $negated_variants
         }
@@ -591,11 +581,11 @@
         }
         if {[info exists depends_run]} {
             registry_prop_store $regref depends_run $depends_run
-            registry_register_deps $depends_run $name
+            registry_register_deps $depends_run $subport
         }
         if {[info exists depends_lib]} {
             registry_prop_store $regref depends_lib $depends_lib
-            registry_register_deps $depends_lib $name
+            registry_register_deps $depends_lib $subport
         }
         if {[info exists installPlist]} {
             registry_prop_store $regref contents [_fake_fileinfo_for_index $installPlist]

Modified: trunk/base/src/port1.0/portlint.tcl
===================================================================
--- trunk/base/src/port1.0/portlint.tcl	2011-04-21 21:04:08 UTC (rev 78061)
+++ trunk/base/src/port1.0/portlint.tcl	2011-04-21 21:07:51 UTC (rev 78062)
@@ -89,8 +89,8 @@
 
 
 proc portlint::lint_start {args} {
-    global UI_PREFIX name
-    ui_notice "$UI_PREFIX [format [msgcat::mc "Verifying Portfile for %s"] ${name}]"
+    global UI_PREFIX subport
+    ui_notice "$UI_PREFIX [format [msgcat::mc "Verifying Portfile for %s"] ${subport}]"
 }
 
 proc portlint::lint_main {args} {

Modified: trunk/base/src/port1.0/portlivecheck.tcl
===================================================================
--- trunk/base/src/port1.0/portlivecheck.tcl	2011-04-21 21:04:08 UTC (rev 78061)
+++ trunk/base/src/port1.0/portlivecheck.tcl	2011-04-21 21:07:51 UTC (rev 78062)
@@ -66,7 +66,7 @@
     global livecheck.url livecheck.type livecheck.md5 livecheck.regex livecheck.name livecheck.distname livecheck.version
     global livecheck.ignore_sslcert
     global homepage portpath workpath
-    global master_sites name distfiles
+    global master_sites subport distfiles
 
     set updated 0
     set updated_version "unknown"
@@ -142,7 +142,7 @@
             # single and multiline regex
             ui_debug "Fetching ${livecheck.url}"
             if {[catch {eval curl fetch $curl_options {${livecheck.url}} $tempfile} error]} {
-                ui_error "cannot check if $name was updated ($error)"
+                ui_error "cannot check if $subport was updated ($error)"
                 set updated -1
             } else {
                 # let's extract the version from the file.
@@ -184,14 +184,14 @@
                 }
                 close $chan
                 if {$updated < 0} {
-                    ui_error "cannot check if $name was updated (regex didn't match)"
+                    ui_error "cannot check if $subport was updated (regex didn't match)"
                 }
             }
         }
         "md5" {
             ui_debug "Fetching ${livecheck.url}"
             if {[catch {eval curl fetch $curl_options {${livecheck.url}} $tempfile} error]} {
-                ui_error "cannot check if $name was updated ($error)"
+                ui_error "cannot check if $subport was updated ($error)"
                 set updated -1
             } else {
                 # let's compute the md5 sum.
@@ -205,7 +205,7 @@
         "moddate" {
             set port_moddate [file mtime ${portpath}/Portfile]
             if {[catch {set updated [curl isnewer ${livecheck.url} $port_moddate]} error]} {
-                ui_error "cannot check if $name was updated ($error)"
+                ui_error "cannot check if $subport was updated ($error)"
                 set updated -1
             } else {
                 if {!$updated} {
@@ -224,9 +224,9 @@
 
     if {${livecheck.type} != "none"} {
         if {$updated > 0} {
-            ui_msg "$name seems to have been updated (port version: ${livecheck.version}, new version: $updated_version)"
+            ui_msg "$subport seems to have been updated (port version: ${livecheck.version}, new version: $updated_version)"
         } elseif {$updated == 0} {
-            ui_info "$name seems to be up to date"
+            ui_info "$subport seems to be up to date"
         }
     }
 }

Modified: trunk/base/src/port1.0/portmain.tcl
===================================================================
--- trunk/base/src/port1.0/portmain.tcl	2011-04-21 21:04:08 UTC (rev 78061)
+++ trunk/base/src/port1.0/portmain.tcl	2011-04-21 21:07:51 UTC (rev 78062)
@@ -62,7 +62,25 @@
 # Export options via PortInfo
 options_export name version revision epoch categories maintainers platforms description long_description notes homepage license provides conflicts replaced_by
 
-default workpath {[getportworkpath_from_buildpath $portbuildpath]}
+default subport {[portmain::get_default_subport]}
+proc portmain::get_default_subport {} {
+    global name
+    if {[info exists name]} {
+        return $name
+    }
+    return ""
+}
+default subbuildpath {[portmain::get_subbuildpath]}
+proc portmain::get_subbuildpath {} {
+    global portpath portbuildpath subport
+    if {$subport != ""} {
+        set subdir $subport
+    } else {
+        set subdir [file tail $portpath]
+    }
+    return [file join $portbuildpath $subdir]
+}
+default workpath {[getportworkpath_from_buildpath $subbuildpath]}
 default prefix /opt/local
 default applications_dir /Applications/MacPorts
 default frameworks_dir {${prefix}/Library/Frameworks}

Modified: trunk/base/src/port1.0/portmirror.tcl
===================================================================
--- trunk/base/src/port1.0/portmirror.tcl	2011-04-21 21:04:08 UTC (rev 78061)
+++ trunk/base/src/port1.0/portmirror.tcl	2011-04-21 21:07:51 UTC (rev 78062)
@@ -52,7 +52,7 @@
 # It also records the path in a database.
 
 proc portmirror::mirror_main {args} {
-    global fetch.type name mirror_filemap ports_mirror_new portdbpath
+    global fetch.type mirror_filemap ports_mirror_new portdbpath
 
     set mirror_filemap_path [file join $portdbpath distfiles_mirror.db]
     if {![info exists mirror_filemap]

Modified: trunk/base/src/port1.0/portpatch.tcl
===================================================================
--- trunk/base/src/port1.0/portpatch.tcl	2011-04-21 21:04:08 UTC (rev 78061)
+++ trunk/base/src/port1.0/portpatch.tcl	2011-04-21 21:07:51 UTC (rev 78062)
@@ -75,7 +75,7 @@
         return 0
     }
 
-    ui_notice "$UI_PREFIX [format [msgcat::mc "Applying patches to %s"] [option name]]"
+    ui_notice "$UI_PREFIX [format [msgcat::mc "Applying patches to %s"] [option subport]]"
 
     foreach patch [option patchfiles] {
         set patch_file [getdistname $patch]

Modified: trunk/base/src/port1.0/portstartupitem.tcl
===================================================================
--- trunk/base/src/port1.0/portstartupitem.tcl	2011-04-21 21:04:08 UTC (rev 78061)
+++ trunk/base/src/port1.0/portstartupitem.tcl	2011-04-21 21:07:51 UTC (rev 78062)
@@ -74,7 +74,7 @@
 set_ui_prefix
 
 proc portstartupitem::startupitem_create_rcng {args} {
-    global prefix destroot name os.platform
+    global prefix destroot os.platform
     global startupitem.name startupitem.requires
     global startupitem.start startupitem.stop startupitem.restart
     global startupitem.type
@@ -120,7 +120,7 @@
 }
 
 proc portstartupitem::startupitem_create_darwin_systemstarter {args} {
-    global UI_PREFIX prefix destroot destroot.keepdirs name os.platform
+    global UI_PREFIX prefix destroot destroot.keepdirs subport os.platform
     global startupitem.name startupitem.requires startupitem.init
     global startupitem.start startupitem.stop startupitem.restart startupitem.executable
     global startupitem.pidfile startupitem.logfile startupitem.logevents
@@ -181,10 +181,10 @@
         # An executable is specified, and there is no init, start, stop, or restart
     } else {
         if { ![llength ${startupitem.start} ] } {
-            set startupitem.start [list "sh ${scriptdir}/${name}.sh start"]
+            set startupitem.start [list "sh ${scriptdir}/${subport}.sh start"]
         }
         if { ![llength ${startupitem.stop} ] } {
-            set startupitem.stop [list "sh ${scriptdir}/${name}.sh stop"]
+            set startupitem.stop [list "sh ${scriptdir}/${subport}.sh stop"]
         }
     }
     if { ![llength ${startupitem.requires} ] } {
@@ -387,7 +387,7 @@
     # Emit some information for the user
     ui_notice "###########################################################"
     ui_notice "# A startup item has been generated that will aid in"
-    ui_notice "# starting ${name} with SystemStarter. It is disabled"
+    ui_notice "# starting ${subport} with SystemStarter. It is disabled"
     ui_notice "# by default. Add the following line to /etc/hostconfig"
     ui_notice "# or ${prefix}/etc/rc.conf to start it at startup:"
     ui_notice "#"
@@ -396,7 +396,7 @@
 }
 
 proc portstartupitem::startupitem_create_darwin_launchd {args} {
-    global UI_PREFIX prefix destroot destroot.keepdirs name macosx_deployment_target
+    global UI_PREFIX prefix destroot destroot.keepdirs subport macosx_deployment_target
     global startupitem.name startupitem.uniquename startupitem.plist startupitem.location
     global startupitem.init startupitem.start startupitem.stop startupitem.restart startupitem.executable
     global startupitem.pidfile startupitem.logfile startupitem.logevents startupitem.netchange
@@ -437,10 +437,10 @@
         set wrapper         "${itemdir}/${wrappername}"
 
         if { ![llength ${startupitem.start}] } {
-            set startupitem.start [list "sh ${scriptdir}/${name}.sh start"]
+            set startupitem.start [list "sh ${scriptdir}/${subport}.sh start"]
         }
         if { ![llength ${startupitem.stop}] } {
-            set startupitem.stop [list "sh ${scriptdir}/${name}.sh stop"]
+            set startupitem.stop [list "sh ${scriptdir}/${subport}.sh stop"]
         }
         if { ![llength ${startupitem.restart}] } {
             set startupitem.restart [list Stop Start]
@@ -622,11 +622,11 @@
     # Emit some information for the user
     ui_notice "###########################################################"
     ui_notice "# A startup item has been generated that will aid in"
-    ui_notice "# starting ${name} with launchd. It is disabled"
+    ui_notice "# starting ${subport} with launchd. It is disabled"
     ui_notice "# by default. Execute the following command to start it,"
     ui_notice "# and to cause it to launch at startup:"
     ui_notice "#"
-    ui_notice "# sudo port load ${name}"
+    ui_notice "# sudo port load ${subport}"
     ui_notice "###########################################################"
 }
 

Modified: trunk/base/src/port1.0/porttest.tcl
===================================================================
--- trunk/base/src/port1.0/porttest.tcl	2011-04-21 21:04:08 UTC (rev 78061)
+++ trunk/base/src/port1.0/porttest.tcl	2011-04-21 21:07:51 UTC (rev 78062)
@@ -26,16 +26,16 @@
 set_ui_prefix
 
 proc porttest::test_start {args} {
-    global UI_PREFIX name
-    ui_notice "$UI_PREFIX [format [msgcat::mc "Testing %s"] ${name}]"
+    global UI_PREFIX subport
+    ui_notice "$UI_PREFIX [format [msgcat::mc "Testing %s"] ${subport}]"
 }
 
 proc porttest::test_main {args} {
-    global name test.run
+    global subport test.run
     if {[tbool test.run]} {
         command_exec test
     } else {
-    return -code error [format [msgcat::mc "%s has no tests turned on. see 'test.run' in portfile(7)"] $name]
+    return -code error [format [msgcat::mc "%s has no tests turned on. see 'test.run' in portfile(7)"] $subport]
     }
     return 0
 }

Modified: trunk/base/src/port1.0/portuninstall.tcl
===================================================================
--- trunk/base/src/port1.0/portuninstall.tcl	2011-04-21 21:04:08 UTC (rev 78061)
+++ trunk/base/src/port1.0/portuninstall.tcl	2011-04-21 21:07:51 UTC (rev 78062)
@@ -57,7 +57,7 @@
 }
 
 proc portuninstall::uninstall_main {args} {
-    global name version revision portvariants user_options
-    registry_uninstall $name "${version}_${revision}${portvariants}" [array get user_options]
+    global subport version revision portvariants user_options
+    registry_uninstall $subport "${version}_${revision}${portvariants}" [array get user_options]
     return 0
 }

Modified: trunk/base/src/port1.0/portutil.tcl
===================================================================
--- trunk/base/src/port1.0/portutil.tcl	2011-04-21 21:04:08 UTC (rev 78061)
+++ trunk/base/src/port1.0/portutil.tcl	2011-04-21 21:07:51 UTC (rev 78062)
@@ -198,13 +198,13 @@
 # @param action read/set
 # @param value ignored
 proc handle_deprecated_option {option action {value ""}} {
-    global name $option deprecated_options
+    global subport $option deprecated_options
     set newoption [lindex $deprecated_options($option) 0]
     set refcount  [lindex $deprecated_options($option) 1]
     global $newoption
 
     if {$newoption == ""} {
-        ui_warn "Port $name using deprecated option \"$option\"."
+        ui_warn "Port $subport using deprecated option \"$option\"."
         return
     }
 
@@ -740,6 +740,20 @@
     }
 }
 
+# Portfiles may define more than one port.
+# This executes the given code in 'body' if we were opened as the specified
+# subport, and also adds it to the list of subports that are defined.
+proc subport {subname body} {
+    global subport PortInfo
+    if {![info exists PortInfo(subports)] || [lsearch -exact $PortInfo(subports) $subname] == -1} {
+        lappend PortInfo(subports) $subname
+    }
+    if {$subname == $subport} {
+        set PortInfo(name) $subname
+        uplevel 1 $body
+    }
+}
+
 ########### Environment utility functions ###########
 
 # Parse the environment string of a command, storing the values into the
@@ -1213,8 +1227,8 @@
 set ports_dry_last_skipped ""
 
 proc target_run {ditem} {
-    global target_state_fd workpath portpath ports_trace PortInfo ports_dryrun ports_dry_last_skipped worksrcpath prefix
-    set portname [option name]
+    global target_state_fd workpath portpath ports_trace PortInfo ports_dryrun ports_dry_last_skipped worksrcpath prefix subport
+    set portname $subport
     set result 0
     set skipped 0
     set procedure [ditem_key $ditem procedure]
@@ -1453,20 +1467,20 @@
 
 
 proc eval_targets {target} {
-    global targets target_state_fd name version revision portvariants epoch ports_dryrun user_options
+    global targets target_state_fd subport version revision portvariants epoch ports_dryrun user_options
     set dlist $targets
 
     # the statefile will likely be autocleaned away after install,
     # so special-case already-completed install and activate
-    if {[registry_exists $name $version $revision $portvariants]} {
+    if {[registry_exists $subport $version $revision $portvariants]} {
         if {$target == "install"} {
-            ui_debug "Skipping $target ($name) since this port is already installed"
+            ui_debug "Skipping $target ($subport) since this port is already installed"
             return 0
         } elseif {$target == "activate"} {
-            set regref [registry_open $name $version $revision $portvariants $epoch]
+            set regref [registry_open $subport $version $revision $portvariants $epoch]
             if {[registry_prop_retr $regref active] != 0} {
                 # Something to close the registry entry may be called here, if it existed.
-                ui_debug "Skipping $target ($name @${version}_${revision}${portvariants}) since this port is already active"
+                ui_debug "Skipping $target ($subport @${version}_${revision}${portvariants}) since this port is already active"
                 return 0
             } else {
                 # run the activate target but ignore its (completed) dependencies
@@ -1500,7 +1514,7 @@
 
     if {[llength $dlist] > 0} {
         # somebody broke!
-        set errstring "Warning: the following items did not execute (for $name):"
+        set errstring "Warning: the following items did not execute (for $subport):"
         foreach ditem $dlist {
             append errstring " [ditem_key $ditem name]"
         }
@@ -1516,8 +1530,8 @@
 # open_statefile
 # open file to store name of completed targets
 proc open_statefile {args} {
-    global workpath worksymlink place_worksymlink name portpath ports_ignore_older ports_dryrun
-    global usealtworkpath altprefix env applications_dir portbuildpath
+    global workpath worksymlink place_worksymlink subport portpath ports_ignore_older ports_dryrun
+    global usealtworkpath altprefix env applications_dir subbuildpath
 
     if {$usealtworkpath} {
          ui_warn_once "privileges" "MacPorts running without privileges.\
@@ -1544,7 +1558,7 @@
 
     if {![file isdirectory $workpath] && ![tbool ports_dryrun]} {
         file mkdir $workpath
-        chownAsRoot $portbuildpath
+        chownAsRoot $subbuildpath
         # Create a symlink to the workpath for port authors
         if {[tbool place_worksymlink] && ![file isdirectory $worksymlink]} {
             ui_debug "Attempting ln -sf $workpath $worksymlink"
@@ -1556,7 +1570,7 @@
     dropPrivileges
 
     # flock Portfile
-    set statefile [file join $workpath .macports.${name}.state]
+    set statefile [file join $workpath .macports.${subport}.state]
     if {[file exists $statefile]} {
         if {![file writable $statefile] && ![tbool ports_dryrun]} {
             return -code error "$statefile is not writable - check permission on port directory"
@@ -1567,7 +1581,7 @@
         if {!([info exists ports_ignore_older] && $ports_ignore_older == "yes") && [file mtime $statefile] < [file mtime ${portpath}/Portfile]} {
             if {![tbool ports_dryrun]} {
                 ui_notice "Portfile changed since last build; discarding previous state."
-                chownAsRoot $portbuildpath
+                chownAsRoot $subbuildpath
                 delete $workpath
                 file mkdir $workpath
             } else {
@@ -1744,7 +1758,7 @@
     set chosen [choose_variants $dlist upvariations]
     set negated [lindex $chosen 1]
     set chosen [lindex $chosen 0]
-    set portname $PortInfo(name)
+    set portname [option subport]
 
     # Check to make sure the requested variations are available with this
     # port, if one is not, warn the user and remove the variant from the
@@ -1845,7 +1859,7 @@
 
         array set oldvariations {}
         if {[check_statefile_variants variations oldvariations $state_fd]} {
-            ui_error "Requested variants \"[canonicalize_variants [array get variations]]\" do not match original selection \"[canonicalize_variants [array get oldvariations]]\".\nPlease use the same variants again, perform 'port clean [option name]' or specify the force option (-f)."
+            ui_error "Requested variants \"[canonicalize_variants [array get variations]]\" do not match original selection \"[canonicalize_variants [array get oldvariations]]\".\nPlease use the same variants again, perform 'port clean [option subport]' or specify the force option (-f)."
             set result 1
         } elseif {!([info exists ports_dryrun] && $ports_dryrun == "yes")} {
             # Write variations out to the statefile
@@ -2155,8 +2169,8 @@
 
 # return path where the image/archive for this port will be stored
 proc get_portimage_path {} {
-    global registry.path name version revision portvariants os.platform os.major portarchivetype
-    return [file join ${registry.path} software ${name} "${name}-${version}_${revision}${portvariants}.${os.platform}_${os.major}.[join [get_canonical_archs] -].${portarchivetype}"]
+    global registry.path subport version revision portvariants os.platform os.major portarchivetype
+    return [file join ${registry.path} software ${subport} "${subport}-${version}_${revision}${portvariants}.${os.platform}_${os.major}.[join [get_canonical_archs] -].${portarchivetype}"]
 }
 
 # return list of archive types that we can extract
@@ -2597,20 +2611,20 @@
 
 # check that the selected archs are supported
 proc check_supported_archs {} {
-    global supported_archs build_arch universal_archs configure.build_arch configure.universal_archs name
+    global supported_archs build_arch universal_archs configure.build_arch configure.universal_archs subport
     if {$supported_archs == "noarch"} {
         return 0
     } elseif {[variant_exists universal] && [variant_isset universal]} {
         if {[llength ${configure.universal_archs}] > 1 || $universal_archs == ${configure.universal_archs}} {
             return 0
         } else {
-            ui_error "$name cannot be installed for the configured universal_archs '$universal_archs' because it only supports the arch(s) '$supported_archs'."
+            ui_error "$subport cannot be installed for the configured universal_archs '$universal_archs' because it only supports the arch(s) '$supported_archs'."
             return 1
         }
     } elseif {$build_arch == "" || ${configure.build_arch} != ""} {
         return 0
     }
-    ui_error "$name cannot be installed for the configured build_arch '$build_arch' because it only supports the arch(s) '$supported_archs'."
+    ui_error "$subport cannot be installed for the configured build_arch '$build_arch' because it only supports the arch(s) '$supported_archs'."
     return 1
 }
 
@@ -2650,7 +2664,7 @@
 
 # check if we can unarchive this port
 proc _archive_available {} {
-    global name version revision portvariants ports_source_only workpath \
+    global subport version revision portvariants ports_source_only workpath \
            registry.path os.platform os.major
 
     if {[tbool ports_source_only]} {
@@ -2659,7 +2673,7 @@
 
     set found 0
     foreach unarchive.type [supportedArchiveTypes] {
-        set fullarchivepath [file join ${registry.path} software ${name} "${name}-${version}_${revision}${portvariants}.${os.platform}_${os.major}.[join [get_canonical_archs] -].${unarchive.type}"]
+        set fullarchivepath [file join ${registry.path} software ${subport} "${subport}-${version}_${revision}${portvariants}.${os.platform}_${os.major}.[join [get_canonical_archs] -].${unarchive.type}"]
         if {[file isfile $fullarchivepath]} {
             set found 1
             break

Modified: trunk/base/src/registry2.0/portuninstall.tcl
===================================================================
--- trunk/base/src/registry2.0/portuninstall.tcl	2011-04-21 21:04:08 UTC (rev 78061)
+++ trunk/base/src/registry2.0/portuninstall.tcl	2011-04-21 21:07:51 UTC (rev 78062)
@@ -254,7 +254,7 @@
                 foreach v $minusvariant {
                     lappend variations $v "-"
                 }
-                if {![catch {set mport [mportopen $porturl $optionslist [array get variations]]} result]} {
+                if {![catch {set mport [mportopen $porturl [concat $optionslist subport $portname] [array get variations]]} result]} {
                     array unset depportinfo
                     array set depportinfo [mportinfo $mport]
                     mportclose $mport
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20110421/f8c2575f/attachment-0001.html>


More information about the macports-changes mailing list