[104547] trunk/dports/_resources/port1.0/group/muniversal-1.0.tcl

michaelld at macports.org michaelld at macports.org
Wed Mar 27 08:47:49 PDT 2013


Revision: 104547
          https://trac.macports.org/changeset/104547
Author:   michaelld at macports.org
Date:     2013-03-27 08:47:49 -0700 (Wed, 27 Mar 2013)
Log Message:
-----------
muniversal PortGroup: add merger-post-destroot hook to allow tweaking of destroot before merger

Modified Paths:
--------------
    trunk/dports/_resources/port1.0/group/muniversal-1.0.tcl

Modified: trunk/dports/_resources/port1.0/group/muniversal-1.0.tcl
===================================================================
--- trunk/dports/_resources/port1.0/group/muniversal-1.0.tcl	2013-03-27 15:32:27 UTC (rev 104546)
+++ trunk/dports/_resources/port1.0/group/muniversal-1.0.tcl	2013-03-27 15:47:49 UTC (rev 104547)
@@ -86,6 +86,34 @@
     return ${archf}
 }
 
+# set up the merger-post-destroot hook
+
+proc merger_target_provides {ditem args} {
+    global targets
+    # register just the procedure, no pre-/post-
+    # User-code exceptions are caught and returned as a result of the target.
+    # Thus if the user code breaks, dependent targets will not execute.
+    foreach target $args {
+        set origproc [ditem_key $ditem procedure]
+        set ident [ditem_key $ditem name]
+        proc merger-post-$target {args} "
+            variable proc_index
+            set proc_index \[llength \[ditem_key $ditem post\]\]
+            ditem_append $ditem merger-post proc-merger-post-${ident}-${target}-\${proc_index}
+            proc proc-merger-post-${ident}-${target}-\${proc_index} {name} \"
+                if {\\\[catch userproc-merger-post-${ident}-${target}-\${proc_index} result\\\]} {
+                    return -code error \\\$result
+                } else {
+                    return 0
+                }
+            \"
+            makeuserproc userproc-merger-post-${ident}-${target}-\${proc_index} \$args
+        "
+    }
+}
+
+merger_target_provides ${org.macports.destroot} destroot
+
 variant universal {
     global universal_archs_to_use
 
@@ -398,6 +426,26 @@
         }
         delete ${destroot}
 
+        # execute merger-post-destroot, if it exists
+
+        set ditem ${org.macports.destroot}
+        set procedure [ditem_key $ditem merger-post]
+        if {$procedure != ""} {
+            set targetname [ditem_key $ditem name]
+            ui_debug "Executing org.macports.merger-post-destroot"
+            set result [catch { $procedure $targetname } errstr]
+            # Save variables in order to re-throw the same error code.
+            set errcode $::errorCode
+            set errinfo $::errorInfo
+            if {$result != 0} {
+                set portname $subport
+                ui_error "$targetname for port $portname returned: $errstr"
+                ui_debug "Error code: $errcode"
+                ui_debug "Backtrace: $errinfo"
+                return $result
+            }
+        }
+
         # Merge ${base1}/${prefixDir} and ${base2}/${prefixDir} into dir ${base}/${prefixDir}
         #        arch1, arch2: names to prepend to files if a diff merge of two files is forbidden by merger_dont_diff
         #    merger_dont_diff: list of files for which /usr/bin/diff ${diffFormat} will not merge correctly
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20130327/fc62e089/attachment.html>


More information about the macports-changes mailing list