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

ijackson at macports.org ijackson at macports.org
Wed Jul 8 01:24:38 PDT 2015


Revision: 138434
          https://trac.macports.org/changeset/138434
Author:   ijackson at macports.org
Date:     2015-07-08 01:24:38 -0700 (Wed, 08 Jul 2015)
Log Message:
-----------
Create Transaction summary of the dependency calculated by libsolv.
Transaction summary gives us details about the packages going to be
installed.

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-08 06:31:25 UTC (rev 138433)
+++ branches/gsoc15-dependency/base/src/macports1.0/macports_libsolv.tcl	2015-07-08 08:24:38 UTC (rev 138434)
@@ -321,5 +321,45 @@
         }
 
         ## Transaction Part
+        set trans [$solver transaction]
+        if {[$trans isempty]} {
+            puts "Nothing to do"
+            return {}
+        }
+        ui_msg "Transaction summary:"
+        set clflag [expr $solv::Transaction_SOLVER_TRANSACTION_SHOW_OBSOLETES \
+            | $solv::Transaction_SOLVER_TRANSACTION_OBSOLETE_IS_UPGRADE] 
+        
+        foreach cl [$trans classify $clflag] {
+            if {[$cl cget -type] == $solv::Transaction_SOLVER_TRANSACTION_ERASE} {
+                puts "[$cl cget -count] Erased packages:"
+            } elseif {[$cl cget -type] == $solv::Transaction_SOLVER_TRANSACTION_INSTALL} {
+                puts "[$cl cget -count] Installed packages:"
+            } elseif {[$cl cget -type] == $solv::Transaction_SOLVER_TRANSACTION_REINSTALLED} {
+                puts "[$cl cget -count] Reinstalled packages:"
+            } elseif {[$cl cget -type] == $solv::Transaction_SOLVER_TRANSACTION_DOWNGRADED} {
+                puts "[$cl cget -count] Downgraded packages:"
+            } elseif {[$cl cget -type] == $solv::Transaction_SOLVER_TRANSACTION_CHANGED} {
+                puts "[$cl cget -count] Changed packages:"
+            } elseif {[$cl cget -type] == $solv::Transaction_SOLVER_TRANSACTION_UPGRADED} {
+                puts "[$cl cget -count] Upgraded packages:"
+            } elseif {[$cl cget -type] == $solv::Transaction_SOLVER_TRANSACTION_VENDORCHANGE} {
+                puts "[$cl cget -count] Vendor changes from [$cl cget -fromstr] to [$cl cget -tostr]" 
+            } elseif {[$cl cget -type] == $solv::Transaction_SOLVER_TRANSACTION_ARCHCHANGE} {
+                puts "[$cl cget -count] Arch changes from [$cl cget -fromstr] to [$cl cget -tostr]"
+            } else {
+                continue
+            }
+            foreach p [$cl solvables] {
+                set upflag $solv::Transaction_SOLVER_TRANSACTION_UPGRADED
+                set downflag $solv::Transaction_SOLVER_TRANSACTION_DOWNGRADED
+                if {[$cl cget -type] == $upflag || [$cl cget -type] == $downflag} { 
+                        set op [$trans othersolvable $p]
+                        puts "[$p __str__] -> [$op __str__]"
+                } else {
+                    puts [$p __str__]
+                }
+            }
+        }
     }
 }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20150708/a20e6ec1/attachment.html>


More information about the macports-changes mailing list