Changeset 3954


Ignore:
Timestamp:
Nov 15, 2003, 9:46:50 PM (17 years ago)
Author:
fkr
Message:

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.

Location:
trunk/base/src/port1.0
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/port1.0/portinstall.tcl

    r3220 r3954  
    4242
    4343proc install_start {args} {
    44     global UI_PREFIX portname
     44    global UI_PREFIX portname portversion
    4545
    46     ui_msg "$UI_PREFIX [format [msgcat::mc "Installing %s"] ${portname}]"
     46        # Check to make sure this port is not already installed.  This is a
     47        # general check of the portname only, so previous versions will fail
     48        # as well.
     49        if {[string length [registry_exists $portname]]} {
     50                # Also check to see if it's this version or another
     51                if {[string length [registry_exists $portname $portversion]]} {
     52                        return -code error [format [msgcat::mc "Port %s already registered as installed."] $portname]
     53                } else {
     54                        return -code error [format [msgcat::mc "Another version of Port %s is already registered as installed.  Please uninstall the port first."] $portname]
     55                }
     56        } else {
     57        ui_msg "$UI_PREFIX [format [msgcat::mc "Installing %s"] ${portname}]"
     58        }
    4759}
    4860
  • trunk/base/src/port1.0/portmain.tcl

    r2947 r3954  
    8686default os.endian {[string range $tcl_platform(byteOrder) 0 [expr [string length $tcl_platform(byteOrder)] - 7]]}
    8787
    88 
    8988# Select implicit variants
    9089if {[info exists os.platform] && ![info exists variations(${os.platform})]} { variant_set ${os.platform}}
  • trunk/base/src/port1.0/portuninstall.tcl

    r3220 r3954  
    4747    global portname portversion UI_PREFIX
    4848
    49     if {[string length [registry_exists $portname $portversion]]} {
    50         ui_msg "$UI_PREFIX [format [msgcat::mc "Uninstalling %s-%s"] $portname $portversion]"
     49    if {[string length [registry_exists $portname]]} {
     50        ui_msg "$UI_PREFIX [format [msgcat::mc "Uninstalling %s"] $portname]"
    5151    }
    5252}
     
    6060    }
    6161
    62     set rfile [registry_exists $portname $portversion]
     62    set rfile [registry_exists $portname]
    6363    if {[string length $rfile]} {
    6464        if {[regexp .bz2$ $rfile]} {
     
    127127            }
    128128            if {!$uninst_err || [tbool uninstall.force]} {
    129                 registry_delete $portname $portversion
     129                if {[regexp .bz2$ $rfile]} {
     130                        regsub {.bz2$} $rfile {} r_file
     131                        set r_version [lindex [split $r_file -] 1]
     132                } else {
     133                        set r_version [lindex [split $rfile -] 1]
     134                }
     135                registry_delete $portname $r_version
    130136                return 0
    131137            }
     
    134140        }
    135141    }
    136     return -code error [msgcat::mc "Uninstall failed: Port not registered as installed"]
     142    return -code error [format [msgcat::mc "Uninstall failed: Port %s not registered as installed"] $portname]
    137143}
Note: See TracChangeset for help on using the changeset viewer.