diff --git a/src/darwinports1.0/darwinports.tcl b/src/darwinports1.0/darwinports.tcl index fd2c319946..872dcd05ed 100644 --- a/src/darwinports1.0/darwinports.tcl +++ b/src/darwinports1.0/darwinports.tcl @@ -712,12 +712,24 @@ proc dportregistry::close {rhandle} { } } -proc dportregistry::delete {portname {portversion 1.0}} { +proc dportregistry::delete {portname {portversion 0}} { global darwinports::registry.path - # Try both versions, just to be sure. - exec rm -f [file join ${darwinports::registry.path} ${portname}-${portversion}] - exec rm -f [file join ${darwinports::registry.path} ${portname}-${portversion}].bz2 + # regex match case, as in exists + if {$portversion == 0} { + set x [glob -nocomplain [file join ${darwinports::registry.path} ${portname}-*]] + if {[string length $x]} { + exec rm -f [lindex $x 0] + } + } else { + # Remove the file (with or without .bz2 suffix) + set filename [file join ${darwinports::registry.path} ${portname}-${portversion}] + if { [file exists $filename] } { + exec rm -rf $filename + } elseif { [file exists ${filename}.bz2] } { + exec rm -rf ${filename}.bz2 + } + } } proc dportregistry::fileinfo_for_file {fname} { diff --git a/src/port1.0/portuninstall.tcl b/src/port1.0/portuninstall.tcl index 2bc5a1186a..ced2530e9e 100755 --- a/src/port1.0/portuninstall.tcl +++ b/src/port1.0/portuninstall.tcl @@ -126,14 +126,8 @@ proc uninstall_main {args} { } } if {!$uninst_err || [tbool uninstall.force]} { - 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 + registry_delete $portname + return 0 } } else { return -code error [msgcat::mc "Uninstall failed: Port has no contents entry"]