Changeset 78062


Ignore:
Timestamp:
Apr 21, 2011, 9:07:51 PM (9 years ago)
Author:
jmr@…
Message:

implement subports

Location:
trunk/base
Files:
38 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/portmgr/jobs/port_binary_distributable.tcl

    r76039 r78062  
    6767    }
    6868    array set portInfo [lindex $portSearchResult 1]
    69     set mport [mportopen $portInfo(porturl) {} $variantInfo]
     69    set mport [mportopen $portInfo(porturl) [list subport $portName] $variantInfo]
    7070    array unset portInfo
    7171    array set portInfo [mportinfo $mport]
  • trunk/base/portmgr/packaging/dpkgall.tcl

    r68749 r78062  
    440440                }
    441441
     442        # open correct subport
     443        set options(subport) $portinfo(name)
     444
    442445                # Skip un-supported ports
    443446                if {[info exists portinfo(platforms)] && ${anyplatform_flag} != "true"} {
     
    691694
    692695        foreach port [get_required_ports] {
     696            set options(subport) $port
    693697                if {[catch {do_portexec $port [array get options] [array get variants] activate} result]} {
    694698                        global errorInfo
  • trunk/base/portmgr/packaging/packageall.tcl

    r71035 r78062  
    399399        # Turn on verbose output for the build
    400400        set ui_options(ports_verbose) yes
     401        set options(subport) $name
    401402        if {[catch {set workername [mportopen $porturl [array get options] [array get variations] yes]} result] ||
    402403                $result == 1} {
  • trunk/base/portmgr/packaging/rpmall.tcl

    r71035 r78062  
    451451                        array set prebuildinfo [lindex $search 1]
    452452                        set ui_options(ports_verbose) yes
     453                        set options(subport) ${prebuild}
    453454                        if {[catch {set workername [mportopen $prebuildinfo(porturl) [array get options] [array get variations] yes]} result] ||
    454455                                $result == 1} {
     
    471472        # Turn on verbose output for the build
    472473        set ui_options(ports_verbose) yes
     474        set options(subport) $name
    473475        if {[catch {set workername [mportopen $porturl [array get options] [array get variations]]} result] ||
    474476                $result == 1} {
  • trunk/base/src/macports1.0/macports.tcl

    r77681 r78062  
    135135    ui_debug "Starting logging for $portname"
    136136
    137     set logname [macports::getportlogpath $portpath]
     137    set logname [file join [macports::getportlogpath $portpath] $portname]
    138138    file mkdir $logname
    139139    set logname [file join $logname "main.log"]
     
    12411241
    12421242    # Look for an already-open MPort with the same URL.
    1243     # XXX: should compare options and variations here too.
    12441243    # if found, return the existing reference and bump the refcount.
    12451244    if {$nocache != ""} {
     
    12471246    } else {
    12481247        set mport [dlist_search $macports::open_mports porturl $porturl]
     1248        set mport [dlist_search $mport variations $variations]
     1249        set mport [dlist_search $mport options $options]
    12491250    }
    12501251    if {$mport != {}} {
     1252        # just in case more than one somehow matches
     1253        set mport [lindex $mport 0]
    12511254        set refcnt [ditem_key $mport refcnt]
    12521255        incr refcnt
     
    13261329        lappend variations $v "-"
    13271330    }
    1328    
     1331    lappend options subport $name
    13291332    return [mportopen "file://${portfile_dir}/" $options $variations]
    13301333}
     
    17971800}
    17981801
    1799 proc macports::getportbuildpath {id} {
     1802proc macports::getportbuildpath {id {portname ""}} {
    18001803    global macports::portdbpath
    18011804    regsub {://} $id {.} port_path
    18021805    regsub -all {/} $port_path {_} port_path
    1803     return [file join $portdbpath build $port_path]
     1806    return [file join $portdbpath build $port_path $portname]
    18041807}
    18051808
     
    18151818}
    18161819
    1817 proc macports::getportworkpath_from_portdir {portpath} {
    1818     return [macports::getportworkpath_from_buildpath [macports::getportbuildpath $portpath]]
     1820proc macports::getportworkpath_from_portdir {portpath {portname ""}} {
     1821    return [macports::getportworkpath_from_buildpath [macports::getportbuildpath $portpath $portname]]
    18191822}
    18201823
     
    24302433        # avoid propagating requested flag from parent
    24312434        set optionsarray(ports_requested) 0
     2435        # subport will be different for deps
     2436        unset optionsarray(subport)
    24322437        set options [array get optionsarray]
    24332438        set variations [ditem_key $mport variations]
     
    24912496                    return 1
    24922497                }
     2498                lappend options subport $dep_portname
    24932499                # Figure out the subport. Check the open_mports list first, since
    24942500                # we potentially leak mport references if we mportopen each time,
    24952501                # because mportexec only closes each open mport once.
    24962502                set subport [dlist_search $macports::open_mports porturl $dep_portinfo(porturl)]
     2503                set subport [dlist_search $subport options $options]
     2504                set subport [dlist_search $subport variations $variations]
    24972505               
    24982506                if {$subport == {}} {
     
    28672875    global macports::global_variations
    28682876    array set options $optionslist
     2877    set options(subport) $portname
    28692878
    28702879    if {![string match "" $depscachename]} {
     
    30963105    array set interp_options [array get options]
    30973106    set interp_options(ports_requested) $requestedflag
     3107    set interp_options(subport) $newname
    30983108
    30993109    if {[catch {set workername [mportopen $porturl [array get interp_options] [array get variations]]} result]} {
  • trunk/base/src/package1.0/portarchivefetch.tcl

    r77512 r78062  
    6363default archive_sites.listfile {"archive_sites.tcl"}
    6464default archive_sites.listpath {"port1.0/fetch"}
    65 default archive.subdir {${name}}
     65default archive.subdir {${subport}}
    6666
    6767set_ui_prefix
     
    7070proc portarchivefetch::checkarchivefiles {urls} {
    7171    global all_archive_files archivefetch.fulldestpath portarchivetype \
    72            name version revision portvariants archive_sites
     72           version revision portvariants archive_sites
    7373    upvar $urls fetch_urls
    7474
     
    239239    }
    240240    if {[info exists ports_binary_only] && $ports_binary_only == "yes"} {
    241         return -code error "archivefetch failed for [option name] @[option version]_[option revision][option portvariants]"
     241        return -code error "archivefetch failed for [option subport] @[option version]_[option revision][option portvariants]"
    242242    } else {
    243243        return 0
     
    252252proc portarchivefetch::archivefetch_start {args} {
    253253    variable archivefetch_urls
    254     global UI_PREFIX name all_archive_files ports_source_only
     254    global UI_PREFIX subport all_archive_files ports_source_only
    255255    if {![tbool ports_source_only]} {
    256256        portarchivefetch::checkfiles archivefetch_urls
    257257    }
    258258    if {[info exists all_archive_files] && [llength $all_archive_files] > 0} {
    259         ui_msg "$UI_PREFIX [format [msgcat::mc "Fetching archive for %s"] $name]"
     259        ui_msg "$UI_PREFIX [format [msgcat::mc "Fetching archive for %s"] $subport]"
    260260    }
    261261}
  • trunk/base/src/package1.0/portdmg.tcl

    r72783 r78062  
    4545
    4646proc portdmg::dmg_main {args} {
    47     global name version revision package.destpath UI_PREFIX
     47    global subport version revision package.destpath UI_PREFIX
    4848
    49     ui_msg "$UI_PREFIX [format [msgcat::mc "Creating disk image for %s-%s"] ${name} ${version}]"
     49    ui_msg "$UI_PREFIX [format [msgcat::mc "Creating disk image for %s-%s"] ${subport} ${version}]"
    5050
    5151    if {[getuid] == 0 && [geteuid] != 0} {
     
    5353        }
    5454
    55     return [package_dmg $name $version $revision]
     55    return [package_dmg $subport $version $revision]
    5656}
    5757
  • trunk/base/src/package1.0/portdpkg.tcl

    r77633 r78062  
    5555        global UI_PREFIX destpath os.arch os.platform
    5656   
    57         ui_msg "$UI_PREFIX [format [msgcat::mc "Creating dpkg for %s-%s"] [option name] [option version]]"
     57        ui_msg "$UI_PREFIX [format [msgcat::mc "Creating dpkg for %s-%s"] [option subport] [option version]]"
    5858
    5959        # get deplist
    60         set deps [make_dependency_list [option name]]
     60        set deps [make_dependency_list [option subport]]
    6161        set deps [lsort -unique $deps]
    6262        foreach dep $deps {
     
    6464                set vers [lindex [split $dep /] 1]
    6565                # don't re-package ourself
    66                 if {$name != [option name]} {
     66                if {$name != [option subport]} {
    6767                        lappend dependencies "${name} (>= ${vers})"
    6868                }
     
    115115                set pkg_long_description " [option description]\n"
    116116        } else {
    117                 set pkg_long_description " [option name]\n"
     117                set pkg_long_description " [option subport]\n"
    118118        }
    119119
     
    142142        }
    143143
    144         puts $controlfd "Package: [option name]"
     144        puts $controlfd "Package: [option subport]"
    145145        puts $controlfd "Architecture: ${pkg_arch}"
    146146        puts $controlfd "Version: ${pkg_version}"
  • trunk/base/src/package1.0/portmdmg.tcl

    r72783 r78062  
    4545
    4646proc portmdmg::mdmg_main {args} {
    47     global name version revision package.destpath UI_PREFIX
     47    global subport version revision package.destpath UI_PREFIX
    4848
    49     ui_msg "$UI_PREFIX [format [msgcat::mc "Creating disk image for %s-%s"] ${name} ${version}]"
     49    ui_msg "$UI_PREFIX [format [msgcat::mc "Creating disk image for %s-%s"] ${subport} ${version}]"
    5050
    5151    if {[getuid] == 0 && [geteuid] != 0} {
     
    5353        }
    5454
    55     return [package_mdmg $name $version $revision]
     55    return [package_mdmg $subport $version $revision]
    5656}
    5757
  • trunk/base/src/package1.0/portmpkg.tcl

    r73303 r78062  
    4848
    4949proc portmpkg::mpkg_main {args} {
    50     global name version revision package.destpath package.flat UI_PREFIX
     50    global subport version revision package.destpath package.flat UI_PREFIX
    5151
    5252    # Make sure the destination path exists.
    5353    system "mkdir -p ${package.destpath}"
    5454
    55     return [package_mpkg $name $version $revision]
     55    return [package_mpkg $subport $version $revision]
    5656}
    5757
  • trunk/base/src/package1.0/portpkg.tcl

    r77511 r78062  
    5252
    5353proc portpkg::pkg_main {args} {
    54     global name version revision package.type package.destpath package.flat UI_PREFIX
    55 
    56     ui_msg "$UI_PREFIX [format [msgcat::mc "Creating pkg for %s-%s"] ${name} ${version}]"
    57 
    58     return [package_pkg $name $version $revision]
     54    global subport version revision package.type package.destpath package.flat UI_PREFIX
     55
     56    ui_msg "$UI_PREFIX [format [msgcat::mc "Creating pkg for %s-%s"] ${subport} ${version}]"
     57
     58    return [package_pkg $subport $version $revision]
    5959}
    6060
  • trunk/base/src/package1.0/portrpm.tcl

    r77650 r78062  
    5252
    5353proc portrpm::rpm_main {args} {
    54     global name version revision UI_PREFIX
    55    
    56     ui_msg "$UI_PREFIX [format [msgcat::mc "Creating RPM package for %s-%s"] ${name} ${version}]"
    57    
    58     return [rpm_pkg $name $version $revision]
     54    global subport version revision UI_PREFIX
     55   
     56    ui_msg "$UI_PREFIX [format [msgcat::mc "Creating RPM package for %s-%s"] ${subport} ${version}]"
     57   
     58    return [rpm_pkg $subport $version $revision]
    5959}
    6060
  • trunk/base/src/package1.0/portsrpm.tcl

    r51780 r78062  
    4848
    4949proc portsrpm::srpm_main {args} {
    50     global name version revision UI_PREFIX
    51    
    52     ui_msg "$UI_PREFIX [format [msgcat::mc "Creating SRPM package for %s-%s"] ${name} ${version}]"
    53    
    54     return [srpm_pkg $name $version $revision]
     50    global subport version revision UI_PREFIX
     51   
     52    ui_msg "$UI_PREFIX [format [msgcat::mc "Creating SRPM package for %s-%s"] ${subport} ${version}]"
     53   
     54    return [srpm_pkg $subport $version $revision]
    5555}
    5656
  • trunk/base/src/package1.0/portunarchive.tcl

    r77511 r78062  
    6464    global target_state_fd unarchive.skip \
    6565           ports_force ports_source_only ports_binary_only \
    66            name version revision portvariants \
     66           subport version revision portvariants \
    6767           unarchive.type unarchive.file unarchive.path
    6868
     
    7272        return 0
    7373    } elseif {[info exists ports_source_only] && $ports_source_only == "yes"} {
    74         ui_debug "Skipping unarchive ($name) since source-only is set"
     74        ui_debug "Skipping unarchive ($subport) since source-only is set"
    7575        set skipped 1
    7676    } elseif {[check_statefile target org.macports.destroot $target_state_fd]} {
    77         ui_debug "Skipping unarchive ($name) since destroot completed"
     77        ui_debug "Skipping unarchive ($subport) since destroot completed"
    7878        set skipped 1
    7979    } elseif {[info exists ports_force] && $ports_force == "yes"} {
    80         ui_debug "Skipping unarchive ($name) since force is set"
     80        ui_debug "Skipping unarchive ($subport) since force is set"
    8181        set skipped 1
    8282    } else {
     
    9797        } else {
    9898            if {[info exists ports_binary_only] && $ports_binary_only == "yes"} {
    99                 return -code error "Archive for ${name} ${version}_${revision}${portvariants} not found, required when binary-only is set!"
    100             } else {
    101                 ui_debug "Skipping unarchive ($name) since no suitable archive found"
     99                return -code error "Archive for ${subport} ${version}_${revision}${portvariants} not found, required when binary-only is set!"
     100            } else {
     101                ui_debug "Skipping unarchive ($subport) since no suitable archive found"
    102102                set skipped 1
    103103            }
     
    111111
    112112proc portunarchive::unarchive_start {args} {
    113     global UI_PREFIX name version revision portvariants \
     113    global UI_PREFIX subport version revision portvariants \
    114114           unarchive.type unarchive.skip
    115115
     
    123123    }
    124124
    125     ui_msg "$UI_PREFIX [format [msgcat::mc "Unpacking ${unarchive.type} archive for %s %s_%s%s"] $name $version $revision $portvariants]"
     125    ui_msg "$UI_PREFIX [format [msgcat::mc "Unpacking ${unarchive.type} archive for %s %s_%s%s"] $subport $version $revision $portvariants]"
    126126
    127127    return 0
     
    269269
    270270proc portunarchive::unarchive_finish {args} {
    271     global UI_PREFIX target_state_fd unarchive.file name workpath destpath unarchive.skip
     271    global UI_PREFIX target_state_fd unarchive.file subport workpath destpath unarchive.skip
    272272
    273273    if {${unarchive.skip}} {
     
    277277    # Reset state file with archive version
    278278    close $target_state_fd
    279     set statefile [file join $workpath .macports.${name}.state]
     279    set statefile [file join $workpath .macports.${subport}.state]
    280280    file copy -force [file join $destpath "+STATE"] $statefile
    281281    file mtime $statefile [clock seconds]
  • trunk/base/src/port/port.tcl

    r77618 r78062  
    934934
    935935    # open portfile
    936     if {[catch {set mport [mportopen $porturl {} [array get global_variations]]} result]} {
     936    if {[catch {set mport [mportopen $porturl [list subport $portname] [array get global_variations]]} result]} {
    937937        ui_debug "$::errorInfo"
    938938        return -code error "Unable to open port: $result"
     
    980980               
    981981                    # open its portfile
    982                     if {[catch {set mport [mportopen $porturl {} [array get global_variations]]} result]} {
     982                    if {[catch {set mport [mportopen $porturl [list subport $depname] [array get global_variations]]} result]} {
    983983                        ui_debug "$::errorInfo"
    984984                        ui_error "Unable to open port: $result"
     
    18081808                }
    18091809            }
     1810            if {![info exists options(subport)]} {
     1811                set options(subport) $portname
     1812            }
    18101813 
    18111814            if {[catch {set mport [mportopen $porturl [array get options] [array get merged_variations]]} result]} {
     
    18131816                break_softcontinue "Unable to open port: $result" 1 status
    18141817            }
     1818            unset options(subport)
    18151819            array unset portinfo
    18161820            array set portinfo [mportinfo $mport]
     
    18391843            variants        1
    18401844            conflicts       1
     1845            subports        1
    18411846        "
    18421847
     
    18591864            conflicts   "Conflicts with"
    18601865            replaced_by "Replaced by"
     1866            subports    "Sub-ports"
    18611867        }
    18621868
     
    18781884            conflicts 22
    18791885            maintainers 22
     1886            subports 22
    18801887        }
    18811888
     
    19311938            set opts_todo {ports_info_heading
    19321939                ports_info_replaced_by
     1940                ports_info_subports
    19331941                ports_info_variants
    19341942                ports_info_skip_line
     
    21512159                set merged_variations($variation) $value
    21522160            }
     2161        }
     2162        if {![info exists options(subport)]} {
     2163            set options(subport) $portname
    21532164        }
    21542165
     
    26522663                }
    26532664            }
     2665            if {![info exists options(subport)]} {
     2666                set options(subport) $portname
     2667            }
    26542668            if {[catch {set mport [mportopen $porturl [array get options] [array get merged_variations]]} result]} {
    26552669                ui_debug "$::errorInfo"
     
    27302744                    array set portinfo [lindex $result 1]
    27312745                    set porturl $portinfo(porturl)
     2746                    set options(subport) $depname
    27322747                   
    27332748                    # open the portfile if requested
     
    31223137
    31233138        if {!([info exists options(ports_variants_index)] && $options(ports_variants_index) eq "yes")} {
     3139            if {![info exists options(subport)]} {
     3140                set options(subport) $portname
     3141            }
    31243142            if {[catch {set mport [mportopen $porturl [array get options] [array get variations]]} result]} {
    31253143                ui_debug "$::errorInfo"
     
    35223540                work {
    35233541                    # output the path to the port's work directory
    3524                     set workpath [macports::getportworkpath_from_portdir $portdir]
     3542                    set workpath [macports::getportworkpath_from_portdir $portdir $portname]
    35253543                    if {[file exists $workpath]} {
    35263544                        puts $workpath
     
    36673685        } else {
    36683686            set target $action
     3687        }
     3688        if {![info exists options(subport)]} {
     3689            set options(subport) $portname
    36693690        }
    36703691        if {[catch {set workername [mportopen $porturl [array get options] [array get requested_variations]]} result]} {
  • trunk/base/src/port/portindex.tcl

    r71011 r78062  
    6161
    6262                incr stats(skipped)
     63
     64                # also reuse the entries for its subports
     65                array set portinfo $line
     66                if {![info exists portinfo(subports)]} {
     67                    return
     68                }
     69                foreach sub $portinfo(subports) {
     70                    set offset $qindex([string tolower $sub])
     71                    seek $oldfd $offset
     72                    gets $oldfd line
     73                    set name [lindex $line 0]
     74                    set len [lindex $line 1]
     75                    set line [read $oldfd $len]
     76   
     77                    puts $fd [list $name $len]
     78                    puts -nonewline $fd $line
     79   
     80                    incr stats(skipped)
     81                }
     82
    6383                return
    6484            }
     
    101121
    102122        foreach availkey [array names portinfo] {
    103             if {![info exists keepkeys($availkey)]} {
     123            # store list of subports for top-level ports only
     124            if {![info exists keepkeys($availkey)] && $availkey != "subports"} {
    104125                unset portinfo($availkey)
    105126            }
     
    112133        if {$mtime > $newest} {
    113134            set newest $mtime
     135        }
     136        # now index this portfile's subports (if any)
     137        if {![info exists portinfo(subports)]} {
     138            return
     139        }
     140        foreach sub $portinfo(subports) {
     141            incr stats(total)
     142            set prefix {\${prefix}}
     143            if {[catch {set interp [mportopen file://[file join $directory $portdir] [concat $port_options subport $sub]]} result]} {
     144                puts stderr "Failed to parse file $portdir/Portfile with subport '${sub}': $result"
     145                set prefix $save_prefix
     146                incr stats(failed)
     147            } else {
     148                set prefix $save_prefix
     149                array set portinfo [mportinfo $interp]
     150                mportclose $interp
     151                set portinfo(portdir) $portdir
     152                puts "Adding subport $sub"
     153                foreach availkey [array names portinfo] {
     154                    if {![info exists keepkeys($availkey)]} {
     155                        unset portinfo($availkey)
     156                    }
     157                }
     158                set output [array get portinfo]
     159                set len [expr [string length $output] + 1]
     160                puts $fd [list $portinfo(name) $len]
     161                puts $fd $output
     162            }
    114163        }
    115164    }
  • trunk/base/src/port1.0/portactivate.tcl

    r77511 r78062  
    5959
    6060proc portactivate::activate_main {args} {
    61     global env name version revision portvariants user_options PortInfo
     61    global env subport version revision portvariants user_options PortInfo
    6262
    63     registry_activate $name "${version}_${revision}${portvariants}" [array get user_options]
     63    registry_activate $subport "${version}_${revision}${portvariants}" [array get user_options]
    6464
    6565    # Display notes at the end of the activation phase.
  • trunk/base/src/port1.0/portbuild.tcl

    r77891 r78062  
    154154    global UI_PREFIX
    155155
    156     ui_notice "$UI_PREFIX [format [msgcat::mc "Building %s"] [option name]]"
     156    ui_notice "$UI_PREFIX [format [msgcat::mc "Building %s"] [option subport]]"
    157157}
    158158
  • trunk/base/src/port1.0/portchecksum.tcl

    r70974 r78062  
    192192    global UI_PREFIX
    193193
    194     ui_notice "$UI_PREFIX [format [msgcat::mc "Verifying checksum(s) for %s"] [option name]]"
     194    ui_notice "$UI_PREFIX [format [msgcat::mc "Verifying checksum(s) for %s"] [option subport]]"
    195195}
    196196
  • trunk/base/src/port1.0/portclean.tcl

    r77511 r78062  
    5353    global UI_PREFIX
    5454
    55     ui_notice "$UI_PREFIX [format [msgcat::mc "Cleaning %s"] [option name]]"
     55    ui_notice "$UI_PREFIX [format [msgcat::mc "Cleaning %s"] [option subport]]"
    5656}
    5757
     
    6767    if {[info exists ports_clean_all] && $ports_clean_all == "yes" || \
    6868        [info exists ports_clean_dist] && $ports_clean_dist == "yes"} {
    69         ui_info "$UI_PREFIX [format [msgcat::mc "Removing distfiles for %s"] [option name]]"
     69        ui_info "$UI_PREFIX [format [msgcat::mc "Removing distfiles for %s"] [option subport]]"
    7070        clean_dist
    7171    }
     
    7373        [info exists ports_clean_work] && $ports_clean_work == "yes" || \
    7474        !([info exists ports_clean_logs] && $ports_clean_logs == "yes")} {
    75          ui_info "$UI_PREFIX [format [msgcat::mc "Removing work directory for %s"] [option name]]"
     75         ui_info "$UI_PREFIX [format [msgcat::mc "Removing work directory for %s"] [option subport]]"
    7676         clean_work
    7777    }
     
    8989#
    9090proc portclean::clean_dist {args} {
    91     global ports_force name distpath dist_subdir distfiles patchfiles usealtworkpath portdbpath altprefix
     91    global name ports_force distpath dist_subdir distfiles patchfiles usealtworkpath portdbpath altprefix
    9292
    9393    # remove known distfiles for sure (if they exist)
     
    200200
    201201proc portclean::clean_work {args} {
    202     global portbuildpath worksymlink usealtworkpath altprefix portpath
    203 
    204     if {[file isdirectory $portbuildpath]} {
    205         ui_debug "Removing directory: ${portbuildpath}"
    206         if {[catch {delete $portbuildpath} result]} {
     202    global portbuildpath subbuildpath worksymlink usealtworkpath altprefix portpath
     203
     204    if {[file isdirectory $subbuildpath]} {
     205        ui_debug "Removing directory: ${subbuildpath}"
     206        if {[catch {delete $subbuildpath} result]} {
    207207            ui_debug "$::errorInfo"
    208208            ui_error "$result"
    209209        }
    210     } else {
    211         ui_debug "No work directory found to remove at ${portbuildpath}"
    212     }
    213 
    214     if {!$usealtworkpath && [file isdirectory ${altprefix}${portbuildpath}]} {
    215         ui_debug "Removing directory: ${altprefix}${portbuildpath}"
    216         if {[catch {delete ${altprefix}${portbuildpath}} result]} {
     210        # silently fail if non-empty (other subports might be using portbuildpath)
     211        catch {file delete $portbuildpath}
     212    } else {
     213        ui_debug "No work directory found to remove at ${subbuildpath}"
     214    }
     215
     216    if {!$usealtworkpath && [file isdirectory ${altprefix}${subbuildpath}]} {
     217        ui_debug "Removing directory: ${altprefix}${subbuildpath}"
     218        if {[catch {delete ${altprefix}${subbuildpath}} result]} {
    217219            ui_debug "$::errorInfo"
    218220            ui_error "$result"
    219221        }
    220     } else {
    221         ui_debug "No work directory found to remove at ${altprefix}${portbuildpath}"
     222        catch {file delete ${altprefix}${portbuildpath}}
     223    } else {
     224        ui_debug "No work directory found to remove at ${altprefix}${subbuildpath}"
    222225    }
    223226
     
    237240}
    238241proc portclean::clean_logs {args} {
    239     global portpath portbuildpath worksymlink name portverbose keeplogs prefix
     242    global portpath portbuildpath worksymlink portverbose keeplogs prefix
    240243    set logpath [getportlogpath $portpath]
    241244        if {[file isdirectory $logpath]} {
  • trunk/base/src/port1.0/portconfigure.tcl

    r76629 r78062  
    190190    global UI_PREFIX configure.compiler
    191191   
    192     ui_notice "$UI_PREFIX [format [msgcat::mc "Configuring %s"] [option name]]"
     192    ui_notice "$UI_PREFIX [format [msgcat::mc "Configuring %s"] [option subport]]"
    193193
    194194    set name ""
  • trunk/base/src/port1.0/portdeactivate.tcl

    r77511 r78062  
    5858
    5959proc portdeactivate::deactivate_main {args} {
    60     global name version revision portvariants user_options
    61     registry_deactivate $name "${version}_${revision}${portvariants}" [array get user_options]
     60    global subport version revision portvariants user_options
     61    registry_deactivate $subport "${version}_${revision}${portvariants}" [array get user_options]
    6262    return 0
    6363}
  • trunk/base/src/port1.0/portdestroot.tcl

    r77891 r78062  
    7070default destroot.violate_mtree no
    7171
    72 default startupitem.name        {${name}}
     72default startupitem.name        {${subport}}
    7373default startupitem.uniquename  {org.macports.${startupitem.name}}
    7474default startupitem.plist       {${startupitem.uniquename}.plist}
     
    9999
    100100proc portdestroot::destroot_start {args} {
    101     global UI_PREFIX prefix name porturl destroot os.platform destroot.clean portsharepath
     101    global UI_PREFIX prefix subport porturl destroot os.platform destroot.clean portsharepath
    102102    global destroot.umask destroot.asroot euid egid
    103103    global applications_dir frameworks_dir
    104104    variable oldmask
    105105
    106     ui_notice "$UI_PREFIX [format [msgcat::mc "Staging %s into destroot"] ${name}]"
     106    ui_notice "$UI_PREFIX [format [msgcat::mc "Staging %s into destroot"] ${subport}]"
    107107
    108108    # start gsoc08-privileges
     
    146146
    147147proc portdestroot::destroot_finish {args} {
    148     global UI_PREFIX destroot prefix name startupitem.create destroot.violate_mtree
     148    global UI_PREFIX destroot prefix subport startupitem.create destroot.violate_mtree
    149149    global applications_dir frameworks_dir destroot.keepdirs
    150150    global os.platform os.version
     
    169169            xinstall -m 0755 -d ${path}
    170170        }
    171         if {![file exists ${path}/.turd_${name}]} {
    172             xinstall -c -m 0644 /dev/null ${path}/.turd_${name}
     171        if {![file exists ${path}/.turd_${subport}]} {
     172            xinstall -c -m 0644 /dev/null ${path}/.turd_${subport}
    173173        }
    174174    }
     
    186186        ui_error "Files might have been installed directly into your system,\
    187187                  check before proceeding."
    188         return -code error "Staging $name into destroot failed"
     188        return -code error "Staging $subport into destroot failed"
    189189    }
    190190
     
    195195    set bunzip2 "[findBinary bzip2 ${portutil::autoconf::bzip2_path}] -d"
    196196    if {[file isdirectory ${manpath}] && [file type ${manpath}] == "directory"} {
    197         ui_info "$UI_PREFIX [format [msgcat::mc "Compressing man pages for %s"] ${name}]"
     197        ui_info "$UI_PREFIX [format [msgcat::mc "Compressing man pages for %s"] ${subport}]"
    198198        set found 0
    199199        set manlinks [list]
     
    343343        # abort here only so all violations can be observed
    344344        if { ${mtree_violation} != "no" } {
    345             ui_warn "[format [msgcat::mc "%s violates the layout of the ports-filesystems!"] [option name]]"
     345            ui_warn "[format [msgcat::mc "%s violates the layout of the ports-filesystems!"] [option subport]]"
    346346            ui_warn "Please fix or indicate this misbehavior (if it is intended), it will be an error in future releases!"
    347347            # error "mtree violation!"
    348348        }
    349349    } else {
    350         ui_warn "[format [msgcat::mc "%s installs files outside the common directory structure."] [option name]]"
     350        ui_warn "[format [msgcat::mc "%s installs files outside the common directory structure."] [option subport]]"
    351351    }
    352352
  • trunk/base/src/port1.0/portdistcheck.tcl

    r71882 r78062  
    6060    global fetch.type
    6161    global fetch.ignore_sslcert
    62     global name portpath
     62    global subport portpath
    6363
    6464    set port_moddate [file mtime ${portpath}/Portfile]
     
    9292                    set file_url [portfetch::assemble_url $site $distfile]
    9393                    if {[catch {set urlnewer [eval curl isnewer $curl_options {$file_url} $port_moddate]} error]} {
    94                         ui_warn "couldn't fetch $file_url for $name ($error)"
     94                        ui_warn "couldn't fetch $file_url for $subport ($error)"
    9595                    } else {
    9696                        if {$urlnewer} {
    97                             ui_warn "port $name: $file_url is newer than portfile"
     97                            ui_warn "port $subport: $file_url is newer than portfile"
    9898                        }
    9999                        incr count
     
    101101                }
    102102                if {$count == 0} {
    103                     ui_error "no mirror had $distfile for $name"
     103                    ui_error "no mirror had $distfile for $subport"
    104104                }
    105105            } elseif {${distcheck.type} == "filesize"} {
     
    109109                    set file_url [portfetch::assemble_url $site $distfile]
    110110                    if {[catch {set urlsize [eval curl getsize $curl_options {$file_url}]} error]} {
    111                         ui_warn "couldn't fetch $file_url for $name ($error)"
     111                        ui_warn "couldn't fetch $file_url for $subport ($error)"
    112112                    } else {
    113113                        incr count
    114114                        if {$urlsize > 0} {
    115                             ui_info "port $name: $distfile $urlsize bytes"
     115                            ui_info "port $subport: $distfile $urlsize bytes"
    116116                            incr totalsize $urlsize
    117117                            break
     
    120120                }
    121121                if {$count == 0} {
    122                     ui_error "no mirror had $distfile for $name"
     122                    ui_error "no mirror had $distfile for $subport"
    123123                }
    124124            } else {
     
    142142                set humansize [format "%.1fG" $size]
    143143            }
    144             ui_msg "$name: $humansize"
     144            ui_msg "$subport: $humansize"
    145145        }
    146146    }
  • trunk/base/src/port1.0/portdistfiles.tcl

    r75017 r78062  
    4949
    5050proc portdistfiles::distfiles_start {args} {
    51     global UI_PREFIX name
    52     ui_notice "$UI_PREFIX [format [msgcat::mc "Distfiles for %s"] ${name}]"
     51    global UI_PREFIX subport
     52    ui_notice "$UI_PREFIX [format [msgcat::mc "Distfiles for %s"] ${subport}]"
    5353}
    5454
  • trunk/base/src/port1.0/portextract.tcl

    r74754 r78062  
    3737set org.macports.extract [target_new org.macports.extract portextract::extract_main]
    3838target_provides ${org.macports.extract} extract
    39 target_requires ${org.macports.extract} fetch checksum
     39target_requires ${org.macports.extract} main fetch checksum
    4040target_prerun ${org.macports.extract} portextract::extract_start
    4141
     
    7777    global UI_PREFIX extract.dir extract.mkdir use_bzip2 use_lzma use_xz use_zip use_7z use_dmg
    7878
    79     ui_notice "$UI_PREFIX [format [msgcat::mc "Extracting %s"] [option name]]"
     79    ui_notice "$UI_PREFIX [format [msgcat::mc "Extracting %s"] [option subport]]"
    8080
    8181    # should the distfiles be extracted to worksrcpath instead?
  • trunk/base/src/port1.0/portfetch.tcl

    r77861 r78062  
    519519
    520520proc portfetch::fetch_start {args} {
    521     global UI_PREFIX name distpath
    522 
    523     ui_notice "$UI_PREFIX [format [msgcat::mc "Fetching %s"] $name]"
     521    global UI_PREFIX subport distpath
     522
     523    ui_notice "$UI_PREFIX [format [msgcat::mc "Fetching %s"] $subport]"
    524524
    525525    # create and chown $distpath
  • trunk/base/src/port1.0/portinstall.tcl

    r77750 r78062  
    5454
    5555proc portinstall::install_start {args} {
    56     global UI_PREFIX name version revision portvariants
     56    global UI_PREFIX subport version revision portvariants
    5757    global prefix registry_open registry.format registry.path
    58     ui_notice "$UI_PREFIX [format [msgcat::mc "Installing %s @%s_%s%s"] $name $version $revision $portvariants]"
     58    ui_notice "$UI_PREFIX [format [msgcat::mc "Installing %s @%s_%s%s"] $subport $version $revision $portvariants]"
    5959   
    6060    # start gsoc08-privileges
     
    107107
    108108proc portinstall::create_archive {location archive.type} {
    109     global workpath destpath portpath name version revision portvariants \
     109    global workpath destpath portpath subport version revision portvariants \
    110110           epoch os.platform PortInfo installPlist \
    111111           archive.env archive.cmd archive.pre_args archive.args \
    112            archive.post_args archive.dir
     112           archive.post_args archive.dir \
     113           depends_fetch depends_extract depends_build depends_lib depends_run
    113114    set archive.env {}
    114115    set archive.cmd {}
     
    239240    # Copy state file into destroot for archiving
    240241    # +STATE contains a copy of the MacPorts state information
    241     set statefile [file join $workpath .macports.${name}.state]
     242    set statefile [file join $workpath .macports.${subport}.state]
    242243    file copy -force $statefile [file join $destpath "+STATE"]
    243244
     
    274275    set control [list]
    275276    set fd [open [file join $destpath "+CONTENTS"] w]
    276     puts $fd "@name ${name}-${version}_${revision}${portvariants}"
    277     puts $fd "@portname ${name}"
     277    puts $fd "@name ${subport}-${version}_${revision}${portvariants}"
     278    puts $fd "@portname ${subport}"
    278279    puts $fd "@portepoch ${epoch}"
    279280    puts $fd "@portversion ${version}"
     
    287288        }
    288289    }
    289     set res [mport_lookup $name]
    290     if {[llength $res] < 2} {
    291         ui_error "Port $name not found"
    292     } else {
    293         array set portinfo [lindex $res 1]
    294         foreach key "depends_lib depends_run" {
    295              if {[info exists portinfo($key)]} {
    296                  foreach depspec $portinfo($key) {
    297                      set depname [lindex [split $depspec :] end]
    298                      set dep [mport_lookup $depname]
    299                      if {[llength $dep] < 2} {
    300                          ui_error "Dependency $dep not found"
    301                      } else {
    302                          array set portinfo [lindex $dep 1]
    303                          set depver $portinfo(version)
    304                          set deprev $portinfo(revision)
    305                          puts $fd "@pkgdep ${depname}-${depver}_${deprev}"
    306                      }
     290
     291    foreach key "depends_lib depends_run" {
     292         if {[info exists $key]} {
     293             foreach depspec [set $key] {
     294                 set depname [lindex [split $depspec :] end]
     295                 set dep [mport_lookup $depname]
     296                 if {[llength $dep] < 2} {
     297                     ui_error "Dependency $dep not found"
     298                 } else {
     299                     array set portinfo [lindex $dep 1]
     300                     set depver $portinfo(version)
     301                     set deprev $portinfo(revision)
     302                     puts $fd "@pkgdep ${depname}-${depver}_${deprev}"
    307303                 }
    308304             }
    309         }
    310     }
     305         }
     306    }
     307
    311308    # also save the contents for our own use later
    312309    set installPlist {}
     
    342339        #       see existing <portpkg> for the matching source package layout
    343340
    344         putel $sd name ${name}
     341        putel $sd name ${subport}
    345342        putel $sd epoch ${epoch}
    346343        putel $sd version ${version}
     
    373370            # Emit dependencies provided by this package
    374371            puts $sd "<provides>"
    375                 set name ${name}
    376372                puts $sd "<item>"
    377                 putel $sd name $name
     373                putel $sd name $subport
    378374                putel $sd major 0
    379375                putel $sd minor 0
    380376                puts $sd "</item>"
    381377            puts $sd "</provides>"
    382            
    383     set res [mport_lookup $name]
    384     if {[llength $res] < 2} {
    385         ui_error "Dependency $name not found"
    386     } else {
    387     array set portinfo [lindex $res 1]
     378
    388379
    389380            # Emit build, library, and runtime dependencies
     
    396387                depends_run "runtime"
    397388            } {
    398                 if {[info exists portinfo($key)]} {
    399                     set name [lindex [split $portinfo($key) :] end]
     389                if {[info exists $key]} {
     390                    set depname [lindex [split [set $key] :] end]
    400391                    puts $sd "<item type=\"$type\">"
    401                     putel $sd name $name
     392                    putel $sd name $depname
    402393                    putel $sd major 0
    403394                    putel $sd minor 0
     
    406397            }
    407398            puts $sd "</requires>"
    408     }
    409399
    410400        puts $sd "</xpkg>"
     
    487477
    488478proc portinstall::install_main {args} {
    489     global name version portpath categories description long_description \
     479    global subport version portpath categories description long_description \
    490480    homepage depends_run package-install workdir workpath \
    491481    worksrcdir UI_PREFIX destroot revision maintainers user_options \
     
    529519        registry::write {
    530520
    531             set regref [registry::entry create $name $version $revision $portvariants $epoch]
     521            set regref [registry::entry create $subport $version $revision $portvariants $epoch]
    532522
    533523            $regref requested $user_options(ports_requested)
     
    561551    } else {
    562552        # Begin the registry entry
    563         set regref [registry_new $name $version $revision $portvariants $epoch]
     553        set regref [registry_new $subport $version $revision $portvariants $epoch]
    564554        if {[info exists negated_variants]} {
    565555            registry_prop_store $regref negated_variants $negated_variants
     
    592582        if {[info exists depends_run]} {
    593583            registry_prop_store $regref depends_run $depends_run
    594             registry_register_deps $depends_run $name
     584            registry_register_deps $depends_run $subport
    595585        }
    596586        if {[info exists depends_lib]} {
    597587            registry_prop_store $regref depends_lib $depends_lib
    598             registry_register_deps $depends_lib $name
     588            registry_register_deps $depends_lib $subport
    599589        }
    600590        if {[info exists installPlist]} {
  • trunk/base/src/port1.0/portlint.tcl

    r75820 r78062  
    9090
    9191proc portlint::lint_start {args} {
    92     global UI_PREFIX name
    93     ui_notice "$UI_PREFIX [format [msgcat::mc "Verifying Portfile for %s"] ${name}]"
     92    global UI_PREFIX subport
     93    ui_notice "$UI_PREFIX [format [msgcat::mc "Verifying Portfile for %s"] ${subport}]"
    9494}
    9595
  • trunk/base/src/port1.0/portlivecheck.tcl

    r70979 r78062  
    6767    global livecheck.ignore_sslcert
    6868    global homepage portpath workpath
    69     global master_sites name distfiles
     69    global master_sites subport distfiles
    7070
    7171    set updated 0
     
    143143            ui_debug "Fetching ${livecheck.url}"
    144144            if {[catch {eval curl fetch $curl_options {${livecheck.url}} $tempfile} error]} {
    145                 ui_error "cannot check if $name was updated ($error)"
     145                ui_error "cannot check if $subport was updated ($error)"
    146146                set updated -1
    147147            } else {
     
    185185                close $chan
    186186                if {$updated < 0} {
    187                     ui_error "cannot check if $name was updated (regex didn't match)"
     187                    ui_error "cannot check if $subport was updated (regex didn't match)"
    188188                }
    189189            }
     
    192192            ui_debug "Fetching ${livecheck.url}"
    193193            if {[catch {eval curl fetch $curl_options {${livecheck.url}} $tempfile} error]} {
    194                 ui_error "cannot check if $name was updated ($error)"
     194                ui_error "cannot check if $subport was updated ($error)"
    195195                set updated -1
    196196            } else {
     
    206206            set port_moddate [file mtime ${portpath}/Portfile]
    207207            if {[catch {set updated [curl isnewer ${livecheck.url} $port_moddate]} error]} {
    208                 ui_error "cannot check if $name was updated ($error)"
     208                ui_error "cannot check if $subport was updated ($error)"
    209209                set updated -1
    210210            } else {
     
    225225    if {${livecheck.type} != "none"} {
    226226        if {$updated > 0} {
    227             ui_msg "$name seems to have been updated (port version: ${livecheck.version}, new version: $updated_version)"
     227            ui_msg "$subport seems to have been updated (port version: ${livecheck.version}, new version: $updated_version)"
    228228        } elseif {$updated == 0} {
    229             ui_info "$name seems to be up to date"
     229            ui_info "$subport seems to be up to date"
    230230        }
    231231    }
  • trunk/base/src/port1.0/portmain.tcl

    r67763 r78062  
    6363options_export name version revision epoch categories maintainers platforms description long_description notes homepage license provides conflicts replaced_by
    6464
    65 default workpath {[getportworkpath_from_buildpath $portbuildpath]}
     65default subport {[portmain::get_default_subport]}
     66proc portmain::get_default_subport {} {
     67    global name
     68    if {[info exists name]} {
     69        return $name
     70    }
     71    return ""
     72}
     73default subbuildpath {[portmain::get_subbuildpath]}
     74proc portmain::get_subbuildpath {} {
     75    global portpath portbuildpath subport
     76    if {$subport != ""} {
     77        set subdir $subport
     78    } else {
     79        set subdir [file tail $portpath]
     80    }
     81    return [file join $portbuildpath $subdir]
     82}
     83default workpath {[getportworkpath_from_buildpath $subbuildpath]}
    6684default prefix /opt/local
    6785default applications_dir /Applications/MacPorts
  • trunk/base/src/port1.0/portmirror.tcl

    r74064 r78062  
    5353
    5454proc portmirror::mirror_main {args} {
    55     global fetch.type name mirror_filemap ports_mirror_new portdbpath
     55    global fetch.type mirror_filemap ports_mirror_new portdbpath
    5656
    5757    set mirror_filemap_path [file join $portdbpath distfiles_mirror.db]
  • trunk/base/src/port1.0/portpatch.tcl

    r70974 r78062  
    7676    }
    7777
    78     ui_notice "$UI_PREFIX [format [msgcat::mc "Applying patches to %s"] [option name]]"
     78    ui_notice "$UI_PREFIX [format [msgcat::mc "Applying patches to %s"] [option subport]]"
    7979
    8080    foreach patch [option patchfiles] {
  • trunk/base/src/port1.0/portstartupitem.tcl

    r75143 r78062  
    7575
    7676proc portstartupitem::startupitem_create_rcng {args} {
    77     global prefix destroot name os.platform
     77    global prefix destroot os.platform
    7878    global startupitem.name startupitem.requires
    7979    global startupitem.start startupitem.stop startupitem.restart
     
    121121
    122122proc portstartupitem::startupitem_create_darwin_systemstarter {args} {
    123     global UI_PREFIX prefix destroot destroot.keepdirs name os.platform
     123    global UI_PREFIX prefix destroot destroot.keepdirs subport os.platform
    124124    global startupitem.name startupitem.requires startupitem.init
    125125    global startupitem.start startupitem.stop startupitem.restart startupitem.executable
     
    182182    } else {
    183183        if { ![llength ${startupitem.start} ] } {
    184             set startupitem.start [list "sh ${scriptdir}/${name}.sh start"]
     184            set startupitem.start [list "sh ${scriptdir}/${subport}.sh start"]
    185185        }
    186186        if { ![llength ${startupitem.stop} ] } {
    187             set startupitem.stop [list "sh ${scriptdir}/${name}.sh stop"]
     187            set startupitem.stop [list "sh ${scriptdir}/${subport}.sh stop"]
    188188        }
    189189    }
     
    388388    ui_notice "###########################################################"
    389389    ui_notice "# A startup item has been generated that will aid in"
    390     ui_notice "# starting ${name} with SystemStarter. It is disabled"
     390    ui_notice "# starting ${subport} with SystemStarter. It is disabled"
    391391    ui_notice "# by default. Add the following line to /etc/hostconfig"
    392392    ui_notice "# or ${prefix}/etc/rc.conf to start it at startup:"
     
    397397
    398398proc portstartupitem::startupitem_create_darwin_launchd {args} {
    399     global UI_PREFIX prefix destroot destroot.keepdirs name macosx_deployment_target
     399    global UI_PREFIX prefix destroot destroot.keepdirs subport macosx_deployment_target
    400400    global startupitem.name startupitem.uniquename startupitem.plist startupitem.location
    401401    global startupitem.init startupitem.start startupitem.stop startupitem.restart startupitem.executable
     
    438438
    439439        if { ![llength ${startupitem.start}] } {
    440             set startupitem.start [list "sh ${scriptdir}/${name}.sh start"]
     440            set startupitem.start [list "sh ${scriptdir}/${subport}.sh start"]
    441441        }
    442442        if { ![llength ${startupitem.stop}] } {
    443             set startupitem.stop [list "sh ${scriptdir}/${name}.sh stop"]
     443            set startupitem.stop [list "sh ${scriptdir}/${subport}.sh stop"]
    444444        }
    445445        if { ![llength ${startupitem.restart}] } {
     
    623623    ui_notice "###########################################################"
    624624    ui_notice "# A startup item has been generated that will aid in"
    625     ui_notice "# starting ${name} with launchd. It is disabled"
     625    ui_notice "# starting ${subport} with launchd. It is disabled"
    626626    ui_notice "# by default. Execute the following command to start it,"
    627627    ui_notice "# and to cause it to launch at startup:"
    628628    ui_notice "#"
    629     ui_notice "# sudo port load ${name}"
     629    ui_notice "# sudo port load ${subport}"
    630630    ui_notice "###########################################################"
    631631}
  • trunk/base/src/port1.0/porttest.tcl

    r70974 r78062  
    2727
    2828proc porttest::test_start {args} {
    29     global UI_PREFIX name
    30     ui_notice "$UI_PREFIX [format [msgcat::mc "Testing %s"] ${name}]"
     29    global UI_PREFIX subport
     30    ui_notice "$UI_PREFIX [format [msgcat::mc "Testing %s"] ${subport}]"
    3131}
    3232
    3333proc porttest::test_main {args} {
    34     global name test.run
     34    global subport test.run
    3535    if {[tbool test.run]} {
    3636        command_exec test
    3737    } else {
    38     return -code error [format [msgcat::mc "%s has no tests turned on. see 'test.run' in portfile(7)"] $name]
     38    return -code error [format [msgcat::mc "%s has no tests turned on. see 'test.run' in portfile(7)"] $subport]
    3939    }
    4040    return 0
  • trunk/base/src/port1.0/portuninstall.tcl

    r64718 r78062  
    5858
    5959proc portuninstall::uninstall_main {args} {
    60     global name version revision portvariants user_options
    61     registry_uninstall $name "${version}_${revision}${portvariants}" [array get user_options]
     60    global subport version revision portvariants user_options
     61    registry_uninstall $subport "${version}_${revision}${portvariants}" [array get user_options]
    6262    return 0
    6363}
  • trunk/base/src/port1.0/portutil.tcl

    r78053 r78062  
    199199# @param value ignored
    200200proc handle_deprecated_option {option action {value ""}} {
    201     global name $option deprecated_options
     201    global subport $option deprecated_options
    202202    set newoption [lindex $deprecated_options($option) 0]
    203203    set refcount  [lindex $deprecated_options($option) 1]
     
    205205
    206206    if {$newoption == ""} {
    207         ui_warn "Port $name using deprecated option \"$option\"."
     207        ui_warn "Port $subport using deprecated option \"$option\"."
    208208        return
    209209    }
     
    738738    if {$match} {
    739739        uplevel 1 $code
     740    }
     741}
     742
     743# Portfiles may define more than one port.
     744# This executes the given code in 'body' if we were opened as the specified
     745# subport, and also adds it to the list of subports that are defined.
     746proc subport {subname body} {
     747    global subport PortInfo
     748    if {![info exists PortInfo(subports)] || [lsearch -exact $PortInfo(subports) $subname] == -1} {
     749        lappend PortInfo(subports) $subname
     750    }
     751    if {$subname == $subport} {
     752        set PortInfo(name) $subname
     753        uplevel 1 $body
    740754    }
    741755}
     
    12141228
    12151229proc target_run {ditem} {
    1216     global target_state_fd workpath portpath ports_trace PortInfo ports_dryrun ports_dry_last_skipped worksrcpath prefix
    1217     set portname [option name]
     1230    global target_state_fd workpath portpath ports_trace PortInfo ports_dryrun ports_dry_last_skipped worksrcpath prefix subport
     1231    set portname $subport
    12181232    set result 0
    12191233    set skipped 0
     
    14541468
    14551469proc eval_targets {target} {
    1456     global targets target_state_fd name version revision portvariants epoch ports_dryrun user_options
     1470    global targets target_state_fd subport version revision portvariants epoch ports_dryrun user_options
    14571471    set dlist $targets
    14581472
    14591473    # the statefile will likely be autocleaned away after install,
    14601474    # so special-case already-completed install and activate
    1461     if {[registry_exists $name $version $revision $portvariants]} {
     1475    if {[registry_exists $subport $version $revision $portvariants]} {
    14621476        if {$target == "install"} {
    1463             ui_debug "Skipping $target ($name) since this port is already installed"
     1477            ui_debug "Skipping $target ($subport) since this port is already installed"
    14641478            return 0
    14651479        } elseif {$target == "activate"} {
    1466             set regref [registry_open $name $version $revision $portvariants $epoch]
     1480            set regref [registry_open $subport $version $revision $portvariants $epoch]
    14671481            if {[registry_prop_retr $regref active] != 0} {
    14681482                # Something to close the registry entry may be called here, if it existed.
    1469                 ui_debug "Skipping $target ($name @${version}_${revision}${portvariants}) since this port is already active"
     1483                ui_debug "Skipping $target ($subport @${version}_${revision}${portvariants}) since this port is already active"
    14701484                return 0
    14711485            } else {
     
    15011515    if {[llength $dlist] > 0} {
    15021516        # somebody broke!
    1503         set errstring "Warning: the following items did not execute (for $name):"
     1517        set errstring "Warning: the following items did not execute (for $subport):"
    15041518        foreach ditem $dlist {
    15051519            append errstring " [ditem_key $ditem name]"
     
    15171531# open file to store name of completed targets
    15181532proc open_statefile {args} {
    1519     global workpath worksymlink place_worksymlink name portpath ports_ignore_older ports_dryrun
    1520     global usealtworkpath altprefix env applications_dir portbuildpath
     1533    global workpath worksymlink place_worksymlink subport portpath ports_ignore_older ports_dryrun
     1534    global usealtworkpath altprefix env applications_dir subbuildpath
    15211535
    15221536    if {$usealtworkpath} {
     
    15451559    if {![file isdirectory $workpath] && ![tbool ports_dryrun]} {
    15461560        file mkdir $workpath
    1547         chownAsRoot $portbuildpath
     1561        chownAsRoot $subbuildpath
    15481562        # Create a symlink to the workpath for port authors
    15491563        if {[tbool place_worksymlink] && ![file isdirectory $worksymlink]} {
     
    15571571
    15581572    # flock Portfile
    1559     set statefile [file join $workpath .macports.${name}.state]
     1573    set statefile [file join $workpath .macports.${subport}.state]
    15601574    if {[file exists $statefile]} {
    15611575        if {![file writable $statefile] && ![tbool ports_dryrun]} {
     
    15681582            if {![tbool ports_dryrun]} {
    15691583                ui_notice "Portfile changed since last build; discarding previous state."
    1570                 chownAsRoot $portbuildpath
     1584                chownAsRoot $subbuildpath
    15711585                delete $workpath
    15721586                file mkdir $workpath
     
    17451759    set negated [lindex $chosen 1]
    17461760    set chosen [lindex $chosen 0]
    1747     set portname $PortInfo(name)
     1761    set portname [option subport]
    17481762
    17491763    # Check to make sure the requested variations are available with this
     
    18461860        array set oldvariations {}
    18471861        if {[check_statefile_variants variations oldvariations $state_fd]} {
    1848             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)."
     1862            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)."
    18491863            set result 1
    18501864        } elseif {!([info exists ports_dryrun] && $ports_dryrun == "yes")} {
     
    21562170# return path where the image/archive for this port will be stored
    21572171proc get_portimage_path {} {
    2158     global registry.path name version revision portvariants os.platform os.major portarchivetype
    2159     return [file join ${registry.path} software ${name} "${name}-${version}_${revision}${portvariants}.${os.platform}_${os.major}.[join [get_canonical_archs] -].${portarchivetype}"]
     2172    global registry.path subport version revision portvariants os.platform os.major portarchivetype
     2173    return [file join ${registry.path} software ${subport} "${subport}-${version}_${revision}${portvariants}.${os.platform}_${os.major}.[join [get_canonical_archs] -].${portarchivetype}"]
    21602174}
    21612175
     
    25982612# check that the selected archs are supported
    25992613proc check_supported_archs {} {
    2600     global supported_archs build_arch universal_archs configure.build_arch configure.universal_archs name
     2614    global supported_archs build_arch universal_archs configure.build_arch configure.universal_archs subport
    26012615    if {$supported_archs == "noarch"} {
    26022616        return 0
     
    26052619            return 0
    26062620        } else {
    2607             ui_error "$name cannot be installed for the configured universal_archs '$universal_archs' because it only supports the arch(s) '$supported_archs'."
     2621            ui_error "$subport cannot be installed for the configured universal_archs '$universal_archs' because it only supports the arch(s) '$supported_archs'."
    26082622            return 1
    26092623        }
     
    26112625        return 0
    26122626    }
    2613     ui_error "$name cannot be installed for the configured build_arch '$build_arch' because it only supports the arch(s) '$supported_archs'."
     2627    ui_error "$subport cannot be installed for the configured build_arch '$build_arch' because it only supports the arch(s) '$supported_archs'."
    26142628    return 1
    26152629}
     
    26512665# check if we can unarchive this port
    26522666proc _archive_available {} {
    2653     global name version revision portvariants ports_source_only workpath \
     2667    global subport version revision portvariants ports_source_only workpath \
    26542668           registry.path os.platform os.major
    26552669
     
    26602674    set found 0
    26612675    foreach unarchive.type [supportedArchiveTypes] {
    2662         set fullarchivepath [file join ${registry.path} software ${name} "${name}-${version}_${revision}${portvariants}.${os.platform}_${os.major}.[join [get_canonical_archs] -].${unarchive.type}"]
     2676        set fullarchivepath [file join ${registry.path} software ${subport} "${subport}-${version}_${revision}${portvariants}.${os.platform}_${os.major}.[join [get_canonical_archs] -].${unarchive.type}"]
    26632677        if {[file isfile $fullarchivepath]} {
    26642678            set found 1
  • trunk/base/src/registry2.0/portuninstall.tcl

    r77511 r78062  
    255255                    lappend variations $v "-"
    256256                }
    257                 if {![catch {set mport [mportopen $porturl $optionslist [array get variations]]} result]} {
     257                if {![catch {set mport [mportopen $porturl [concat $optionslist subport $portname] [array get variations]]} result]} {
    258258                    array unset depportinfo
    259259                    array set depportinfo [mportinfo $mport]
Note: See TracChangeset for help on using the changeset viewer.