Skip to content
Permalink
Browse files

Add restore action to action array

  • Loading branch information
umeshksingla authored and neverpanic committed Jul 12, 2017
1 parent 8169bb2 commit f98e7218869d4b44775631c672398386d6de3bba
Showing with 48 additions and 3 deletions.
  1. +2 −1 src/macports1.0/Makefile.in
  2. +36 −0 src/macports1.0/restore.tcl
  3. +3 −2 src/macports1.0/snapshot.tcl
  4. +7 −0 src/port/port.tcl
@@ -4,7 +4,8 @@ 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 selfupdate.tcl
macports_autoconf.tcl diagnose.tcl reclaim.tcl snapshot.tcl restore.tcl \
selfupdate.tcl
OBJS= macports.o get_systemconfiguration_proxies.o sysctl.o
SHLIB_NAME= MacPorts${SHLIB_SUFFIX}

@@ -0,0 +1,36 @@
# -*- 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
# restore.tcl
#
# TODO: include MacPorts copyright
#


package provide restore 1.0

package require macports 1.0
package require registry 1.0

namespace eval restore {

proc main {opts} {
# The main function. Calls each individual function that needs to be run.
#
# Args:
# opts - options array.
# Returns:
# None
#
# TODO:
# make it return some value

array set options $opts

if ([info exists options(ports_restore_snapshot-id)]) {
# use that snapshot
} else {
# TODO: ask if the user is fine with the latest snapshot, if 'yes'
# use latest snapshot
}

}
}
@@ -20,8 +20,9 @@ namespace eval snapshot {
# Returns:
# None
#
# TODO: use registry::write wrapper here itself
#
# TODO:
# use registry::write wrapper here itself
# make it return some value

puts "Still being developed"
#registry::entry addsnapshot
@@ -2831,6 +2831,11 @@ proc action_snapshot { action portlist opts} {
return 0
}

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

proc action_upgrade { action portlist opts } {
if {[require_portlist portlist "yes"] || (![macports::global_option_isset ports_dryrun] && [prefix_unwritable])} {
return 1
@@ -4375,6 +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]] \
\
quit [list action_exit [ACTION_ARGS_NONE]] \
exit [list action_exit [ACTION_ARGS_NONE]] \
@@ -4472,6 +4478,7 @@ array set cmd_opts_array {
diagnose {quiet}
reclaim {enable-reminders disable-reminders}
fetch {no-mirrors}
restore {snapshot-id}
}

##

0 comments on commit f98e721

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