Skip to content
Permalink
Browse files

Move restore to migrate instead

  • Loading branch information
umeshksingla authored and neverpanic committed Jul 19, 2017
1 parent 2e116d7 commit 6d8da67583712afdab327fb17ba0afbc87117250
Showing with 31 additions and 27 deletions.
  1. +1 −1 src/macports1.0/Makefile.in
  2. +22 −16 src/macports1.0/{restore.tcl → migrate.tcl}
  3. +5 −6 src/macports1.0/snapshot.tcl
  4. +3 −4 src/port/port.tcl
@@ -4,7 +4,7 @@ VPATH = @srcdir@
include ../../Mk/macports.autoconf.mk

SRCS= macports.tcl macports_dlist.tcl macports_util.tcl \
macports_autoconf.tcl diagnose.tcl reclaim.tcl snapshot.tcl restore.tcl \
macports_autoconf.tcl diagnose.tcl reclaim.tcl snapshot.tcl migrate.tcl \
selfupdate.tcl
OBJS= macports.o get_systemconfiguration_proxies.o sysctl.o
SHLIB_NAME= MacPorts${SHLIB_SUFFIX}
@@ -5,14 +5,15 @@
#


package provide restore 1.0
package provide migrate 1.0

package require macports 1.0
package require registry 1.0
package require Pextlib 1.0
package require snapshot 1.0
package require registry_uninstall 2.0

namespace eval restore {
namespace eval migrate {

proc main {opts} {
# The main function. Calls each individual function that needs to be run.
@@ -27,22 +28,29 @@ namespace eval restore {

array set options $opts

if ([info exists options(ports_restore_snapshot-id)]) {
# use that snapshot
set snapshot [fetch_snapshot options(ports_restore_snapshot-id)]
} else {
# TODO: ask if the user is fine with the latest snapshot, if 'yes'
# use latest snapshot
set snapshot [fetch_latest_snapshot]
}
# TODO: move this to restore.tcl
# if ([info exists options(ports_restore_snapshot-id)]) {
# # use that snapshot
# set snapshot [fetch_snapshot options(ports_restore_snapshot-id)]
# } else {
# # TODO: ask if the user is fine with the latest snapshot, if 'yes'
# # use latest snapshot
# set snapshot [fetch_latest_snapshot]
# }


# fetch ports and variants now
# create a snapshot
set snapshot snapshot::main

# fetch ports and variants for this snapshot

# WILL WRITE FOR FETCHING AFTER DISCUSSING WITH BRAD

# ASSUMING I GET THE FINAL PORTLIST FOR NOW

# $portlist
uninstall_installed portlist
recover_ports_state portlist


# TODO: CLEAN PARTIAL BUILDS STEP HERE

@@ -104,8 +112,6 @@ namespace eval restore {

proc uninstall_installed { portlist } {

set formatted_portlist [list]

set portlist [sort_portlist_by_dependendents $portlist]

if {[info exists macports::ui_options(questions_yesno)]} {
@@ -133,7 +139,7 @@ namespace eval restore {
return 0
}

proc install_ports {portList} {
proc recover_ports_state {portList} {

foreach port $portList {

@@ -155,7 +161,7 @@ namespace eval restore {

set workername [mportopen $porturl [list subport $portinfo(name)] $variations]

# TODO: instead of mportexec, lookup for some API?
# TODO: instead of mportexec, look for some API?
if {[catch {set result [mportexec $workername $target]} result]} {
global errorInfo
mportclose $workername
@@ -18,7 +18,7 @@ namespace eval snapshot {
# Args:
# opts - The options passed in. Currently, there is no option available.
# Returns:
# None
# registry entry
#
# TODO:
# use registry::write wrapper here itself
@@ -42,19 +42,18 @@ namespace eval snapshot {
puts $port
}
puts
set a [registry::entry snapshot "test snapshot"]
puts $a
puts done
set snapshot [registry::entry snapshot "test snapshot"]

return snapshot
}

proc list {opts} {
proc all_snapshots {opts} {
# List the snapshots
puts "listing"

}

proc latest {opts} {
proc latest_snapshot {opts} {
# Get the latest snapshot
puts "latest"
}
@@ -2831,8 +2831,8 @@ proc action_snapshot { action portlist opts} {
return 0
}

proc action_reclaim { action portlist opts} {
macports::reclaim_main $opts
proc action_migrate { action portlist opts} {
macports::migrate_main $opts
return 0
}

@@ -4380,7 +4380,7 @@ array set action_array [list \
pkg [list action_target [ACTION_ARGS_PORTS]] \
\
snapshot [list action_snapshot [ACTION_ARGS_STRINGS]] \
restore [list action_restore [ACTION_ARGS_STRINGS]] \
migrate [list action_migrate [ACTION_ARGS_STRINGS]] \
\
quit [list action_exit [ACTION_ARGS_NONE]] \
exit [list action_exit [ACTION_ARGS_NONE]] \
@@ -4478,7 +4478,6 @@ array set cmd_opts_array {
diagnose {quiet}
reclaim {enable-reminders disable-reminders}
fetch {no-mirrors}
restore {snapshot-id}
}

##

0 comments on commit 6d8da67

Please sign in to comment.
You can’t perform that action at this time.