<pre style='margin:0'>
Clemens Lang (neverpanic) pushed a commit to branch gsoc17-migrate
in repository macports-base.
</pre>
<p><a href="https://github.com/macports/macports-base/commit/352c555cc4b14d665b8e780dcac55ead59f5b032">https://github.com/macports/macports-base/commit/352c555cc4b14d665b8e780dcac55ead59f5b032</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit 352c555cc4b14d665b8e780dcac55ead59f5b032
</span>Author: Umesh Singla <umeshksingla@macports.org>
AuthorDate: Mon Aug 28 04:08:26 2017 +0530
<span style='display:block; white-space:pre;color:#404040;'> Call deactivate only if active
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Also, add copyright to snapshot.tcl and change ui_prefix to
</span><span style='display:block; white-space:pre;color:#404040;'> differentiate it from macports::ui_prefix
</span>---
src/macports1.0/migrate.tcl | 15 ++++++---------
src/macports1.0/restore.tcl | 15 ++++++++-------
src/macports1.0/snapshot.tcl | 36 ++++++++++++++++++++++++++----------
3 files changed, 40 insertions(+), 26 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 409897b..198593b 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;'>@@ -1,5 +1,5 @@
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-#!@TCLSH@
</span> # -*- 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 style='display:block; white-space:pre;background:#e0ffe0;'>+# migrate.tcl
</span> #
# Copyright (c) 2017 The MacPorts Project
# All rights reserved.
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -32,13 +32,10 @@ package provide migrate 1.0
</span>
package require macports 1.0
package require registry 1.0
<span style='display:block; white-space:pre;background:#ffe0e0;'>-package require Pextlib 1.0
</span> package require snapshot 1.0
package require restore 1.0
<span style='display:block; white-space:pre;background:#ffe0e0;'>-package require registry_uninstall 2.0
</span>
namespace eval migrate {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-
</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;'>@@ -50,18 +47,18 @@ namespace eval migrate {
</span> array set options $opts
# create a snapshot
<span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_msg "$macports::ui_prefix Taking a snapshot of the current state.."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_msg ":: Taking a snapshot of the current state.."
</span> set snapshot [snapshot::main $opts]
set id [$snapshot id]
set note [$snapshot note]
set datetime [$snapshot created_at]
<span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_msg "$macports::ui_prefix Done: snapshot '$id':'$note' created at $datetime"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_msg ":: Done: snapshot '$id':'$note' created at $datetime"
</span>
if {[info exists macports::ui_options(questions_yesno)]} {
set msg "Migration will first uninstall all the installed ports and then reinstall."
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:#ffe0e0;'>- ui_msg "$macports::ui_prefix Uninstalling all ports.."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_msg ":: Uninstalling all ports.."
</span> uninstall_installed [registry::entry imaged]
} else {
ui_msg "Not uninstalling ports."
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -69,10 +66,10 @@ namespace eval migrate {
</span> }
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_msg "$macports::ui_prefix Fetching ports to install.."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_msg ":: Fetching ports to install.."
</span> set snapshot_portlist [$snapshot ports]
<span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_msg "$macports::ui_prefix Restoring the original state.."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_msg ":: Restoring the original state.."
</span> restore::restore_state $snapshot_portlist
# TODO: CLEAN PARTIAL BUILDS STEP HERE
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/macports1.0/restore.tcl b/src/macports1.0/restore.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index 0d34b8a..fd58c1e 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/restore.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -1,5 +1,5 @@
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-#!@TCLSH@
</span> # -*- 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 style='display:block; white-space:pre;background:#e0ffe0;'>+# restore.tcl
</span> #
# Copyright (c) 2017 The MacPorts Project
# All rights reserved.
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -54,10 +54,10 @@ namespace eval restore {
</span> }
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_msg "$macports::ui_prefix Deactivating all ports installed.."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_msg ":: Deactivating all ports installed.."
</span> deactivate_all
<span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_msg "$macports::ui_prefix Restoring the selected snapshot.."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_msg ":: Restoring the selected snapshot.."
</span> restore_state [$snapshot ports]
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -119,8 +119,10 @@ namespace eval restore {
</span> set portlist [portlist_sort_dependencies_later [registry::entry imaged]]
foreach port $portlist {
ui_msg "Deactivating: [$port name]"
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[registry::run_target $port deactivate]} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- continue
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[$port state] eq "installed"} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[registry::run_target $port deactivate {}]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ continue
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span> }
}
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -301,5 +303,4 @@ namespace eval restore {
</span> # TODO: some ports may get re-activated to fulfil dependencies - recheck?
}
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-}
</span>\ No newline at end of file
<span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><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 db1f1a7..704d82c 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;'>@@ -1,9 +1,32 @@
</span> # -*- 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
# snapshot.tcl
#
<span style='display:block; white-space:pre;background:#ffe0e0;'>-# TODO: include MacPorts copyright
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# Copyright (c) 2017 The MacPorts Project
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# All rights reserved.
</span> #
<span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# Redistribution and use in source and binary forms, with or without
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# modification, are permitted provided that the following conditions
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# are met:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# 1. Redistributions of source code must retain the above copyright
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# notice, this list of conditions and the following disclaimer.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# 2. Redistributions in binary form must reproduce the above copyright
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# notice, this list of conditions and the following disclaimer in the
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# documentation and/or other materials provided with the distribution.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# 3. Neither the name of Apple Inc. nor the names of its contributors
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# may be used to endorse or promote products derived from this software
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# without specific prior written permission.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# POSSIBILITY OF SUCH DAMAGE.
</span>
package provide snapshot 1.0
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -11,7 +34,6 @@ package require macports 1.0
</span> package require registry 1.0
namespace eval snapshot {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span> proc main {opts} {
# The main function. Handles all the calls to the correct functions.
#
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -19,11 +41,6 @@ namespace eval snapshot {
</span> # opts - The options passed in.
# Returns:
# registry::snapshot
<span style='display:block; white-space:pre;background:#ffe0e0;'>- #
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # TODO:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # 1. 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:#ffe0e0;'>- puts "WIP."
</span>
array set options $opts
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -37,7 +54,6 @@ namespace eval snapshot {
</span> }
set snapshot [registry::snapshot create $note]
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span> return $snapshot
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>-}
</span>\ No newline at end of file
<span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span></pre><pre style='margin:0'>
</pre>