Ignore:
Timestamp:
Mar 27, 2013, 3:47:49 PM (6 years ago)
Author:
michaelld@…
Message:

muniversal PortGroup: add merger-post-destroot hook to allow tweaking of destroot before merger

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dports/_resources/port1.0/group/muniversal-1.0.tcl

    r103450 r104547  
    8787}
    8888
     89# set up the merger-post-destroot hook
     90
     91proc merger_target_provides {ditem args} {
     92    global targets
     93    # register just the procedure, no pre-/post-
     94    # User-code exceptions are caught and returned as a result of the target.
     95    # Thus if the user code breaks, dependent targets will not execute.
     96    foreach target $args {
     97        set origproc [ditem_key $ditem procedure]
     98        set ident [ditem_key $ditem name]
     99        proc merger-post-$target {args} "
     100            variable proc_index
     101            set proc_index \[llength \[ditem_key $ditem post\]\]
     102            ditem_append $ditem merger-post proc-merger-post-${ident}-${target}-\${proc_index}
     103            proc proc-merger-post-${ident}-${target}-\${proc_index} {name} \"
     104                if {\\\[catch userproc-merger-post-${ident}-${target}-\${proc_index} result\\\]} {
     105                    return -code error \\\$result
     106                } else {
     107                    return 0
     108                }
     109            \"
     110            makeuserproc userproc-merger-post-${ident}-${target}-\${proc_index} \$args
     111        "
     112    }
     113}
     114
     115merger_target_provides ${org.macports.destroot} destroot
     116
    89117variant universal {
    90118    global universal_archs_to_use
     
    398426        }
    399427        delete ${destroot}
     428
     429        # execute merger-post-destroot, if it exists
     430
     431        set ditem ${org.macports.destroot}
     432        set procedure [ditem_key $ditem merger-post]
     433        if {$procedure != ""} {
     434            set targetname [ditem_key $ditem name]
     435            ui_debug "Executing org.macports.merger-post-destroot"
     436            set result [catch { $procedure $targetname } errstr]
     437            # Save variables in order to re-throw the same error code.
     438            set errcode $::errorCode
     439            set errinfo $::errorInfo
     440            if {$result != 0} {
     441                set portname $subport
     442                ui_error "$targetname for port $portname returned: $errstr"
     443                ui_debug "Error code: $errcode"
     444                ui_debug "Backtrace: $errinfo"
     445                return $result
     446            }
     447        }
    400448
    401449        # Merge ${base1}/${prefixDir} and ${base2}/${prefixDir} into dir ${base}/${prefixDir}
Note: See TracChangeset for help on using the changeset viewer.