Changeset 1697 for trunk/base


Ignore:
Timestamp:
Jan 18, 2003, 5:30:34 AM (17 years ago)
Author:
landonf (Landon Fuller)
Message:

Land ${destroot} support. Thank god.
Portions submitted by: Jean-Pierre Mouilleseaux <jpm@…>

Location:
trunk/base/src/port1.0
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/port1.0/portinstall.tcl

    r1651 r1697  
    3838${com.apple.install} deplist depends_run depends_lib
    3939${com.apple.install} set prerun install_start
     40${com.apple.install} set postrun install_registry
    4041
    4142# define options
     
    5051option_deprecate build.target.install install.target
    5152
     53# XXX nasty kludges to support contents lists AND destdir
     54option_proc contents install_useContents
     55
     56proc install_useContents {option action args} {
     57    global install_useContents
     58    if {${action} == "set" || ${action} == "append"} {
     59        set install_useContents yes
     60    }
     61}
     62
    5263set UI_PREFIX "---> "
    5364
     
    6071}
    6172
     73proc install_element {src_element dst_element} {
     74    global debug
     75
     76    file copy -force $src_element $dst_element
     77    set attributes [file attributes $src_element]       
     78    for {set i 0} {$i < [llength $attributes]} {incr i} {
     79        set opt [lindex $attributes $i]
     80        incr i
     81        set arg [lindex $attributes $i]
     82        file attributes $dst_element $opt $arg
     83    }
     84
     85    file attributes $dst_element -group [file attributes $src_element -group]
     86    file attributes $dst_element -owner [file attributes $src_element -owner]
     87    file attributes $dst_element -permissions [file attributes $src_element -permissions]
     88}
     89
     90proc directory_dig {rootdir workdir {cwd ""}} {
     91    global installPlist
     92    set pwd [pwd]
     93    if [catch {cd $workdir} err] {
     94        puts $err
     95        return
     96    }
     97
     98    foreach name [readdir .] {
     99        if {[string match $name "."] || [string match $name ".."]} {
     100            continue
     101        }
     102        set element [file join $cwd $name]
     103
     104        # XXX jpm's cross-platform code to find file separator
     105        # replace with [file seperator] with tcl 8.4
     106        if {![info exists root]} {
     107            if {[string match [file tail "/monkey"] "monkey"]} {
     108                set root "/"
     109            } elseif {[string match [file tail ":monkey"] "monkey"]} {
     110                set root ":"
     111            } else {
     112                set root "\\"           
     113            }
     114        }
     115
     116        set dst_element [file join $root $element]
     117        set src_element [file join $rootdir $element]
     118        # overwrites files but not directories
     119        if {![file exists $dst_element] || ![file isdirectory $dst_element]} {
     120            ui_debug "installing file: $dst_element"
     121            install_element $src_element $dst_element
     122            lappend installPlist $dst_element
     123        }
     124        if {[file isdirectory $name] && [file type $name] != "link"} {
     125            directory_dig $rootdir $name [file join $cwd $name]
     126        }
     127    }
     128    cd $pwd
     129}
     130
    62131proc install_main {args} {
     132    global install_useContents destpath
    63133    system "[command install]"
     134    if {![tbool install_useContents]} {
     135        directory_dig ${destpath} ${destpath}
     136    }
    64137    return 0
    65138}
     139
     140proc install_registry {args} {
     141    global portname portversion portpath categories description long_description homepage depends_run installPlist package-install uninstall workdir worksrcdir prefix UI_PREFIX contents install_useContents
     142    if {![tbool install_useContents]} {
     143        set _installPlist $installPlist
     144    } else {
     145        set _installPlist $contents
     146    }
     147
     148    # Package installed successfully, so now we must register it
     149    set rhandle [registry_new $portname $portversion]
     150
     151    registry_store $rhandle [list prefix $prefix]
     152    registry_store $rhandle [list categories $categories]
     153    if [info exists description] {
     154        registry_store $rhandle [concat description $description]
     155    }
     156    if [info exists long_description] {
     157        registry_store $rhandle [concat long_description ${long_description}]
     158    }
     159    if [info exists homepage] {
     160        registry_store $rhandle [concat homepage ${homepage}]
     161    }
     162    if [info exists depends_run] {
     163        registry_store $rhandle [list run_depends $depends_run]
     164    }
     165    if [info exists package-install] {
     166        registry_store $rhandle [concat package-install ${package-install}]
     167    }
     168    if [info exists _installPlist] {
     169        registry_store $rhandle [list contents [fileinfo_for_index $_installPlist]]
     170    }
     171    if {[info proc pkg_uninstall] == "pkg_uninstall"} {
     172        registry_store $rhandle [list uninstall [proc_disasm pkg_uninstall]]
     173    }
     174    registry_close $rhandle
     175    return 0
     176}
  • trunk/base/src/port1.0/portmain.tcl

    r1651 r1697  
    4040
    4141# define options
    42 options prefix name version revision categories maintainers workdir worksrcdir filedir distname portdbpath libpath distpath sources_conf os.platform os.version os.arch os.endian platforms default_variants
     42options prefix name version revision categories maintainers
     43options long_description description homepage
     44options workdir worksrcdir filedir distname portdbpath libpath distpath sources_conf os.platform os.version os.arch os.endian platforms default_variants
    4345
    4446# Export options via PortInfo
    45 options_export name version revision categories maintainers platforms
     47options_export name version revision categories maintainers platforms description long_description homepage
    4648
    4749# Assign option procedure to default_variants
     
    5658default destdir destroot
    5759default destpath {${workpath}/${destdir}}
     60# destroot is provided as a clearer name for the "destpath" variable
     61default destroot {${destpath}}
    5862default filedir files
    5963default revision 0
  • trunk/base/src/port1.0/portregistry.tcl

    r1638 r1697  
    3333package require portutil 1.0
    3434
    35 set com.apple.registry [target_new com.apple.registry registry_main]
    36 ${com.apple.registry} provides registry
    37 ${com.apple.registry} requires main fetch extract checksum patch configure build install
    38 ${com.apple.registry} deplist depends_run depends_lib
    39 ${com.apple.registry} set prerun registry_start
     35# XXX During transition period maintain registry procedures in portregistry.tcl
     36# XXX registry is no longer a target
    4037
    4138# define options
    42 options contents long_description description homepage registry.nochecksum registry.path registry.nobzip registry.contents_recurse
    43 
    44 # Export options via PortInfo
    45 options_export description long_description homepage
     39# XXX kludge to support contents lists AND destdir
     40option_deprecate contents
     41options contents registry.nochecksum registry.path registry.nobzip registry.contents_recurse
    4642
    4743default registry.path {[file join ${portdbpath} receipts]}
     
    207203}
    208204
    209 proc registry_main {args} {
    210     global portname portversion portpath categories description long_description homepage depends_run contents package-install uninstall workdir worksrcdir prefix UI_PREFIX
    211 
    212     # Package installed successfully, so now we must register it
    213     set rhandle [registry_new $portname $portversion]
    214 
    215     registry_store $rhandle [list prefix $prefix]
    216     registry_store $rhandle [list categories $categories]
    217     if [info exists description] {
    218         registry_store $rhandle [concat description $description]
    219     }
    220     if [info exists long_description] {
    221         registry_store $rhandle [concat long_description ${long_description}]
    222     }
    223     if [info exists homepage] {
    224         registry_store $rhandle [concat homepage ${homepage}]
    225     }
    226     if [info exists depends_run] {
    227         registry_store $rhandle [list run_depends $depends_run]
    228     }
    229     if [info exists package-install] {
    230         registry_store $rhandle [concat package-install ${package-install}]
    231     }
    232     if [info exists contents] {
    233         registry_store $rhandle [list contents [fileinfo_for_index $contents]]
    234     }
    235     if {[info proc pkg_uninstall] == "pkg_uninstall"} {
    236         registry_store $rhandle [list uninstall [proc_disasm pkg_uninstall]]
    237     }
    238     registry_close $rhandle
    239     return 0
    240 }
     205
  • trunk/base/src/port1.0/portutil.tcl

    r1689 r1697  
    124124            global portname $option $newoption \n\
    125125            if \{\$action != \"read\"\} \{ \n\
    126                 $newoption \[set \$option\] \n\
     126                $newoption \$$option \n\
    127127            \} else \{ \n\
    128128                ui_warn \"Port \$portname using deprecated option \\\"$option\\\".\" \n\
     
    600600    # Select the subset of targets under $target
    601601    if {$target != ""} {
    602         # XXX munge target. install really means registry, then install
    603         # If more than one target ever needs this, make this a generic interface
    604         if {$target == "install"} {
    605             set target registry
    606         }
    607602        set matches [depspec_get_matches $dlist provides $target]
    608603        if {[llength $matches] > 0} {
Note: See TracChangeset for help on using the changeset viewer.