Ignore:
Timestamp:
Mar 6, 2003, 9:44:19 AM (16 years ago)
Author:
kevin
Message:

Honor depspec regular expressions.

File:
1 edited

Legend:

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

    r2126 r2163  
    908908}
    909909
    910 proc portfile_search_path {depregex search_path} {
    911     set found 0
    912     foreach path $search_path {
    913         if {![file isdirectory $path]} {
    914             continue
    915         }
    916         foreach filename [readdir $path] {
    917             if {[regexp $depregex $filename] == 1} {
    918                 ui_debug "Found Dependency: path: $path filename: $filename regex: $depregex"
    919                 set found 1
    920                 break
    921             }
    922         }
    923     }
    924     return $found
    925 }
    926 
    927 
    928 # XXX - Architecture specific
    929 # XXX - Rely on information from internal defines in cctools/dyld:
    930 # define DEFAULT_FALLBACK_FRAMEWORK_PATH
    931 # /Library/Frameworks:/Library/Frameworks:/Network/Library/Frameworks:/System/Library/Frameworks
    932 # define DEFAULT_FALLBACK_LIBRARY_PATH /lib:/usr/local/lib:/lib:/usr/lib
    933 # Environment variables DYLD_FRAMEWORK_PATH, DYLD_LIBRARY_PATH,
    934 # DYLD_FALLBACK_FRAMEWORK_PATH, and DYLD_FALLBACK_LIBRARY_PATH take precedence
    935 
    936 proc libportfile_test {this} {
    937     global env prefix
    938    
    939     # Check the registry first
    940     set result [portfile_test $this]
    941     if {$result == 1} {
    942         return $result
    943     } else {
    944         # Not in the registry, check the library path.
    945         set depregex [$this get depregex]
    946        
    947         if {[info exists env(DYLD_FRAMEWORK_PATH)]} {
    948             lappend search_path $env(DYLD_FRAMEWORK_PATH)
    949         } else {
    950             lappend search_path /Library/Frameworks /Network/Library/Frameworks /System/Library/Frameworks
    951         }
    952         if {[info exists env(DYLD_FALLBACK_FRAMEWORK_PATH)]} {
    953             lappend search_path $env(DYLD_FALLBACK_FRAMEWORK_PATH)
    954         }
    955         if {[info exists env(DYLD_LIBRARY_PATH)]} {
    956             lappend search_path $env(DYLD_LIBRARY_PATH)
    957         } else {
    958             lappend search_path /lib /usr/local/lib /lib /usr/lib /op/local/lib /usr/X11R6/lib ${prefix}/lib
    959         }
    960         if {[info exists env(DYLD_FALLBACK_LIBRARY_PATH)]} {
    961             lappend search_path $env(DYLD_LIBRARY_PATH)
    962         }
    963         regsub {\.} $depregex {\.} depregex
    964         set depregex \^$depregex.*\\.dylib\$
    965        
    966         return [portfile_search_path $depregex $search_path]
    967     }
    968 }
    969 
    970 proc binportfile_test {this} {
    971     global env prefix
    972    
    973     # Check the registry first
    974     set result [portfile_test $this]
    975     if {$result == 1} {
    976         return $result
    977     } else {
    978         # Not in the registry, check the binary path.
    979         set depregex [$this get depregex]
    980        
    981         set search_path [split $env(PATH) :]
    982        
    983         set depregex \^$depregex\$
    984        
    985         return [portfile_search_path $depregex $search_path]
    986     }
    987 }
    988 
    989 proc pathportfile_test {this} {
    990     global env prefix
    991    
    992     # Check the registry first
    993     set result [portfile_test $this]
    994     if {$result == 1} {
    995         return $result
    996     } else {
    997         # Not in the registry, check the path.
    998         # separate directory from regex
    999         set fullname [$this get depregex]
    1000 
    1001         regexp {^(.*)/(.*?)$} "$fullname" match search_path depregex
    1002 
    1003         if {[string index $search_path 0] != "/"} {
    1004                 # Prepend prefix if not an absolute path
    1005                 set search_path "${prefix}/${search_path}"
    1006         }
    1007                
    1008         set depregex \^$depregex\$
    1009        
    1010         return [portfile_search_path $depregex $search_path]
    1011     }
    1012 }
    1013910
    1014911proc adduser {name args} {
Note: See TracChangeset for help on using the changeset viewer.