<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/d5b92685894f29f743ab35e5fc0e46fb11c7dd62">https://github.com/macports/macports-base/commit/d5b92685894f29f743ab35e5fc0e46fb11c7dd62</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit d5b92685894f29f743ab35e5fc0e46fb11c7dd62
</span>Author: Umesh Singla <umeshksingla@macports.org>
AuthorDate: Wed Jul 19 18:05:59 2017 +0530
<span style='display:block; white-space:pre;color:#404040;'> Move restore to migrate instead
</span>---
src/macports1.0/Makefile.in | 2 +-
src/macports1.0/{restore.tcl => migrate.tcl} | 38 ++++++++++++++++------------
src/macports1.0/snapshot.tcl | 11 ++++----
src/port/port.tcl | 7 +++--
4 files changed, 31 insertions(+), 27 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/macports1.0/Makefile.in b/src/macports1.0/Makefile.in
</span><span style='display:block; white-space:pre;color:#808080;'>index 4a0145c..82dcc11 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/macports1.0/Makefile.in
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/macports1.0/Makefile.in
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -4,7 +4,7 @@ VPATH = @srcdir@
</span> include ../../Mk/macports.autoconf.mk
SRCS= macports.tcl macports_dlist.tcl macports_util.tcl \
<span style='display:block; white-space:pre;background:#ffe0e0;'>- macports_autoconf.tcl diagnose.tcl reclaim.tcl snapshot.tcl restore.tcl \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ macports_autoconf.tcl diagnose.tcl reclaim.tcl snapshot.tcl migrate.tcl \
</span> selfupdate.tcl
OBJS= macports.o get_systemconfiguration_proxies.o sysctl.o
SHLIB_NAME= MacPorts${SHLIB_SUFFIX}
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/macports1.0/restore.tcl b/src/macports1.0/migrate.tcl
</span>similarity index 85%
rename from src/macports1.0/restore.tcl
rename to src/macports1.0/migrate.tcl
<span style='display:block; white-space:pre;color:#808080;'>index 49628b9..28ca528 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/macports1.0/restore.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;'>@@ -5,14 +5,15 @@
</span> #
<span style='display:block; white-space:pre;background:#ffe0e0;'>-package provide restore 1.0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+package provide migrate 1.0
</span>
package require macports 1.0
package require registry 1.0
package require Pextlib 1.0
<span style='display:block; white-space:pre;background:#e0ffe0;'>+package require snapshot 1.0
</span> package require registry_uninstall 2.0
<span style='display:block; white-space:pre;background:#ffe0e0;'>-namespace eval restore {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+namespace eval migrate {
</span>
proc main {opts} {
# The main function. Calls each individual function that needs to be run.
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -27,22 +28,29 @@ namespace eval restore {
</span>
array set options $opts
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if ([info exists options(ports_restore_snapshot-id)]) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # use that snapshot
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set snapshot [fetch_snapshot options(ports_restore_snapshot-id)]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- } else {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # TODO: ask if the user is fine with the latest snapshot, if 'yes'
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # use latest snapshot
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set snapshot [fetch_latest_snapshot]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # TODO: move this to restore.tcl
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # if ([info exists options(ports_restore_snapshot-id)]) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # # use that snapshot
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # set snapshot [fetch_snapshot options(ports_restore_snapshot-id)]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # # TODO: ask if the user is fine with the latest snapshot, if 'yes'
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # # use latest snapshot
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # set snapshot [fetch_latest_snapshot]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span>
<span style='display:block; white-space:pre;background:#ffe0e0;'>- # fetch ports and variants now
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # create a snapshot
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set snapshot snapshot::main
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # fetch ports and variants for this snapshot
</span>
# WILL WRITE FOR FETCHING AFTER DISCUSSING WITH BRAD
<span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> # ASSUMING I GET THE FINAL PORTLIST FOR NOW
<span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span> # $portlist
uninstall_installed portlist
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ recover_ports_state portlist
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span>
# TODO: CLEAN PARTIAL BUILDS STEP HERE
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -104,8 +112,6 @@ namespace eval restore {
</span>
proc uninstall_installed { portlist } {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set formatted_portlist [list]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span> set portlist [sort_portlist_by_dependendents $portlist]
if {[info exists macports::ui_options(questions_yesno)]} {
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -133,7 +139,7 @@ namespace eval restore {
</span> return 0
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- proc install_ports {portList} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ proc recover_ports_state {portList} {
</span>
foreach port $portList {
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -155,7 +161,7 @@ namespace eval restore {
</span>
set workername [mportopen $porturl [list subport $portinfo(name)] $variations]
<span style='display:block; white-space:pre;background:#ffe0e0;'>- # TODO: instead of mportexec, lookup for some API?
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # TODO: instead of mportexec, look for some API?
</span> if {[catch {set result [mportexec $workername $target]} result]} {
global errorInfo
mportclose $workername
<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 8e101c5..581bbce 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;'>@@ -18,7 +18,7 @@ namespace eval snapshot {
</span> # Args:
# opts - The options passed in. Currently, there is no option available.
# Returns:
<span style='display:block; white-space:pre;background:#ffe0e0;'>- # None
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # registry entry
</span> #
# TODO:
# use registry::write wrapper here itself
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -42,19 +42,18 @@ namespace eval snapshot {
</span> puts $port
}
puts
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set a [registry::entry snapshot "test snapshot"]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- puts $a
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- puts done
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set snapshot [registry::entry snapshot "test snapshot"]
</span>
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ return snapshot
</span> }
<span style='display:block; white-space:pre;background:#ffe0e0;'>- proc list {opts} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ proc all_snapshots {opts} {
</span> # List the snapshots
puts "listing"
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- proc latest {opts} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ proc latest_snapshot {opts} {
</span> # Get the latest snapshot
puts "latest"
}
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/port/port.tcl b/src/port/port.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index 216018c..d7ea4cd 100755
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/port/port.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/port/port.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -2807,8 +2807,8 @@ proc action_snapshot { action portlist opts} {
</span> return 0
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>-proc action_reclaim { action portlist opts} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- macports::reclaim_main $opts
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+proc action_migrate { action portlist opts} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ macports::migrate_main $opts
</span> return 0
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -4356,7 +4356,7 @@ array set action_array [list \
</span> pkg [list action_target [ACTION_ARGS_PORTS]] \
\
snapshot [list action_snapshot [ACTION_ARGS_STRINGS]] \
<span style='display:block; white-space:pre;background:#ffe0e0;'>- restore [list action_restore [ACTION_ARGS_STRINGS]] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ migrate [list action_migrate [ACTION_ARGS_STRINGS]] \
</span> \
quit [list action_exit [ACTION_ARGS_NONE]] \
exit [list action_exit [ACTION_ARGS_NONE]] \
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -4462,7 +4462,6 @@ array set cmd_opts_array {
</span> rev-upgrade {id-loadcmd-check}
diagnose {quiet}
reclaim {enable-reminders disable-reminders}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- restore {snapshot-id}
</span> }
##
</pre><pre style='margin:0'>
</pre>