Ticket #19176: patch-unsintall-new.diff
File patch-unsintall-new.diff, 3.0 KB (added by david.osguthorpe@…, 15 years ago) |
---|
-
src/registry1.0/portuninstall.tcl
140 140 # Look to see if the port has registered an uninstall procedure 141 141 set uninstall [registry::property_retrieve $ref pkg_uninstall] 142 142 if { $uninstall != 0 } { 143 if {![catch {eval $uninstall} err]} { 144 pkg_uninstall $portname ${version}_${revision}${variants} 143 if {![catch {eval [string map { \\n \n } $uninstall]} err]} { 144 ui_info "Executing pkg_uninstall procedure" 145 if {[catch {pkg_uninstall $portname ${version}_${revision}${variants} } err]} { 146 ui_error [format [msgcat::mc "Error executing pkg_uninstall procedure: %s"] $err] 147 } 145 148 } else { 146 149 global errorInfo 147 150 ui_debug "$errorInfo" -
src/port1.0/portinstall.tcl
128 128 } 129 129 130 130 proc install_main {args} { 131 global portname portversion portpath categories description long_description homepage depends_run installPlist package-install uninstallworkdir worksrcdir pregrefix UI_PREFIX destroot portrevision maintainers ports_force portvariants targets depends_lib PortInfo epoch131 global portname portversion portpath categories description long_description homepage depends_run installPlist package-install workdir worksrcdir pregrefix UI_PREFIX destroot portrevision maintainers ports_force portvariants targets depends_lib PortInfo epoch 132 132 133 133 # Begin the registry entry 134 134 set regref [registry_new $portname $portversion $portrevision $portvariants $epoch] … … 168 168 registry_prop_store $regref package-install ${package-install} 169 169 } 170 170 if {[info proc pkg_uninstall] == "pkg_uninstall"} { 171 registry_prop_store $regref uninstall [proc_disasm pkg_uninstall]171 registry_prop_store $regref pkg_uninstall [proc_disasm pkg_uninstall] 172 172 } 173 173 174 174 registry_write $regref … … 176 176 return 0 177 177 } 178 178 179 # 180 # apparent usage of pkg_uninstall variable in the registry 181 # the Portfile needs to define a procedure 182 # proc pkg_uninstall {portname portver} { 183 # body of proc 184 # } 185 # which gets stored above into the registry pkg_uninstall variable 186 # this is then called by the portuninstall procedure 187 # note that in general the portuninstall procedure is not called within 188 # the context of its port so many usual port variables do not exist 189 # e.g. destroot/workpath/filespath 190 191 # this procedure encodes the pkg_uninstall body so that it can be stored in the 192 # the receipt file 179 193 proc proc_disasm {pname} { 180 194 set p "proc " 181 append p $pname " \{"195 append p $pname " {" 182 196 set space "" 183 197 foreach arg [info args $pname] { 184 198 if {[info default $pname $arg value]} { … … 188 202 } 189 203 set space " " 190 204 } 191 append p " \} \{" [info body $pname] "\}"205 append p "} {" [string map { \n \\n } [info body $pname] ] " }" 192 206 return $p 193 207 }