Skip to content

Commit

Permalink
Fix for wbb4's receipt uninstall code.
Browse files Browse the repository at this point in the history
Bug:            https://trac.macports.org/ticket/1324
Submitted by:   pguyot@kallisys.net and wbb4@opendarwin.org

git-svn-id: https://svn.macports.org/repository/macports/trunk/base@4300 d073be05-634f-4543-b044-5fe20cf6d1d6
  • Loading branch information
Jordan K. Hubbard committed Dec 25, 2003
1 parent c6bcaeb commit 2a07b0a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
20 changes: 16 additions & 4 deletions src/darwinports1.0/darwinports.tcl
Expand Up @@ -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} {
Expand Down
10 changes: 2 additions & 8 deletions src/port1.0/portuninstall.tcl
Expand Up @@ -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"]
Expand Down

0 comments on commit 2a07b0a

Please sign in to comment.