<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[138637] branches/gsoc15-dependency/base/src</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="https://trac.macports.org/changeset/138637">138637</a></dd>
<dt>Author</dt> <dd>ijackson@macports.org</dd>
<dt>Date</dt> <dd>2015-07-14 04:05:47 -0700 (Tue, 14 Jul 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Create mportinstall proc in macports.tcl for using libsolv dep_calc.
Instead of keeping a check for libsolv in mportexec,
which is called once for each port passed to 'port install'.
Call mportinstall from action_target {} in port.tcl for
$portlist as libsolv requires the whole list of ports to be
installed to check for the conflicts and dependencies of 
all the ports and return optimized solution. Conflicts will
be taken care by libsolv after asking for user confirmation.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchesgsoc15dependencybasesrcmacports10macportstcl">branches/gsoc15-dependency/base/src/macports1.0/macports.tcl</a></li>
<li><a href="#branchesgsoc15dependencybasesrcportporttcl">branches/gsoc15-dependency/base/src/port/port.tcl</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchesgsoc15dependencybasesrcmacports10macportstcl"></a>
<div class="modfile"><h4>Modified: branches/gsoc15-dependency/base/src/macports1.0/macports.tcl (138636 => 138637)</h4>
<pre class="diff"><span>
<span class="info">--- branches/gsoc15-dependency/base/src/macports1.0/macports.tcl        2015-07-14 10:59:31 UTC (rev 138636)
+++ branches/gsoc15-dependency/base/src/macports1.0/macports.tcl        2015-07-14 11:05:47 UTC (rev 138637)
</span><span class="lines">@@ -2017,6 +2017,19 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+# mportinstall
+# Execute when libsolv is used for installing packages.
+proc mportinstall {portlist target} {
+    ## Use libsolv Dependency Calculation if -l is passed
+    if {[info exists macports::global_options(ports_depengine)]} {
+        if {$macports::global_options(ports_depengine) eq &quot;libsolv&quot;} {
+            if {[macports::_target_needs_deps $target]} {
+                set dep_res [macports::libsolv::dep_calc $portlist]
+            }
+        }
+    }
+}
+
</ins><span class="cx"> # mportexec
</span><span class="cx"> # Execute the specified target of the given mport.
</span><span class="cx"> proc mportexec {mport target} {
</span><span class="lines">@@ -2047,15 +2060,6 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    ## Use libsolv Dependency Calculation if -l is passed
-    if {[info exists macports::global_options(ports_depengine)]} {
-        if {$macports::global_options(ports_depengine) eq &quot;libsolv&quot;} {
-            if {[macports::_target_needs_deps $target]} {
-                set dep_res [macports::libsolv::dep_calc $portname]
-            }
-        }
-    }
-
</del><span class="cx">     # Before we build the port, we must build its dependencies.
</span><span class="cx">     set dlist {}
</span><span class="cx">     if {[macports::_target_needs_deps $target] &amp;&amp; [macports::_mport_has_deptypes $mport [macports::_deptypes_for_target $target $workername]]} {
</span></span></pre></div>
<a id="branchesgsoc15dependencybasesrcportporttcl"></a>
<div class="modfile"><h4>Modified: branches/gsoc15-dependency/base/src/port/port.tcl (138636 => 138637)</h4>
<pre class="diff"><span>
<span class="info">--- branches/gsoc15-dependency/base/src/port/port.tcl        2015-07-14 10:59:31 UTC (rev 138636)
+++ branches/gsoc15-dependency/base/src/port/port.tcl        2015-07-14 11:05:47 UTC (rev 138637)
</span><span class="lines">@@ -4064,89 +4064,103 @@
</span><span class="cx">     if {($action eq &quot;install&quot; || $action eq &quot;archive&quot;) &amp;&amp; [prefix_unwritable] &amp;&amp; ![macports::global_option_isset ports_dryrun]} {
</span><span class="cx">         return 1
</span><span class="cx">     }
</span><del>-    foreachport $portlist {
-        array unset portinfo
-        # If we have a url, use that, since it's most specific
-        # otherwise try to map the portname to a url
-        if {$porturl eq &quot;&quot;} {
-            # Verify the portname, getting portinfo to map to a porturl
-            if {[catch {set res [mportlookup $portname]} result]} {
-                global errorInfo
-                ui_debug &quot;$errorInfo&quot;
-                break_softcontinue &quot;lookup of portname $portname failed: $result&quot; 1 status
</del><ins>+    
+    ## Use libsolv Dependency Calculation if -l is passed
+    if {[info exists macports::global_options(ports_depengine)]} {
+        if {$macports::global_options(ports_depengine) eq &quot;libsolv&quot;} {
+            if {$action eq &quot;install&quot;} {
+                if {![info exists options(ports_install_unrequested)]} {
+                    set options(ports_requested) 1
+                }
+                # we actually activate as well
+                set target activate
+                set dep_res [mportinstall $portlist $target]
</ins><span class="cx">             }
</span><del>-            if {[llength $res] &lt; 2} {
-                # don't error for ports that are installed but not in the tree
-                if {[registry::entry_exists_for_name $portname]} {
-                    ui_warn &quot;Skipping $portname (not in the ports tree)&quot;
-                    continue
-                } else {
-                    break_softcontinue &quot;Port $portname not found&quot; 1 status
</del><ins>+        }
+    } else {
+        foreachport $portlist {
+            array unset portinfo
+            # If we have a url, use that, since it's most specific
+            # otherwise try to map the portname to a url
+            if {$porturl eq &quot;&quot;} {
+                # Verify the portname, getting portinfo to map to a porturl
+                if {[catch {set res [mportlookup $portname]} result]} {
+                    global errorInfo
+                    ui_debug &quot;$errorInfo&quot;
+                    break_softcontinue &quot;lookup of portname $portname failed: $result&quot; 1 status
</ins><span class="cx">                 }
</span><ins>+                if {[llength $res] &lt; 2} {
+                    # don't error for ports that are installed but not in the tree
+                    if {[registry::entry_exists_for_name $portname]} {
+                        ui_warn &quot;Skipping $portname (not in the ports tree)&quot;
+                        continue
+                    } else {
+                        break_softcontinue &quot;Port $portname not found&quot; 1 status
+                    }
+                }
+                array set portinfo [lindex $res 1]
+                set porturl $portinfo(porturl)
</ins><span class="cx">             }
</span><del>-            array set portinfo [lindex $res 1]
-            set porturl $portinfo(porturl)
-        }
</del><span class="cx"> 
</span><del>-        # use existing variants iff none were explicitly requested
-        if {[array get requested_variations] eq &quot;&quot; &amp;&amp; [array get variations] ne &quot;&quot;} {
-            array unset requested_variations
-            array set requested_variations [array get variations]
-        }
</del><ins>+            # use existing variants iff none were explicitly requested
+            if {[array get requested_variations] eq &quot;&quot; &amp;&amp; [array get variations] ne &quot;&quot;} {
+                array unset requested_variations
+                array set requested_variations [array get variations]
+            }
</ins><span class="cx"> 
</span><del>-        # Add any global_variations to the variations
-        # specified for the port
-        foreach { variation value } [array get global_variations] {
-            if { ![info exists requested_variations($variation)] } {
-                set requested_variations($variation) $value
</del><ins>+            # Add any global_variations to the variations
+            # specified for the port
+            foreach { variation value } [array get global_variations] {
+                if { ![info exists requested_variations($variation)] } {
+                    set requested_variations($variation) $value
+                }
</ins><span class="cx">             }
</span><del>-        }
</del><span class="cx"> 
</span><del>-        # If version was specified, save it as a version glob for use
-        # in port actions (e.g. clean).
-        if {[string length $portversion]} {
-            set options(ports_version_glob) $portversion
-        }
-        # if installing, mark the port as explicitly requested
-        if {$action eq &quot;install&quot;} {
-            if {![info exists options(ports_install_unrequested)]} {
-                set options(ports_requested) 1
</del><ins>+            # If version was specified, save it as a version glob for use
+            # in port actions (e.g. clean).
+            if {[string length $portversion]} {
+                set options(ports_version_glob) $portversion
</ins><span class="cx">             }
</span><del>-            # we actually activate as well
-            set target activate
-        } elseif {$action eq &quot;archive&quot;} {
-            set target install
-        } else {
-            set target $action
-        }
-        if {![info exists options(subport)]} {
-            if {[info exists portinfo(name)]} {
-                set options(subport) $portinfo(name)
</del><ins>+            # if installing, mark the port as explicitly requested
+            if {$action eq &quot;install&quot;} {
+                if {![info exists options(ports_install_unrequested)]} {
+                    set options(ports_requested) 1
+                }
+                # we actually activate as well
+                set target activate
+            } elseif {$action eq &quot;archive&quot;} {
+                set target install
</ins><span class="cx">             } else {
</span><del>-                set options(subport) $portname
</del><ins>+                set target $action
</ins><span class="cx">             }
</span><del>-        }
-        if {[catch {set workername [mportopen $porturl [array get options] [array get requested_variations]]} result]} {
-            global errorInfo
-            ui_debug &quot;$errorInfo&quot;
-            break_softcontinue &quot;Unable to open port: $result&quot; 1 status
-        }
-        if {[catch {set result [mportexec $workername $target]} result]} {
-            global errorInfo
</del><ins>+            if {![info exists options(subport)]} {
+                if {[info exists portinfo(name)]} {
+                    set options(subport) $portinfo(name)
+                } else {
+                    set options(subport) $portname
+                }
+            }
+            if {[catch {set workername [mportopen $porturl [array get options] [array get requested_variations]]} result]} {
+                global errorInfo
+                ui_debug &quot;$errorInfo&quot;
+                break_softcontinue &quot;Unable to open port: $result&quot; 1 status
+            }
+            if {[catch {set result [mportexec $workername $target]} result]} {
+                global errorInfo
+                mportclose $workername
+                ui_debug &quot;$errorInfo&quot;
+                break_softcontinue &quot;Unable to execute port: $result&quot; 1 status
+            }
+
</ins><span class="cx">             mportclose $workername
</span><del>-            ui_debug &quot;$errorInfo&quot;
-            break_softcontinue &quot;Unable to execute port: $result&quot; 1 status
</del><ins>+            
+            # Process any error that wasn't thrown and handled already
+            if {$result} {
+                print_tickets_url
+                break_softcontinue &quot;Processing of port $portname failed&quot; 1 status
+            }
</ins><span class="cx">         }
</span><del>-
-        mportclose $workername
-        
-        # Process any error that wasn't thrown and handled already
-        if {$result} {
-            print_tickets_url
-            break_softcontinue &quot;Processing of port $portname failed&quot; 1 status
-        }
-    }
-    
</del><ins>+    } 
</ins><span class="cx">     if {$status == 0 &amp;&amp; $action eq &quot;install&quot; &amp;&amp; ![macports::global_option_isset ports_dryrun]} {
</span><span class="cx">         array set options $opts
</span><span class="cx">         if {![info exists options(ports_nodeps)] &amp;&amp; ![info exists options(ports_install_no-rev-upgrade)] &amp;&amp; ${macports::revupgrade_autorun}} {
</span></span></pre>
</div>
</div>

</body>
</html>