Ticket #11920: variant_registry.patch

File variant_registry.patch, 4.7 KB (added by gwhitneycom1@…, 17 years ago)

proposed bugfix

  • src/port1.0/portactivate.tcl

     
    4545} else {
    4646        target_requires ${com.apple.activate} main fetch extract checksum patch configure build destroot install
    4747}
    48 target_prerun ${com.apple.activate} activate_start
    4948
    5049set_ui_prefix
    5150
    52 proc activate_start {args} {
    53         global UI_PREFIX portname portversion portrevision variations portvariants
    54    
    55         if { ![info exists portvariants] } {
    56                 set portvariants ""
    57 
    58                 set vlist [lsort -ascii [array names variations]]
    59 
    60                 # Put together variants in the form +foo+bar for the registry
    61                 foreach v $vlist {
    62                         if { ![string equal $v [option os.platform]] && ![string equal $v [option os.arch]] } {
    63                                 set portvariants "${portvariants}+${v}"
    64                         }
    65                 }
    66         }
    67 }
    68 
    6951proc activate_main {args} {
    7052        global portname portversion portrevision portvariants user_options
    7153        registry_activate $portname ${portversion}_${portrevision}${portvariants} [array get user_options]
  • src/port1.0/portinstall.tcl

     
    4848
    4949proc install_start {args} {
    5050        global UI_PREFIX portname portversion portrevision variations portvariants
    51    
    52         if { ![info exists portvariants] } {
    53                 set portvariants ""
    54 
    55                 set vlist [lsort -ascii [array names variations]]
    56 
    57                 # Put together variants in the form +foo+bar for the registry
    58                 foreach v $vlist {
    59                         if { ![string equal $v [option os.platform]] && ![string equal $v [option os.arch]] } {
    60                                 set portvariants "${portvariants}+${v}"
    61                         }
    62                 }
    63         }
    64 
    6551        ui_msg "$UI_PREFIX [format [msgcat::mc "Installing %s %s_%s%s"] $portname $portversion $portrevision $portvariants]"
    6652}
    6753
  • src/port1.0/portutil.tcl

     
    990990            set result [catch {[ditem_key $ditem init] $name} errstr]
    991991        }
    992992       
    993         if { ![info exists portvariants] } {
    994                 set portvariants ""
    995                 set vlist [lsort -ascii [array names variations]]
    996 
    997                 # Put together variants in the form +foo+bar for the registry
    998                 foreach v $vlist {
    999                         if { ![string equal $v [option os.platform]] && ![string equal $v [option os.arch]] } {
    1000                                 set portvariants "${portvariants}+${v}"
    1001                         }
    1002                 }
    1003         }
    1004 
    1005993        if {$result == 0} {
    1006994                # Skip the step if required and explain why through ui_debug.
    1007995                # 1st case: the step was already done (as mentioned in the state file)
     
    10441032                                # Say we're skipping.
    10451033                                set skipped 1
    10461034                               
    1047                                 ui_debug "Skipping $name ($portname) since this port is already active"
     1035                                ui_msg "Skipping $name ($portname $portvariants) since this port is already active"
    10481036                        }
    10491037                       
    10501038                }
     
    13671355    return 0
    13681356}
    13691357
     1358# Given a list of variant specifications, return a canonical string form
     1359# for the registry.
     1360    # The strategy is as follows: regardless of how some collection of variants
     1361    # was turned on or off, a particular instance of the port is uniquely
     1362    # characterized by the set of variants that are *on*. Thus, record those
     1363    # variants in a string in a standard order as +var1+var2 etc.
     1364    # We can skip the platform and architecture since those are always
     1365    # requested.  XXX: Is that really true? What if the user explicitly
     1366    # overrides the platform and architecture variants? Will the registry get
     1367    # bollixed? It would seem safer to me to just leave in all the variants that
     1368    # are on, but for now I'm just leaving the skipping code as it was in the
     1369    # previous version.
     1370proc canonicalize_variants {variants} {
     1371    array set vara $variants
     1372    set result ""
     1373    set vlist [lsort -ascii [array names vara]]
     1374    foreach v $vlist {
     1375            if { $vara($v) == "+"
     1376                 && ![string equal $v [option os.platform]]
     1377                 && ![string equal $v [option os.arch]]} {
     1378                    set result "${result}+${v}"
     1379            }
     1380    }
     1381    return $result
     1382}
     1383
    13701384proc eval_variants {variations target} {
    1371     global all_variants ports_force PortInfo
     1385    global all_variants ports_force PortInfo portvariants
    13721386    set dlist $all_variants
    13731387    set result 0
    13741388    upvar $variations upvariations
     
    14011415    if {[llength $dlist] > 0} {
    14021416                return 1
    14031417    }
    1404    
     1418
     1419    # Record a canonical variant string, used e.g. in accessing the registry
     1420    set portvariants [canonicalize_variants [array get upvariations]]
     1421
    14051422    # Make sure the variations match those stored in the statefile.
    14061423    # If they don't match, print an error indicating a 'port clean'
    14071424    # should be performed.