Changeset 41040


Ignore:
Timestamp:
Oct 21, 2008, 11:06:39 AM (12 years ago)
Author:
raimue@…
Message:

macports/macport.tcl:

  • New flag "default" for sources to indicate fallback for resources (group)
  • Add parameter to getsourceconfigdir to get path for a requested file
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/variant-descs-14482/base/src/macports1.0/macports.tcl

    r40953 r41040  
    328328    global macports::registry.path
    329329    global macports::sources
     330    global macports::sources_default
    330331    global macports::sources_conf
    331332    global macports::destroot_umask
     
    419420                set flags [split $flags ,]
    420421                foreach flag $flags {
    421                     if {[lsearch -exact [list nosync] $flag] == -1} {
     422                    if {[lsearch -exact [list nosync default] $flag] == -1} {
    422423                        ui_warn "$sources_conf source '$line' specifies invalid flag '$flag'"
     424                    }
     425                    if {$flag == "default"} {
     426                        set sources_default [concat [list $url] $flags]
    423427                    }
    424428                }
     
    901905#
    902906# @param url port url
    903 # @return path to the .resources directory or an empty string if the protocol does \
    904 #         not support .resources
    905 proc macports::getsourceconfigdir {url} {
    906     if {[catch {getprotocol $url} protocol]} {
    907         return ""
    908     }
     907# @return path to the .resources directory or the path to the fallback
     908proc macports::getsourceconfigdir {url {path ""}} {
     909    global macports::sources_default
     910
     911    set protocol [getprotocol $url]
    909912
    910913    switch -- ${protocol} {
    911914        file {
    912             return [file normalize [file join [getportdir $url] .. .. .resources]]
    913         }
    914         default {
    915             return ""
    916         }
    917     }
     915            set proposedpath [file normalize [file join [getportdir $url] .. .. .resources $path]]
     916        }
     917    }
     918
     919    if {[file exists $proposedpath]} {
     920        return $proposedpath
     921    }
     922
     923    # fallback
     924    return [file join [getportdir [lindex ${sources_default} 0]] .resources $path]
    918925}
    919926
Note: See TracChangeset for help on using the changeset viewer.