<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/f98e7218869d4b44775631c672398386d6de3bba">https://github.com/macports/macports-base/commit/f98e7218869d4b44775631c672398386d6de3bba</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit f98e7218869d4b44775631c672398386d6de3bba
</span>Author: Umesh Singla <umeshksingla@macports.org>
AuthorDate: Thu Jul 13 00:13:56 2017 +0530
<span style='display:block; white-space:pre;color:#404040;'> Add restore action to action array
</span>---
src/macports1.0/Makefile.in | 3 ++-
src/macports1.0/restore.tcl | 36 ++++++++++++++++++++++++++++++++++++
src/macports1.0/snapshot.tcl | 5 +++--
src/port/port.tcl | 7 +++++++
4 files changed, 48 insertions(+), 3 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 bee4eb9..26697d9 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,8 @@ 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 selfupdate.tcl
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ macports_autoconf.tcl diagnose.tcl reclaim.tcl snapshot.tcl restore.tcl \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ selfupdate.tcl
</span> 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/restore.tcl
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 0000000..d93e81c
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/macports1.0/restore.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,36 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# restore.tcl
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# TODO: include MacPorts copyright
</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:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+package provide restore 1.0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+package require macports 1.0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+package require registry 1.0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+namespace eval restore {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ proc main {opts} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # The main function. Calls each individual function that needs to be run.
</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;'>+ # opts - options array.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Returns:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # None
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # TODO:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # make it return some value
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ array set options $opts
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</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;'>+ } 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;'>+ }
</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:#e0ffe0;'>+}
</span>\ No newline at end of file
<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 1a52eca..8e101c5 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;'>@@ -20,8 +20,9 @@ namespace eval snapshot {
</span> # Returns:
# None
#
<span style='display:block; white-space:pre;background:#ffe0e0;'>- # TODO: use registry::write wrapper here itself
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- #
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # TODO:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # use registry::write wrapper here itself
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # make it return some value
</span>
puts "Still being developed"
#registry::entry addsnapshot
<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 e39273f..cb9b075 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;'>@@ -2831,6 +2831,11 @@ proc action_snapshot { action portlist opts} {
</span> return 0
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+proc action_reclaim { action portlist opts} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ macports::reclaim_main $opts
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return 0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> proc action_upgrade { action portlist opts } {
if {[require_portlist portlist "yes"] || (![macports::global_option_isset ports_dryrun] && [prefix_unwritable])} {
return 1
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -4375,6 +4380,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:#e0ffe0;'>+ restore [list action_restore [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;'>@@ -4472,6 +4478,7 @@ array set cmd_opts_array {
</span> diagnose {quiet}
reclaim {enable-reminders disable-reminders}
fetch {no-mirrors}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ restore {snapshot-id}
</span> }
##
</pre><pre style='margin:0'>
</pre>