Skip to content
Permalink
Browse files

Bug:

Submitted by:   wbb4@
Reviewed by:
Approved by:
Obtained from:

enabled uninstall to work properly when version in dports-tree is not equal
installed version.
also add's installed check, so a port is not accidently installed over an existing
version.

git-svn-id: https://svn.macports.org/repository/macports/trunk/base@3954 d073be05-634f-4543-b044-5fe20cf6d1d6
  • Loading branch information
Felix Kronlage
Felix Kronlage committed Nov 15, 2003
1 parent 4f5750f commit 562fa66aab2f198d85d89d19390c356581914ee9
Showing with 26 additions and 9 deletions.
  1. +15 −3 src/port1.0/portinstall.tcl
  2. +0 −1 src/port1.0/portmain.tcl
  3. +11 −5 src/port1.0/portuninstall.tcl
@@ -41,9 +41,21 @@ target_prerun ${com.apple.install} install_start
set UI_PREFIX "---> "

proc install_start {args} {
global UI_PREFIX portname

ui_msg "$UI_PREFIX [format [msgcat::mc "Installing %s"] ${portname}]"
global UI_PREFIX portname portversion

# Check to make sure this port is not already installed. This is a
# general check of the portname only, so previous versions will fail
# as well.
if {[string length [registry_exists $portname]]} {
# Also check to see if it's this version or another
if {[string length [registry_exists $portname $portversion]]} {
return -code error [format [msgcat::mc "Port %s already registered as installed."] $portname]
} else {
return -code error [format [msgcat::mc "Another version of Port %s is already registered as installed. Please uninstall the port first."] $portname]
}
} else {
ui_msg "$UI_PREFIX [format [msgcat::mc "Installing %s"] ${portname}]"
}
}

proc install_element {src_element dst_element} {
@@ -85,7 +85,6 @@ default os.arch {$os_arch}
# Remove trailing "Endian"
default os.endian {[string range $tcl_platform(byteOrder) 0 [expr [string length $tcl_platform(byteOrder)] - 7]]}


# Select implicit variants
if {[info exists os.platform] && ![info exists variations(${os.platform})]} { variant_set ${os.platform}}
if {[info exists os.arch] && ![info exists variations(${os.arch})]} { variant_set ${os.arch} }
@@ -46,8 +46,8 @@ set UI_PREFIX "---> "
proc uninstall_start {args} {
global portname portversion UI_PREFIX

if {[string length [registry_exists $portname $portversion]]} {
ui_msg "$UI_PREFIX [format [msgcat::mc "Uninstalling %s-%s"] $portname $portversion]"
if {[string length [registry_exists $portname]]} {
ui_msg "$UI_PREFIX [format [msgcat::mc "Uninstalling %s"] $portname]"
}
}

@@ -59,7 +59,7 @@ proc uninstall_main {args} {
set uninstall.force "yes"
}

set rfile [registry_exists $portname $portversion]
set rfile [registry_exists $portname]
if {[string length $rfile]} {
if {[regexp .bz2$ $rfile]} {
set fd [open "|bunzip2 -c $rfile" r]
@@ -126,12 +126,18 @@ proc uninstall_main {args} {
}
}
if {!$uninst_err || [tbool uninstall.force]} {
registry_delete $portname $portversion
if {[regexp .bz2$ $rfile]} {
regsub {.bz2$} $rfile {} r_file
set r_version [lindex [split $r_file -] 1]
} else {
set r_version [lindex [split $rfile -] 1]
}
registry_delete $portname $r_version
return 0
}
} else {
return -code error [msgcat::mc "Uninstall failed: Port has no contents entry"]
}
}
return -code error [msgcat::mc "Uninstall failed: Port not registered as installed"]
return -code error [format [msgcat::mc "Uninstall failed: Port %s not registered as installed"] $portname]
}

0 comments on commit 562fa66

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