Skip to content
Permalink
Browse files

base: Print a message when rolling back on user request, prevent roll…

…back interruption

git-svn-id: https://svn.macports.org/repository/macports/trunk/base@118302 d073be05-634f-4543-b044-5fe20cf6d1d6
  • Loading branch information
neverpanic committed Mar 29, 2014
1 parent c05e530 commit e0c9c558ce4892a2f3f81b9df7e376040a077f88
Showing with 24 additions and 0 deletions.
  1. +24 −0 src/registry2.0/portimage.tcl
@@ -40,6 +40,8 @@ package require registry_util 2.0
package require macports 1.0
package require Pextlib 1.0

package require Tclx

set UI_PREFIX "--> "

# Port Images are installations of the destroot of a port into a compressed
@@ -539,6 +541,19 @@ proc _activate_contents {port {imagefiles {}} {location {}}} {
lappend rollback_filelist $file
}
}
} catch {{POSIX SIG SIGINT} eCode eMessage} {
# Pressing ^C will (often?) print "^C" to the terminal; send
# a linebreak so our message appears after that.
ui_msg ""
ui_msg "Control-C pressed, rolling back, please wait."
# can't do it here since we're already inside a transaction
set deactivate_this yes
throw
} catch {{POSIX SIG SIGTERM} eCode eMessage} {
ui_msg "SIGTERM received, rolling back, please wait."
# can't do it here since we're already inside a transaction
set deactivate_this yes
throw
} catch {*} {
ui_debug "Activation failed, rolling back."
# can't do it here since we're already inside a transaction
@@ -547,6 +562,10 @@ proc _activate_contents {port {imagefiles {}} {location {}}} {
}
}
} catch {*} {
# This code must run to completion, or the installation might be left
# in an inconsistent state
signal block {TERM INT}

# roll back activation of this port
if {[info exists deactivate_this]} {
_deactivate_contents $port $rollback_filelist yes yes
@@ -563,6 +582,11 @@ proc _activate_contents {port {imagefiles {}} {location {}}} {
activate [$entry name] [$entry version] [$entry revision] [$entry variants] [list ports_activate_no-exec $noexec]
}
}

# We've completed all critical operations, re-enable the TERM and INT
# signals.
signal unblock {TERM INT}

# remove temp image dir
::file delete -force $extracted_dir
throw

0 comments on commit e0c9c55

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