[140932] branches/gsoc15-dependency/base/src/macports1.0
ijackson at macports.org
ijackson at macports.org
Mon Oct 5 14:18:02 PDT 2015
Revision: 140932
https://trac.macports.org/changeset/140932
Author: ijackson at macports.org
Date: 2015-10-05 14:18:02 -0700 (Mon, 05 Oct 2015)
Log Message:
-----------
Use '$trans order' to topologically sort portlist.
Use '$trans order' to topologically sort the list of
ports to be installed in macports_libsolv.tcl. This will
save extra computation previously done as a workaround
in macports.tcl. Replace if-elseif-else block with switch
block. Set the $repo name correctly by checking the protocol
of the $source.
Modified Paths:
--------------
branches/gsoc15-dependency/base/src/macports1.0/macports.tcl
branches/gsoc15-dependency/base/src/macports1.0/macports_libsolv.tcl
Modified: branches/gsoc15-dependency/base/src/macports1.0/macports.tcl
===================================================================
--- branches/gsoc15-dependency/base/src/macports1.0/macports.tcl 2015-10-05 21:12:29 UTC (rev 140931)
+++ branches/gsoc15-dependency/base/src/macports1.0/macports.tcl 2015-10-05 21:18:02 UTC (rev 140932)
@@ -2002,27 +2002,12 @@
## Install each port. First use mportopen and then _mportexec.
if {[info exists dep_res]} {
set dlist [list]
- set portlist [list]
foreach port $dep_res {
set portsolv [lindex $port 0]
- lappend portlist [$portsolv cget -name]
- }
- ui_debug "Printing portlist"
- ui_debug $portlist
- foreach port $dep_res {
- set portsolv [lindex $port 0]
set portname [$portsolv cget -name]
set porturl [lindex $port 1]
set options(subport) $portname
-
set mport [mportopen $porturl [list subport $portname]]
- foreach dep [$portsolv lookup_deparray $solv::SOLVABLE_REQUIRES] {
- set depname [$dep __str__]
- if {$depname ni $portlist} {
- continue
- }
- ditem_append_unique $mport requires $depname
- }
lappend dlist $mport
}
set result [dlist_eval $dlist _mportactive [list _mportexec activate]]
Modified: branches/gsoc15-dependency/base/src/macports1.0/macports_libsolv.tcl
===================================================================
--- branches/gsoc15-dependency/base/src/macports1.0/macports_libsolv.tcl 2015-10-05 21:12:29 UTC (rev 140931)
+++ branches/gsoc15-dependency/base/src/macports1.0/macports_libsolv.tcl 2015-10-05 21:18:02 UTC (rev 140932)
@@ -114,9 +114,13 @@
foreach source $sources {
set source [lindex $source 0]
## Add a repo in the pool for each source as mentioned in sources.conf
- set repo [$pool add_repo [macports::getsourcepath $source]]
+ if {[macports::getprotocol $source] eq "file"} {
+ set repo [$pool add_repo [macports::getportdir $source]]
+ } else {
+ set repo [$pool add_repo [macports::getsourcepath $source]]
+ }
set repodata [$repo add_repodata]
-
+
if {[catch {set fd [open [macports::getindex $source] r]} result]} {
ui_warn "Can't open index file for source: $source"
} else {
@@ -419,38 +423,42 @@
set install_list [list]
set dep_list [list]
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
- }
+ switch -- [$cl cget -type] \
+ $solv::Transaction_SOLVER_TRANSACTION_ERASE {
+ puts "[$cl cget -count] Erased packages:"
+ } \
+ $solv::Transaction_SOLVER_TRANSACTION_INSTALL {
+ puts "[$cl cget -count] Installed packages:"
+ } \
+ $solv::Transaction_SOLVER_TRANSACTION_REINSTALLED {
+ puts "[$cl cget -count] Reinstalled packages:"
+ } \
+ $solv::Transaction_SOLVER_TRANSACTION_DOWNGRADED {
+ puts "[$cl cget -count] Downgraded packages:"
+ } \
+ $solv::Transaction_SOLVER_TRANSACTION_CHANGED {
+ puts "[$cl cget -count] Changed packages:"
+ } \
+ $solv::Transaction_SOLVER_TRANSACTION_UPGRADED {
+ puts "[$cl cget -count] Upgraded packages:"
+ } \
+ $solv::Transaction_SOLVER_TRANSACTION_VENDORCHANGE {
+ puts "[$cl cget -count] Vendor changes from [$cl cget -fromstr] to [$cl cget -tostr]"
+ } \
+ $solv::Transaction_SOLVER_TRANSACTION_ARCHCHANGE {
+ puts "[$cl cget -count] Arch changes from [$cl cget -fromstr] to [$cl cget -tostr]"
+ } \
+ default continue
+
foreach p [$cl solvables] {
+ set cltype [$cl cget -type]
set upflag $solv::Transaction_SOLVER_TRANSACTION_UPGRADED
set downflag $solv::Transaction_SOLVER_TRANSACTION_DOWNGRADED
- if {[$cl cget -type] == $upflag || [$cl cget -type] == $downflag} {
+ if {$cltype == $upflag || $cltype == $downflag} {
set op [$trans othersolvable $p]
puts "[$p __str__] -> [$op __str__]"
} else {
- puts [$p __str__]
lappend dep_list [$p __str__]
- array set portinfo $portindexinfo([$p cget -id])
- set porturl "file://[[$p cget -repo] cget -name]/${portinfo(portdir)}"
- lappend install_list [list $p $porturl]
- array unset -nocomplain portinfo
}
}
}
@@ -462,6 +470,16 @@
} else {
set depstring "$macports::ui_prefix Dependencies to be installed by libsolv:"
}
+
+ # Commiting Transaction.
+ $trans order
+ ui_msg "Comitting Transaction:"
+ foreach p [$trans steps] {
+ array set portinfo $portindexinfo([$p cget -id])
+ set porturl "file://[[$p cget -repo] cget -name]/${portinfo(portdir)}"
+ lappend install_list [list $p $porturl]
+ array unset -nocomplain portinfo
+ }
return $install_list
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20151005/adba7e72/attachment.html>
More information about the macports-changes
mailing list