Changeset 64640


Ignore:
Timestamp:
Mar 12, 2010, 4:47:29 PM (11 years ago)
Author:
jmr@…
Message:

fix flat registry's pkg_uninstall functionality (#19176)

Location:
trunk/base/src
Files:
2 edited

Legend:

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

    r64533 r64640  
    141141proc portinstall::install_main {args} {
    142142    global name version portpath categories description long_description \
    143     homepage depends_run installPlist package-install uninstall workdir \
     143    homepage depends_run installPlist package-install workdir \
    144144    worksrcdir UI_PREFIX destroot revision maintainers user_options \
    145145    portvariants negated_variants targets depends_lib PortInfo epoch license \
     
    276276        }
    277277        if {[info proc pkg_uninstall] == "pkg_uninstall"} {
    278             registry_prop_store $regref uninstall [proc_disasm pkg_uninstall]
     278            registry_prop_store $regref pkg_uninstall [proc_disasm pkg_uninstall]
    279279        }
    280280
     
    285285}
    286286
     287# apparent usage of pkg_uninstall variable in the (flat) registry
     288# the Portfile needs to define a procedure
     289# proc pkg_uninstall {portname portver} {
     290#     body of proc
     291# }
     292# which gets stored above in the receipt's pkg_uninstall property
     293# this is then called by the portuninstall procedure
     294# note that the portuninstall procedure is not called within
     295# the context of the portfile so many usual port variables do not exist
     296# e.g. destroot/workpath/filespath
     297 
     298# this procedure encodes the pkg_uninstall body so that it can be stored in the
     299# the receipt file
    287300proc portinstall::proc_disasm {pname} {
    288301    set p "proc "
    289     append p $pname " \{"
     302    append p $pname " {"
    290303    set space ""
    291304    foreach arg [info args $pname] {
     
    297310        set space " "
    298311    }
    299     append p "\} \{" [info body $pname] "\}"
     312    append p "} {" [string map { \n \\n } [info body $pname] ] " }"
    300313    return $p
    301314}
  • trunk/base/src/registry2.0/portuninstall.tcl

    r64625 r64640  
    213213    ui_msg "$UI_PREFIX [format [msgcat::mc "Uninstalling %s @%s"] $portname $v]"
    214214
    215     if {$use_reg2} {
    216         # pkg_uninstall isn't used anywhere as far as I can tell and I intend to add
    217         # some proper pre-/post- hooks to uninstall/deactivate.
    218     } else {
     215    if {!$use_reg2} {
    219216        # Look to see if the port has registered an uninstall procedure
    220217        set uninstall [registry::property_retrieve $ref pkg_uninstall]
    221218        if { $uninstall != 0 } {
    222             if {![catch {eval $uninstall} err]} {
    223                 pkg_uninstall $portname $v
     219            if {![catch {eval [string map { \\n \n } $uninstall]} err]} {
     220                ui_info "Executing pkg_uninstall procedure"
     221                if {[catch {pkg_uninstall $portname "${version}_${revision}${variants}" } err]} {
     222                    ui_error [format [msgcat::mc "Error executing pkg_uninstall procedure: %s"] $err]
     223                }
    224224            } else {
    225225                global errorInfo
Note: See TracChangeset for help on using the changeset viewer.