[138666] branches/gsoc15-dependency/base/src/macports1.0/macports_libsolv. tcl

ijackson at macports.org ijackson at macports.org
Wed Jul 15 07:17:30 PDT 2015


Revision: 138666
          https://trac.macports.org/changeset/138666
Author:   ijackson at macports.org
Date:     2015-07-15 07:17:30 -0700 (Wed, 15 Jul 2015)
Log Message:
-----------
Fix configuring dependency and conflict info of solv.
Extract name field from $portspec and append to $portname list.
Use (name) instead of (fullname) as fullname returns a '/' at the
end of portname. Remove $marker values from lappend $fields as
we are not sure about how they actually work.
There can be a list of portnames in $portinfo(field), hence
treat it as a list and run a loop on it to extract the dependency
portnames.

Modified Paths:
--------------
    branches/gsoc15-dependency/base/src/macports1.0/macports_libsolv.tcl

Modified: branches/gsoc15-dependency/base/src/macports1.0/macports_libsolv.tcl
===================================================================
--- branches/gsoc15-dependency/base/src/macports1.0/macports_libsolv.tcl	2015-07-15 13:51:43 UTC (rev 138665)
+++ branches/gsoc15-dependency/base/src/macports1.0/macports_libsolv.tcl	2015-07-15 14:17:30 UTC (rev 138666)
@@ -45,7 +45,7 @@
 
     ## Some debugging related printing of variable contents
     proc print {} {
-        variable pool
+        set pool [create_pool]
         puts $solv::Job_SOLVER_SOLVABLE
         puts $pool
         
@@ -69,11 +69,11 @@
         
         ## set fields for adding dependency information to the solv's by looping over $fields.
         set fields [list]
-        lappend fields "depends_fetch" $solv::SOLVABLE_REQUIRES [list 1]
-        lappend fields "depends_extract" $solv::SOLVABLE_REQUIRES [list 1]
-        lappend fields "depends_build" $solv::SOLVABLE_REQUIRES [list 1]
-        lappend fields "depends_lib" $solv::SOLVABLE_REQUIRES [list -1]
-        lappend fields "depends_run" $solv::SOLVABLE_REQUIRES [list -1]
+        lappend fields "depends_fetch" $solv::SOLVABLE_REQUIRES [list]
+        lappend fields "depends_extract" $solv::SOLVABLE_REQUIRES [list]
+        lappend fields "depends_build" $solv::SOLVABLE_REQUIRES [list]
+        lappend fields "depends_lib" $solv::SOLVABLE_REQUIRES [list]
+        lappend fields "depends_run" $solv::SOLVABLE_REQUIRES [list]
         lappend fields "conflicts" $solv::SOLVABLE_CONFLICTS [list]
         lappend fields "replaced_by" $solv::SOLVABLE_OBSOLETES [list]
 
@@ -136,8 +136,10 @@
                             #  and -1 for runtime dependencies
                             foreach {fieldname deptype marker} $fields {
                                 if {[info exists portinfo($fieldname)]} {
-                                    set dep_name [lindex [split $portinfo($fieldname) :] end]
-                                    $solvable add_deparray $deptype [$pool str2id $dep_name 1] {*}$marker
+                                    foreach dep $portinfo($fieldname) {
+                                        set dep_name [lindex [split $dep :] end]
+                                        $solvable add_deparray $deptype [$pool str2id $dep_name 1] {*}$marker
+                                    }
                                 }
                             }
 
@@ -251,8 +253,20 @@
     }
 
     ## Dependency calculation using libsolv
-    proc dep_calc {portname} {
+    proc dep_calc {portlist} {
         set pool [create_pool]
+        # $pool set_debuglevel 3
+        
+        ## List of ports to be installed
+        set portname [list]
+        ## Append portname to $portname after extracting them from $portlist
+        foreach portspec $portlist {
+            array set portinfo $portspec
+            set pname $portinfo(name)
+            lappend portname $pname
+            array unset -nocomplain portinfo
+        }
+
         ui_msg "$macports::ui_prefix Computing dependencies for $portname using libsolv"
         set jobs [list]
         foreach arg $portname {
@@ -330,6 +344,8 @@
         set clflag [expr $solv::Transaction_SOLVER_TRANSACTION_SHOW_OBSOLETES \
             | $solv::Transaction_SOLVER_TRANSACTION_OBSOLETE_IS_UPGRADE] 
         
+        set install_list [list]
+
         foreach cl [$trans classify $clflag] {
             if {[$cl cget -type] == $solv::Transaction_SOLVER_TRANSACTION_ERASE} {
                 puts "[$cl cget -count] Erased packages:"
@@ -358,8 +374,10 @@
                         puts "[$p __str__] -> [$op __str__]"
                 } else {
                     puts [$p __str__]
+                    lappend install_list [$p cget -name]
                 }
             }
         }
+        return $install_list
     }
 }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20150715/b6ab95cd/attachment.html>


More information about the macports-changes mailing list