<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/064c11e70fb9266fec1e5666eb108b918288c1d9">https://github.com/macports/macports-base/commit/064c11e70fb9266fec1e5666eb108b918288c1d9</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit 064c11e70fb9266fec1e5666eb108b918288c1d9
</span>Author: Umesh Singla <umeshksingla@gmail.com>
AuthorDate: Fri Jun 9 05:08:15 2017 +0530
<span style='display:block; white-space:pre;color:#404040;'> Add snapshot action to action_array
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Initialize the snapshot module to be developed, with zero args
</span><span style='display:block; white-space:pre;color:#404040;'> currently.
</span>---
src/macports1.0/macports.tcl | 17 +++++++++++++++++
src/macports1.0/snapshot.tcl | 23 +++++++++++++++++++++++
src/port/port.tcl | 6 ++++++
3 files changed, 46 insertions(+)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/macports1.0/macports.tcl b/src/macports1.0/macports.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index 71245bd..e5c4766 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/macports1.0/macports.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/macports1.0/macports.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -38,6 +38,7 @@ package require macports_util 1.0
</span> package require diagnose 1.0
package require reclaim 1.0
package require selfupdate 1.0
<span style='display:block; white-space:pre;background:#e0ffe0;'>+package require snapshot 1.0
</span> package require Tclx
# catch wrapper shared with port1.0
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -4403,6 +4404,22 @@ proc macports::reclaim_main {opts} {
</span> return 0
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+# create a snapshot. A snapshot is basically an inventory of what is installed
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# along with meta data like requested and variants, and stored in the sqlite
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# database.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+proc macports::snapshot_main {opts} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Calls the main function for the 'port snapshot' command.
</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;'>+ # None
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Returns:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # 0 on successful execution.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ snapshot::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> ##
# Execute the rev-upgrade scan and attempt to rebuild all ports found to be
# broken. Depends on the revupgrade_mode setting from macports.conf.
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/macports1.0/snapshot.tcl b/src/macports1.0/snapshot.tcl
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 0000000..c8e178e
</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/snapshot.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,23 @@
</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;'>+# snapshot.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 snapshot 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;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+namespace eval snapshot {
</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. Handles all the calls to the correct functions.
</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 - The options passed in. Currently, there is no option available.
</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;'>+ puts "Still being developed"
</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/port/port.tcl b/src/port/port.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index 68572aa..710ed8f 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;'>@@ -2802,6 +2802,10 @@ proc action_reclaim { action portlist opts } {
</span>
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+proc action_snapshot { action portlist opts} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ macports::snapshot_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>
proc action_upgrade { action portlist opts } {
if {[require_portlist portlist "yes"] || (![macports::global_option_isset ports_dryrun] && [prefix_unwritable])} {
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -4346,6 +4350,8 @@ array set action_array [list \
</span> mpkg [list action_target [ACTION_ARGS_PORTS]] \
pkg [list action_target [ACTION_ARGS_PORTS]] \
\
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ snapshot [list action_snapshot [ACTION_ARGS_STRINGS]] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ \
</span> quit [list action_exit [ACTION_ARGS_NONE]] \
exit [list action_exit [ACTION_ARGS_NONE]] \
]
</pre><pre style='margin:0'>
</pre>