Changeset 66268


Ignore:
Timestamp:
Apr 8, 2010, 5:01:29 AM (7 years ago)
Author:
jmr@…
Message:

remove implicit variants, 'platform' now acts like a fancy 'if' statement

Location:
trunk/base
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/portmgr/jobs/mirror_macports.sh

    r53280 r66268  
    5050  done
    5151
     52  # mirror with each platform (can exclude the one the server is running)
     53  for VERS in "8 9 10";
     54  do
     55    for ARCH in "i386 powerpc";
     56    do
     57      echo "Mirroring ${P} with platform darwin ${VERS} ${ARCH}"
     58      $PORT mirror $P os.major=${VERS} os.arch=${ARCH}
     59    done
     60  done
     61
    5262  # clean up the work area
    5363  $PORT clean --work $P;
  • trunk/base/src/macports1.0/macports.tcl

    r66214 r66268  
    572572    }
    573573    global macports::global_variations
    574     array set macports::global_variations [mport_filtervariants [array get variations] yes]
     574    array set macports::global_variations [array get variations]
    575575
    576576    if {![info exists portdbpath]} {
     
    11861186
    11871187
    1188 # mport_filtervariants
    1189 # returns the given list of variants with implicitly-set ones removed
    1190 proc mport_filtervariants {variations {warn yes}} {
    1191     # Iterate through the variants, filtering out
    1192     # implicit ones. At the moment, the only implicit variants are
    1193     # platform variants.
    1194     set filteredvariations {}
    1195 
    1196     foreach {variation value} $variations {
    1197         switch -regexp $variation {
    1198             ^(pure)?darwin         -
    1199             ^(free|net|open){1}bsd -
    1200             ^i386                  -
    1201             ^linux                 -
    1202             ^macosx                -
    1203             ^powerpc               -
    1204             ^solaris               -
    1205             ^sunos {
    1206                 if {$warn} {
    1207                     ui_warn "Implicit variants should not be explicitly set or unset. $variation will be ignored."
    1208                 }
    1209             }
    1210             default {
    1211                 lappend filteredvariations $variation $value
    1212             }
    1213         }
    1214     }
    1215     return $filteredvariations
    1216 }
    1217 
    1218 
    12191188# mportopen
    12201189# Opens a MacPorts portfile specified by a URL.  The Portfile is
     
    13121281        lappend variations $v "-"
    13131282    }
    1314     set variations [mport_filtervariants $variations no]
    13151283   
    13161284    return [mportopen "file://${portfile_dir}/" $options $variations]
     
    26772645        set orig_nodeps no
    26782646    }
    2679     # filter out implicit variants from the explicitly set/unset variants.
    2680     set variationslist [mport_filtervariants $variationslist yes]
    26812647   
    26822648    # run the actual upgrade
     
    28842850        lappend oldvariantlist $v "-"
    28852851    }
    2886     # remove implicit variants, without printing warnings
    2887     set oldvariantlist [mport_filtervariants $oldvariantlist no]
    28882852
    28892853    # merge in the old variants
  • trunk/base/src/port/port.tcl

    r66215 r66268  
    35763576            set porturl $portinfo(porturl)
    35773577        }
    3578        
     3578
    35793579        # use existing variants iff none were explicitly requested
    35803580        if {[array get requested_variations] == "" && [array get variations] != ""} {
    35813581            array unset requested_variations
    35823582            array set requested_variations [array get variations]
    3583             set filtered_variations [mport_filtervariants [array get variations] no]
    3584         } else {
    3585             set filtered_variations [mport_filtervariants [array get requested_variations] yes]
    3586         }
    3587         # Filter out implicit variants from the explicitly set/unset variants.
    3588         # Except we need to keep them for some targets to work right...
    3589         switch -exact $target {
    3590             distfiles -
    3591             mirror {}
    3592             default {
    3593                 array unset requested_variations
    3594                 array set requested_variations $filtered_variations
    3595             }
    3596         }
    3597        
     3583        }
     3584
    35983585        # Add any global_variations to the variations
    35993586        # specified for the port
  • trunk/base/src/port1.0/portlint.tcl

    r64915 r66268  
    244244            regexp {platform\s+(?:\w+\s+(?:\w+\s+)?)?(\w+)} $line -> platform_arch
    245245            if {$platform_arch == "ppc"} {
    246                 ui_error "Arch 'ppc' in platform variant on line $lineno should be 'powerpc'"
     246                ui_error "Arch 'ppc' in platform on line $lineno should be 'powerpc'"
    247247                incr errors
    248248            }
  • trunk/base/src/port1.0/portmain.tcl

    r66156 r66268  
    112112default universal_variant yes
    113113
    114 default compiler.cpath {${prefix}/include}
    115 default compiler.library_path {${prefix}/lib}
    116 
    117 # Select implicit variants
    118 if {[info exists os.platform] && ![info exists variations(${os.platform})]} { variant_set ${os.platform}}
    119 if {[info exists os.arch] && ![info exists variations(${os.arch})]} { variant_set ${os.arch} }
    120 if {[info exists os.platform] && (${os.platform} == "darwin") && ![file isdirectory /System/Library/Frameworks/Carbon.framework] && ![info exists variations(puredarwin)]} { variant_set puredarwin }
    121 if {[info exists os.platform] && (${os.platform} == "darwin") && [file isdirectory /System/Library/Frameworks/Carbon.framework] && ![info exists variations(macosx)]} { variant_set macosx }
    122 if {[info exists variations(macosx)] && $variations(macosx) == "+"} {
     114# check if we're on Mac OS X and can therefore build universal
     115if {${os.platform} == "darwin" && [file isdirectory /System/Library/Frameworks/Carbon.framework]} {
    123116    # the universal variant itself is now created in
    124     # add_default_universal_variant, which is called from mportopen
     117    # universal_setup, which is called from mportopen
    125118    default os.universal_supported yes
    126119} else {
    127120    default os.universal_supported no
    128121}
     122
     123default compiler.cpath {${prefix}/include}
     124default compiler.library_path {${prefix}/lib}
    129125
    130126# start gsoc08-privileges
  • trunk/base/src/port1.0/portutil.tcl

    r65524 r66268  
    676676}
    677677
    678 # platform <os> [<release>] [<arch>]
     678# platform [<os> [<release>]] [<arch>]
    679679# Portfile level procedure to provide support for declaring platform-specifics
    680 # Basically, just wrap 'variant', so that Portfiles' platform declarations can
     680# Basically, just a fancy 'if', so that Portfiles' platform declarations can
    681681# be more readable, and support arch and version specifics
    682682proc platform {args} {
    683     global all_variants PortInfo os.platform os.arch os.version os.major
     683    global os.platform os.arch os.major
    684684
    685685    set len [llength $args]
    686686    if {$len < 2} {
    687         return -code error "Malformed platform variant specification"
     687        return -code error "Malformed platform specification"
    688688    }
    689689    set code [lindex $args end]
    690690    set os [lindex $args 0]
    691691    set args [lrange $args 1 [expr $len - 2]]
    692 
    693     set ditem [variant_new "temp-variant"]
    694692
    695693    foreach arg $args {
     
    701699    }
    702700
    703     # Add the variant for this platform
    704     set platform $os
    705     if {[info exists release]} { set platform ${platform}_${release} }
    706     if {[info exists arch]} { set platform ${platform}_${arch} }
    707 
    708     # Pick up a unique name.
    709     if {[variant_exists $platform]} {
    710         set suffix 1
    711         while {[variant_exists "${platform}_${suffix}"]} {
    712             incr suffix
    713         }
    714 
    715         set platform "${platform}_${suffix}"
    716     }
    717     variant $platform $code
    718 
    719     # Set the variant if this platform matches the platform we're on
    720     if {([info exists os.platform] && ${os.platform} == $os)
    721             && !([info exists os.major] && [info exists release] && ${os.major} != $release)
    722             && !([info exists arch] && [info exists os.arch] && ${os.arch} != $arch)} {
    723         variant_set $platform
     701    # sub-platforms of darwin
     702    if {${os.platform} == "darwin"} {
     703        if {[file isdirectory /System/Library/Frameworks/Carbon.framework]} {
     704            set subplatform macosx
     705        } else {
     706            set subplatform puredarwin
     707        }
     708    }
     709
     710    set match 0
     711    # 'os' could be a platform or an arch when it's alone
     712    if {$len == 2 && ($os == ${os.platform} || ([info exists subplatform] && $os == $subplatform) || $os == ${os.arch})} {
     713        set match 1
     714    } elseif {($os == ${os.platform} || ([info exists subplatform] && $os == $subplatform))
     715              && (![info exists release] || ${os.major} == $release)
     716              && (![info exists arch] || ${os.arch} == $arch)} {
     717        set match 1
     718    }
     719
     720    # Execute the code if this platform matches the platform we're on
     721    if {$match} {
     722        uplevel #0 $code
    724723    }
    725724}
Note: See TracChangeset for help on using the changeset viewer.