<pre style='margin:0'>
Umesh Singla (umeshksingla) pushed a commit to branch gsoc17-migrate
in repository macports-base.
</pre>
<p><a href="https://github.com/macports/macports-base/commit/3034fc30f51e755ed9117687e13ecbcaccb42612">https://github.com/macports/macports-base/commit/3034fc30f51e755ed9117687e13ecbcaccb42612</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit 3034fc30f51e755ed9117687e13ecbcaccb42612
</span>Author: Umesh Singla <umeshksingla@macports.org>
AuthorDate: Sat Aug 26 05:30:46 2017 +0530
<span style='display:block; white-space:pre;color:#404040;'> Install only the originally requested ports
</span>---
src/macports1.0/migrate.tcl | 43 +++++++++++++++++++++++++++----------------
src/macports1.0/snapshot.tcl | 22 ++++++++++------------
2 files changed, 37 insertions(+), 28 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/macports1.0/migrate.tcl b/src/macports1.0/migrate.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index e820f21..f2589eb 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/macports1.0/migrate.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/macports1.0/migrate.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -61,23 +61,21 @@ namespace eval migrate {
</span> # set snapshot [fetch_latest_snapshot]
# }
<span style='display:block; white-space:pre;background:#ffe0e0;'>- puts "here 1"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span> # create a snapshot
<span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_msg "Taking a snapshot of the current state.."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_msg "$macports::ui_prefix Taking a snapshot of the current state.."
</span> set snapshot [snapshot::main $opts]
set note [$snapshot note]
set datetime [$snapshot created_at]
<span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_msg "Done: snapshot '$note' created at $datetime"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_msg "$macports::ui_prefix Done: snapshot '$note' created at $datetime"
</span>
<span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_msg "Fetching ports.."
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set portlist1 [$snapshot ports]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_msg "$macports::ui_prefix Fetching ports.."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set portlist [$snapshot ports]
</span>
<span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_msg "Uninstalling all ports.."
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- uninstall_installed $portlist1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_msg "$macports::ui_prefix Uninstalling all ports.."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ uninstall_installed [registry::entry imaged]
</span>
<span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_msg "Restoring the original state.."
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- recover_ports_state $portlist1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_msg "$macports::ui_prefix Restoring the original state.."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ recover_ports_state $portlist
</span>
# TODO: CLEAN PARTIAL BUILDS STEP HERE
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -93,6 +91,15 @@ namespace eval migrate {
</span>
proc portlist_sort_dependencies_first {portlist} {
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Sorts a list of port references such that ports appear after
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # their dependencies. Ideal for installing a port.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Args:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # portlist - the list of port references
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Returns:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # the list in dependency-sorted order
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> array set port_installed {}
array set port_deps {}
array set port_in_list {}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -103,6 +110,9 @@ namespace eval migrate {
</span>
set name [lindex $port 0]
set requested [lindex $port 1]
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {$requested eq 0} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ continue
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span> set active 0
if {[lindex $port 2] eq "installed"} {
set active 1
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -205,7 +215,7 @@ namespace eval migrate {
</span> proc portlist_sort_dependencies_later {portlist} {
# Sorts a list of port references such that ports come before
<span style='display:block; white-space:pre;background:#ffe0e0;'>- # their dependencies.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # their dependencies. Ideal for uninstalling a port.
</span> #
# Args:
# portlist - the list of port references
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -214,9 +224,8 @@ namespace eval migrate {
</span> # the list in dependency-sorted order
foreach port $portlist {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set portname [lindex $port 0]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set portname [$port name]
</span> lappend entries($portname) $port
<span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span> # Avoid adding ports in loop
if {![info exists dependents($portname)]} {
set dependents($portname) {}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -255,7 +264,7 @@ namespace eval migrate {
</span>
if {[info exists macports::ui_options(questions_yesno)]} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set msg "Migration will first uninstall all the installed ports first."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set msg "Migration will first uninstall all the installed ports."
</span> set retvalue [$macports::ui_options(questions_yesno) $msg "MigrationPrompt" "" {y} 0 "Would you like to continue?"]
if {$retvalue == 0} {
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -281,7 +290,6 @@ namespace eval migrate {
</span> proc recover_ports_state {portlist} {
set sorted_portlist [portlist_sort_dependencies_first $portlist]
<span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span> foreach port $sorted_portlist {
puts "$port"
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -314,8 +322,11 @@ namespace eval migrate {
</span> array unset portinfo
array set portinfo [lindex $res 1]
set porturl $portinfo(porturl)
<span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set options(ports_requested) 1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set options(subport) $portinfo(name)
</span>
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[catch {set workername [mportopen $porturl [list subport $portinfo(name)] $variations]} result]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[catch {set workername [mportopen $porturl [array get options] $variations]} result]} {
</span> global errorInfo
puts stderr "$errorInfo"
return -code error "Unable to open port '$name': $result"
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/macports1.0/snapshot.tcl b/src/macports1.0/snapshot.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index b3077ea..1b5f082 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/macports1.0/snapshot.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/macports1.0/snapshot.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -23,23 +23,21 @@ namespace eval snapshot {
</span> # TODO:
# 1. use registry::write wrapper here itself
<span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- puts "here 1-1"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- puts "Still being developed"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ puts "WIP."
</span>
array set options $opts
<span style='display:block; white-space:pre;background:#ffe0e0;'>- # An option used by user while creating snapshot manually
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # to identify a snapshot, usually followed by `port restore`
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[info exists options(ports_snapshot_note)]} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set note ports_snapshot_note
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- } else {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set note "snapshot created for migration"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ registry::write {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # An option used by user while creating snapshot manually
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # to identify a snapshot, usually followed by `port restore`
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[info exists options(ports_snapshot_note)]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set note ports_snapshot_note
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set note "snapshot created for migration"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set snapshot [registry::snapshot create $note]
</span> }
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set snapshot [registry::snapshot create $note]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span> return $snapshot
}
</pre><pre style='margin:0'>
</pre>