[79070] trunk/base/src
jmr at macports.org
jmr at macports.org
Tue May 31 20:07:33 PDT 2011
Revision: 79070
http://trac.macports.org/changeset/79070
Author: jmr at macports.org
Date: 2011-05-31 20:07:30 -0700 (Tue, 31 May 2011)
Log Message:
-----------
remove flat registry code paths
Modified Paths:
--------------
trunk/base/src/macports1.0/macports.tcl
trunk/base/src/port/port.tcl
trunk/base/src/port1.0/portinstall.tcl
trunk/base/src/registry2.0/portimage.tcl
trunk/base/src/registry2.0/portuninstall.tcl
Modified: trunk/base/src/macports1.0/macports.tcl
===================================================================
--- trunk/base/src/macports1.0/macports.tcl 2011-06-01 02:17:35 UTC (rev 79069)
+++ trunk/base/src/macports1.0/macports.tcl 2011-06-01 03:07:30 UTC (rev 79070)
@@ -945,35 +945,30 @@
}
}
- # init registry if needed
- if {${registry.format} == "receipt_sqlite"} {
- set db_path [file join ${registry.path} registry registry.db]
- set db_exists [file exists $db_path]
- registry::open $db_path
- # for the benefit of the portimage code that is called from multiple interpreters
- global registry_open
- set registry_open yes
- # convert any flat receipts if we just created a new db
- if {$db_exists == 0 && [file writable $db_path]} {
- ui_warn "Converting your registry to sqlite format, this might take a while..."
- if {[catch {registry::convert_to_sqlite}]} {
- ui_debug "$::errorInfo"
- file delete -force $db_path
- error "Failed to convert your registry to sqlite!"
- } else {
- ui_warn "Successfully converted your registry to sqlite!"
- }
+ # init registry
+ set db_path [file join ${registry.path} registry registry.db]
+ set db_exists [file exists $db_path]
+ registry::open $db_path
+ # for the benefit of the portimage code that is called from multiple interpreters
+ global registry_open
+ set registry_open yes
+ # convert any flat receipts if we just created a new db
+ if {$db_exists == 0 && [file writable $db_path]} {
+ ui_warn "Converting your registry to sqlite format, this might take a while..."
+ if {[catch {registry::convert_to_sqlite}]} {
+ ui_debug "$::errorInfo"
+ file delete -force $db_path
+ error "Failed to convert your registry to sqlite!"
+ } else {
+ ui_warn "Successfully converted your registry to sqlite!"
}
}
}
# call this just before you exit
proc mportshutdown {} {
- global macports::registry.format
- if {${registry.format} == "receipt_sqlite"} {
- # close it down so the cleanup stuff is called, e.g. vacuuming the db
- registry::close
- }
+ # close it down so the cleanup stuff is called, e.g. vacuuming the db
+ registry::close
}
proc macports::worker_init {workername portpath porturl portbuildpath options variations} {
@@ -1381,10 +1376,7 @@
# mportopen_installed
# opens a portfile stored in the registry
proc mportopen_installed {name version revision variants options} {
- global macports::registry.format macports::registry.path
- if {${registry.format} != "receipt_sqlite"} {
- return -code error "mportopen_installed requires sqlite registry"
- }
+ global macports::registry.path
set regref [lindex [registry::entry imaged $name $version $revision $variants] 0]
set portfile_dir [file join ${registry.path} registry portfiles $name "${version}_${revision}${variants}"]
file mkdir $portfile_dir
@@ -3293,7 +3285,6 @@
}
}
- global macports::registry.format
# are we installing an existing version due to force or epoch override?
if {[registry::entry_exists $newname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants)]
&& ([info exists options(ports_upgrade_force)] || $build_override == 1)} {
@@ -3305,7 +3296,7 @@
set newregref [registry::open_entry $newname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants) $existing_epoch]
if {$is_dryrun eq "yes"} {
ui_msg "Skipping uninstall $newname @${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) (dry run)"
- } elseif {!(${registry.format} == "receipt_sqlite" && [registry::run_target $newregref uninstall [array get options]])
+ } elseif {![registry::run_target $newregref uninstall [array get options]]
&& [catch {registry_uninstall::uninstall $newname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) [array get options]} result]} {
global errorInfo
ui_debug "$errorInfo"
@@ -3329,7 +3320,7 @@
if {$is_dryrun eq "yes"} {
ui_msg "Skipping deactivate $portname @${version_active}_${revision_active}${variant_active} (dry run)"
} elseif {![catch {registry::active $portname}] &&
- !(${registry.format} == "receipt_sqlite" && [registry::run_target $regref deactivate [array get options]])
+ ![registry::run_target $regref deactivate [array get options]]
&& [catch {portimage::deactivate $portname ${version_active}_${revision_active}${variant_active} [array get options]} result]} {
global errorInfo
ui_debug "$errorInfo"
@@ -3405,7 +3396,7 @@
set regref [registry::open_entry $portname $version $revision $variant $epoch]
if {$is_dryrun eq "yes"} {
ui_msg "Skipping uninstall $portname @${version}_${revision}${variant} (dry run)"
- } elseif {!(${registry.format} == "receipt_sqlite" && [registry::run_target $regref uninstall $optionslist])
+ } elseif {![registry::run_target $regref uninstall $optionslist]
&& [catch {registry_uninstall::uninstall $portname ${version}_${revision}${variant} $optionslist} result]} {
global errorInfo
ui_debug "$errorInfo"
Modified: trunk/base/src/port/port.tcl
===================================================================
--- trunk/base/src/port/port.tcl 2011-06-01 02:17:35 UTC (rev 79069)
+++ trunk/base/src/port/port.tcl 2011-06-01 03:07:30 UTC (rev 79070)
@@ -2217,15 +2217,13 @@
proc action_activate { action portlist opts } {
- global macports::registry.format
set status 0
if {[require_portlist portlist] || [prefix_unwritable]} {
return 1
}
foreachport $portlist {
set composite_version [composite_version $portversion [array get variations]]
- if {${macports::registry.format} == "receipt_sqlite"
- && ![info exists options(ports_activate_no-exec)]
+ if {![info exists options(ports_activate_no-exec)]
&& ![catch {set ilist [registry::installed $portname $composite_version]}]
&& [llength $ilist] == 1} {
@@ -2251,15 +2249,13 @@
proc action_deactivate { action portlist opts } {
- global macports::registry.format
set status 0
if {[require_portlist portlist] || [prefix_unwritable]} {
return 1
}
foreachport $portlist {
set composite_version [composite_version $portversion [array get variations]]
- if {${macports::registry.format} == "receipt_sqlite"
- && ![info exists options(ports_deactivate_no-exec)]
+ if {![info exists options(ports_deactivate_no-exec)]
&& ![catch {set ilist [registry::active $portname]}]} {
set i [lindex $ilist 0]
@@ -2412,7 +2408,6 @@
proc action_setrequested { action portlist opts } {
- global macports::registry.format
set status 0
if {[require_portlist portlist] || [prefix_unwritable]} {
return 1
@@ -2426,9 +2421,6 @@
foreach i $ilist {
set regref [registry::open_entry $portname [lindex $i 1] [lindex $i 2] [lindex $i 3] [lindex $i 5]]
registry::property_store $regref requested $val
- if {${macports::registry.format} != "receipt_sqlite"} {
- registry::write_entry $regref
- }
}
} else {
global errorInfo
@@ -2809,7 +2801,6 @@
proc action_uninstall { action portlist opts } {
- global macports::registry.format
set status 0
if {[macports::global_option_isset port_uninstall_old]} {
# if -u then uninstall all inactive ports
@@ -2831,8 +2822,7 @@
continue
}
set composite_version [composite_version $portversion [array get variations]]
- if {${macports::registry.format} == "receipt_sqlite"
- && ![info exists options(ports_uninstall_no-exec)]
+ if {![info exists options(ports_uninstall_no-exec)]
&& ![catch {set ilist [registry::installed $portname $composite_version]}]
&& [llength $ilist] == 1} {
Modified: trunk/base/src/port1.0/portinstall.tcl
===================================================================
--- trunk/base/src/port1.0/portinstall.tcl 2011-06-01 02:17:35 UTC (rev 79069)
+++ trunk/base/src/port1.0/portinstall.tcl 2011-06-01 03:07:30 UTC (rev 79070)
@@ -54,7 +54,7 @@
proc portinstall::install_start {args} {
global UI_PREFIX subport version revision portvariants
- global prefix registry_open registry.format registry.path
+ global prefix registry_open registry.path
ui_notice "$UI_PREFIX [format [msgcat::mc "Installing %s @%s_%s%s"] $subport $version $revision $portvariants]"
# start gsoc08-privileges
@@ -66,7 +66,7 @@
}
# end gsoc08-privileges
- if {${registry.format} == "receipt_sqlite" && ![info exists registry_open]} {
+ if {![info exists registry_open]} {
registry::open [file join ${registry.path} registry registry.db]
set registry_open yes
}
@@ -483,7 +483,7 @@
homepage depends_run package-install workdir workpath \
worksrcdir UI_PREFIX destroot revision maintainers user_options \
portvariants negated_variants targets depends_lib PortInfo epoch license \
- registry.format os.platform os.major portarchivetype installPlist
+ os.platform os.major portarchivetype installPlist
set oldpwd [pwd]
if {$oldpwd == ""} {
@@ -503,112 +503,54 @@
set installPlist [extract_contents $location $portarchivetype]
}
- if {[string equal ${registry.format} "receipt_sqlite"]} {
- # registry2.0
-
- # can't do this inside the write transaction due to deadlock issues with _get_dep_port
- set dep_portnames [list]
- foreach deplist {depends_lib depends_run} {
- if {[info exists $deplist]} {
- foreach dep [set $deplist] {
- set dep_portname [_get_dep_port $dep]
- if {$dep_portname != ""} {
- lappend dep_portnames $dep_portname
- }
+ # can't do this inside the write transaction due to deadlock issues with _get_dep_port
+ set dep_portnames [list]
+ foreach deplist {depends_lib depends_run} {
+ if {[info exists $deplist]} {
+ foreach dep [set $deplist] {
+ set dep_portname [_get_dep_port $dep]
+ if {$dep_portname != ""} {
+ lappend dep_portnames $dep_portname
}
}
}
+ }
- registry::write {
+ registry::write {
- set regref [registry::entry create $subport $version $revision $portvariants $epoch]
+ set regref [registry::entry create $subport $version $revision $portvariants $epoch]
- if {[info exists user_options(ports_requested)]} {
- $regref requested $user_options(ports_requested)
- } else {
- $regref requested 0
- }
- $regref os_platform ${os.platform}
- $regref os_major ${os.major}
- $regref archs [get_canonical_archs]
- # Trick to have a portable GMT-POSIX epoch-based time.
- $regref date [expr [clock scan now -gmt true] - [clock scan "1970-1-1 00:00:00" -gmt true]]
- if {[info exists negated_variants]} {
- $regref negated_variants $negated_variants
- }
-
- foreach dep_portname $dep_portnames {
- $regref depends $dep_portname
- }
-
- $regref installtype image
- $regref state imaged
- $regref location $location
-
- if {[info exists installPlist]} {
- # register files
- $regref map $installPlist
- }
-
- # store portfile
- set fd [open [file join ${portpath} Portfile]]
- $regref portfile [read $fd]
- close $fd
+ if {[info exists user_options(ports_requested)]} {
+ $regref requested $user_options(ports_requested)
+ } else {
+ $regref requested 0
}
- } else {
- # Begin the registry entry
- set regref [registry_new $subport $version $revision $portvariants $epoch]
+ $regref os_platform ${os.platform}
+ $regref os_major ${os.major}
+ $regref archs [get_canonical_archs]
+ # Trick to have a portable GMT-POSIX epoch-based time.
+ $regref date [expr [clock scan now -gmt true] - [clock scan "1970-1-1 00:00:00" -gmt true]]
if {[info exists negated_variants]} {
- registry_prop_store $regref negated_variants $negated_variants
+ $regref negated_variants $negated_variants
}
- registry_prop_store $regref location $location
-
- if {[info exists user_options(ports_requested)]} {
- registry_prop_store $regref requested $user_options(ports_requested)
- } else {
- registry_prop_store $regref requested 0
+ foreach dep_portname $dep_portnames {
+ $regref depends $dep_portname
}
- registry_prop_store $regref categories $categories
- registry_prop_store $regref os_platform ${os.platform}
- registry_prop_store $regref os_major ${os.major}
- registry_prop_store $regref archs [get_canonical_archs]
+ $regref installtype image
+ $regref state imaged
+ $regref location $location
- if {[info exists description]} {
- registry_prop_store $regref description [string map {\n \\n} ${description}]
- }
- if {[info exists long_description]} {
- registry_prop_store $regref long_description [string map {\n \\n} ${long_description}]
- }
- if {[info exists license]} {
- registry_prop_store $regref license ${license}
- }
- if {[info exists homepage]} {
- registry_prop_store $regref homepage ${homepage}
- }
- if {[info exists maintainers]} {
- registry_prop_store $regref maintainers ${maintainers}
- }
- if {[info exists depends_run]} {
- registry_prop_store $regref depends_run $depends_run
- registry_register_deps $depends_run $subport
- }
- if {[info exists depends_lib]} {
- registry_prop_store $regref depends_lib $depends_lib
- registry_register_deps $depends_lib $subport
- }
if {[info exists installPlist]} {
- registry_prop_store $regref contents [_fake_fileinfo_for_index $installPlist]
+ # register files
+ $regref map $installPlist
}
- if {[info exists package-install]} {
- registry_prop_store $regref package-install ${package-install}
- }
- if {[info proc pkg_uninstall] == "pkg_uninstall"} {
- registry_prop_store $regref pkg_uninstall [proc_disasm pkg_uninstall]
- }
-
- registry_write $regref
+
+ # store portfile
+ set fd [open [file join ${portpath} Portfile]]
+ $regref portfile [read $fd]
+ close $fd
}
_cd $oldpwd
Modified: trunk/base/src/registry2.0/portimage.tcl
===================================================================
--- trunk/base/src/registry2.0/portimage.tcl 2011-06-01 02:17:35 UTC (rev 79069)
+++ trunk/base/src/registry2.0/portimage.tcl 2011-06-01 03:07:30 UTC (rev 79070)
@@ -61,15 +61,13 @@
namespace eval portimage {
variable force 0
-variable use_reg2 0
variable noexec 0
# Activate a "Port Image"
proc activate {name v optionslist} {
- global macports::prefix macports::registry.format macports::registry.path registry_open UI_PREFIX
+ global macports::prefix macports::registry.path registry_open UI_PREFIX
array set options $optionslist
variable force
- variable use_reg2
variable noexec
if {[info exists options(ports_force)] && [string is true -strict $options(ports_force)] } {
@@ -78,89 +76,45 @@
if {[info exists options(ports_activate_no-exec)]} {
set noexec $options(ports_activate_no-exec)
}
- if {[string equal ${macports::registry.format} "receipt_sqlite"]} {
- set use_reg2 1
- if {![info exists registry_open]} {
- registry::open [file join ${macports::registry.path} registry registry.db]
- set registry_open yes
- }
+ if {![info exists registry_open]} {
+ registry::open [file join ${macports::registry.path} registry registry.db]
+ set registry_open yes
}
set todeactivate [list]
- if {$use_reg2} {
- registry::read {
+ registry::read {
- set requested [_check_registry $name $v]
- # set name again since the one we were passed may not have had the correct case
- set name [$requested name]
- set version [$requested version]
- set revision [$requested revision]
- set variants [$requested variants]
- set specifier "${version}_${revision}${variants}"
- set location [$requested location]
-
- # if another version of this port is active, deactivate it first
- set current [registry::entry installed $name]
- foreach i $current {
- if { ![string equal $specifier "[$i version]_[$i revision][$i variants]"] } {
- lappend todeactivate $i
- }
- }
-
- # this shouldn't be possible
- if { ![string equal [$requested installtype] "image"] } {
- return -code error "Image error: ${name} @${version}_${revision}${variants} not installed as an image."
- }
- if {![file isfile $location]} {
- return -code error "Image error: Can't find image file $location"
- }
- if { [string equal [$requested state] "installed"] } {
- return -code error "Image error: ${name} @${version}_${revision}${variants} is already active."
- }
- }
- foreach a $todeactivate {
- if {$noexec || ![registry::run_target $a deactivate [list ports_nodepcheck 1]]} {
- deactivate $name "[$a version]_[$a revision][$a variants]" [list ports_nodepcheck 1]
- }
- }
- } else {
- # registry1.0
- set ilist [_check_registry $name $v]
+ set requested [_check_registry $name $v]
# set name again since the one we were passed may not have had the correct case
- set name [lindex $ilist 0]
- set version [lindex $ilist 1]
- set revision [lindex $ilist 2]
- set variants [lindex $ilist 3]
+ set name [$requested name]
+ set version [$requested version]
+ set revision [$requested revision]
+ set variants [$requested variants]
+ set specifier "${version}_${revision}${variants}"
+ set location [$requested location]
# if another version of this port is active, deactivate it first
- set ilist [registry::installed $name]
- if { [llength $ilist] > 1 } {
- foreach i $ilist {
- set iversion [lindex $i 1]
- set irevision [lindex $i 2]
- set ivariants [lindex $i 3]
- set iactive [lindex $i 4]
- if { ![string equal "${iversion}_${irevision}${ivariants}" "${version}_${revision}${variants}"] && $iactive == 1 } {
- lappend todeactivate "${iversion}_${irevision}${ivariants}"
- }
+ set current [registry::entry installed $name]
+ foreach i $current {
+ if { ![string equal $specifier "[$i version]_[$i revision][$i variants]"] } {
+ lappend todeactivate $i
}
}
- set ref [registry::open_entry $name $version $revision $variants]
-
- if { ![string equal [registry::property_retrieve $ref installtype] "image"] } {
+ # this shouldn't be possible
+ if { ![string equal [$requested installtype] "image"] } {
return -code error "Image error: ${name} @${version}_${revision}${variants} not installed as an image."
}
- set location [registry::property_retrieve $ref location]
if {![file isfile $location]} {
return -code error "Image error: Can't find image file $location"
}
- if { [registry::property_retrieve $ref active] != 0 } {
+ if { [string equal [$requested state] "installed"] } {
return -code error "Image error: ${name} @${version}_${revision}${variants} is already active."
}
-
- foreach a $todeactivate {
- deactivate $name $a [list ports_nodepcheck 1]
+ }
+ foreach a $todeactivate {
+ if {$noexec || ![registry::run_target $a deactivate [list ports_nodepcheck 1]]} {
+ deactivate $name "[$a version]_[$a revision][$a variants]" [list ports_nodepcheck 1]
}
}
@@ -170,36 +124,13 @@
ui_msg "$UI_PREFIX [format [msgcat::mc "Activating %s"] $name]"
}
- if {$use_reg2} {
- _activate_contents $requested
- $requested state installed
- } else {
- set contents [registry::property_retrieve $ref contents]
-
- set imagefiles {}
- foreach content_element $contents {
- lappend imagefiles [lindex $content_element 0]
- }
-
- registry::open_file_map
- _activate_contents $name $imagefiles $location
-
- registry::property_store $ref active 1
-
- registry::write_entry $ref
-
- foreach file $imagefiles {
- registry::register_file $file $name
- }
- registry::write_file_map
- registry::close_file_map
- }
+ _activate_contents $requested
+ $requested state installed
}
proc deactivate {name v optionslist} {
- global UI_PREFIX macports::registry.format macports::registry.path registry_open
+ global UI_PREFIX macports::registry.path registry_open
array set options $optionslist
- variable use_reg2
if {[info exists options(ports_force)] && [string is true -strict $options(ports_force)] } {
# this not using the namespace variable is correct, since activate
@@ -209,44 +140,26 @@
} else {
set force 0
}
- if {[string equal ${macports::registry.format} "receipt_sqlite"]} {
- set use_reg2 1
- if {![info exists registry_open]} {
- registry::open [file join ${macports::registry.path} registry registry.db]
- set registry_open yes
- }
+ if {![info exists registry_open]} {
+ registry::open [file join ${macports::registry.path} registry registry.db]
+ set registry_open yes
}
- if {$use_reg2} {
- if { [string equal $name ""] } {
- throw registry::image-error "Registry error: Please specify the name of the port."
- }
- set ilist [registry::entry installed $name]
- if { [llength $ilist] == 1 } {
- set requested [lindex $ilist 0]
- } else {
- throw registry::image-error "Image error: port ${name} is not active."
- }
- # set name again since the one we were passed may not have had the correct case
- set name [$requested name]
- set version [$requested version]
- set revision [$requested revision]
- set variants [$requested variants]
- set specifier "${version}_${revision}${variants}"
+ if { [string equal $name ""] } {
+ throw registry::image-error "Registry error: Please specify the name of the port."
+ }
+ set ilist [registry::entry installed $name]
+ if { [llength $ilist] == 1 } {
+ set requested [lindex $ilist 0]
} else {
- set ilist [registry::active $name]
- if { [llength $ilist] > 1 } {
- return -code error "Registry error: Please specify the name of the port."
- } else {
- set ilist [lindex $ilist 0]
- }
- # set name again since the one we were passed may not have had the correct case
- set name [lindex $ilist 0]
- set version [lindex $ilist 1]
- set revision [lindex $ilist 2]
- set variants [lindex $ilist 3]
- set specifier "${version}_${revision}${variants}"
+ throw registry::image-error "Image error: port ${name} is not active."
}
+ # set name again since the one we were passed may not have had the correct case
+ set name [$requested name]
+ set version [$requested version]
+ set revision [$requested revision]
+ set variants [$requested variants]
+ set specifier "${version}_${revision}${variants}"
if { $v != "" && ![string equal $specifier $v] } {
return -code error "Active version of $name is not $v but ${specifier}."
@@ -258,108 +171,55 @@
ui_msg "$UI_PREFIX [format [msgcat::mc "Deactivating %s"] $name]"
}
- if {$use_reg2} {
- if { ![string equal [$requested installtype] "image"] } {
- return -code error "Image error: ${name} @${specifier} not installed as an image."
- }
- # this shouldn't be possible
- if { [$requested state] != "installed" } {
- return -code error "Image error: ${name} @${specifier} is not active."
- }
+ if { ![string equal [$requested installtype] "image"] } {
+ return -code error "Image error: ${name} @${specifier} not installed as an image."
+ }
+ # this shouldn't be possible
+ if { [$requested state] != "installed" } {
+ return -code error "Image error: ${name} @${specifier} is not active."
+ }
- if {![info exists options(ports_nodepcheck)] || ![string is true -strict $options(ports_nodepcheck)]} {
- registry::check_dependents $requested $force "deactivate"
- }
-
- _deactivate_contents $requested [$requested files] $force
- $requested state imaged
- } else {
- set ref [registry::open_entry $name $version $revision $variants]
-
- if { ![string equal [registry::property_retrieve $ref installtype] "image"] } {
- return -code error "Image error: ${name} @${specifier} not installed as an image."
- }
- if { [registry::property_retrieve $ref active] != 1 } {
- return -code error "Image error: ${name} @${specifier} is not active."
- }
-
- registry::open_file_map
- set imagefiles [registry::port_registered $name]
-
- _deactivate_contents $name $imagefiles
-
- foreach file $imagefiles {
- registry::unregister_file $file
- }
- registry::write_file_map
- registry::close_file_map
-
- registry::property_store $ref active 0
-
- registry::write_entry $ref
+ if {![info exists options(ports_nodepcheck)] || ![string is true -strict $options(ports_nodepcheck)]} {
+ registry::check_dependents $requested $force "deactivate"
}
+
+ _deactivate_contents $requested [$requested files] $force
+ $requested state imaged
}
proc _check_registry {name v} {
global UI_PREFIX
- variable use_reg2
- if {$use_reg2} {
- if { [registry::decode_spec $v version revision variants] } {
- set ilist [registry::entry imaged $name $version $revision $variants]
- set valid 1
- } else {
- set valid [string equal $v {}]
- set ilist [registry::entry imaged $name]
- }
+ if { [registry::decode_spec $v version revision variants] } {
+ set ilist [registry::entry imaged $name $version $revision $variants]
+ set valid 1
+ } else {
+ set valid [string equal $v {}]
+ set ilist [registry::entry imaged $name]
+ }
- if { [llength $ilist] > 1 || (!$valid && [llength $ilist] == 1) } {
- ui_msg "$UI_PREFIX [msgcat::mc "The following versions of $name are currently installed:"]"
- foreach i $ilist {
- set iname [$i name]
- set iversion [$i version]
- set irevision [$i revision]
- set ivariants [$i variants]
- if { [$i state] == "installed" } {
- ui_msg "$UI_PREFIX [format [msgcat::mc " %s @%s_%s%s (active)"] $iname $iversion $irevision $ivariants]"
- } else {
- ui_msg "$UI_PREFIX [format [msgcat::mc " %s @%s_%s%s"] $iname $iversion $irevision $ivariants]"
- }
- }
- if { $valid } {
- throw registry::invalid "Registry error: Please specify the full version as recorded in the port registry."
+ if { [llength $ilist] > 1 || (!$valid && [llength $ilist] == 1) } {
+ ui_msg "$UI_PREFIX [msgcat::mc "The following versions of $name are currently installed:"]"
+ foreach i $ilist {
+ set iname [$i name]
+ set iversion [$i version]
+ set irevision [$i revision]
+ set ivariants [$i variants]
+ if { [$i state] == "installed" } {
+ ui_msg "$UI_PREFIX [format [msgcat::mc " %s @%s_%s%s (active)"] $iname $iversion $irevision $ivariants]"
} else {
- throw registry::invalid "Registry error: Invalid version specified. Please specify a version as recorded in the port registry."
+ ui_msg "$UI_PREFIX [format [msgcat::mc " %s @%s_%s%s"] $iname $iversion $irevision $ivariants]"
}
- } elseif { [llength $ilist] == 1 } {
- return [lindex $ilist 0]
}
- throw registry::invalid "Registry error: No port of $name installed."
- } else {
- # registry1.0
- set ilist [registry::installed $name $v]
- if { [string equal $v ""] && [llength $ilist] > 1 } {
- # set name again since the one we were passed may not have had the correct case
- set name [lindex [lindex $ilist 0] 0]
- ui_msg "$UI_PREFIX [msgcat::mc "The following versions of $name are currently installed:"]"
- foreach i $ilist {
- set iname [lindex $i 0]
- set iversion [lindex $i 1]
- set irevision [lindex $i 2]
- set ivariants [lindex $i 3]
- set iactive [lindex $i 4]
- if { $iactive == 0 } {
- ui_msg "$UI_PREFIX [format [msgcat::mc " %s @%s_%s%s"] $iname $iversion $irevision $ivariants]"
- } elseif { $iactive == 1 } {
- ui_msg "$UI_PREFIX [format [msgcat::mc " %s @%s_%s%s (active)"] $iname $iversion $irevision $ivariants]"
- }
- }
- return -code error "Registry error: Please specify the full version as recorded in the port registry."
- } elseif {[llength $ilist] == 1} {
- return [lindex $ilist 0]
+ if { $valid } {
+ throw registry::invalid "Registry error: Please specify the full version as recorded in the port registry."
+ } else {
+ throw registry::invalid "Registry error: Invalid version specified. Please specify a version as recorded in the port registry."
}
- return -code error "Registry error: No port of $name installed."
+ } elseif { [llength $ilist] == 1 } {
+ return [lindex $ilist 0]
}
+ throw registry::invalid "Registry error: No port of $name installed."
}
## Activates a file from an image into the filesystem. Deals with symlinks,
@@ -534,18 +394,13 @@
## Activates the contents of a port
proc _activate_contents {port {imagefiles {}} {location {}}} {
variable force
- variable use_reg2
variable noexec
global macports::prefix
set files [list]
set baksuffix .mp_[clock seconds]
- if {$use_reg2} {
- set location [$port location]
- set imagefiles [$port imagefiles]
- } else {
- set name $port
- }
+ set location [$port location]
+ set imagefiles [$port imagefiles]
set extracted_dir [extract_archive_to_tmpdir $location]
set backups [list]
@@ -556,244 +411,131 @@
# Last, if the file exists, and belongs to another port, and force is set
# we remove the file from the file_map, take ownership of it, and
# clobber it
- if {$use_reg2} {
- array set todeactivate {}
- try {
- registry::write {
- foreach file $imagefiles {
- set srcfile "${extracted_dir}${file}"
+ array set todeactivate {}
+ try {
+ registry::write {
+ foreach file $imagefiles {
+ set srcfile "${extracted_dir}${file}"
- # To be able to install links, we test if we can lstat the file to
- # figure out if the source file exists (file exists will return
- # false for symlinks on files that do not exist)
- if { [catch {file lstat $srcfile dummystatvar}] } {
- throw registry::image-error "Image error: Source file $srcfile does not appear to exist (cannot lstat it). Unable to activate port [$port name]."
- }
+ # To be able to install links, we test if we can lstat the file to
+ # figure out if the source file exists (file exists will return
+ # false for symlinks on files that do not exist)
+ if { [catch {file lstat $srcfile dummystatvar}] } {
+ throw registry::image-error "Image error: Source file $srcfile does not appear to exist (cannot lstat it). Unable to activate port [$port name]."
+ }
- set owner [registry::entry owner $file]
+ set owner [registry::entry owner $file]
- if {$owner != {} && $owner != $port} {
- # deactivate conflicting port if it is replaced_by this one
- set result [mportlookup [$owner name]]
- array unset portinfo
- array set portinfo [lindex $result 1]
- if {[info exists portinfo(replaced_by)] && [lsearch -regexp $portinfo(replaced_by) "(?i)^[$port name]\$"] != -1} {
- # we'll deactivate the owner later, but before activating our files
- set todeactivate($owner) yes
- set owner "replaced"
- }
+ if {$owner != {} && $owner != $port} {
+ # deactivate conflicting port if it is replaced_by this one
+ set result [mportlookup [$owner name]]
+ array unset portinfo
+ array set portinfo [lindex $result 1]
+ if {[info exists portinfo(replaced_by)] && [lsearch -regexp $portinfo(replaced_by) "(?i)^[$port name]\$"] != -1} {
+ # we'll deactivate the owner later, but before activating our files
+ set todeactivate($owner) yes
+ set owner "replaced"
}
+ }
- if {$owner != "replaced"} {
- if { [string is true -strict $force] } {
- # if we're forcing the activation, then we move any existing
- # files to a backup file, both in the filesystem and in the
- # registry
- if { [file exists $file] } {
- set bakfile "${file}${baksuffix}"
- ui_warn "File $file already exists. Moving to: $bakfile."
- file rename -force -- $file $bakfile
- lappend backups $file
- }
- if { $owner != {} } {
- $owner deactivate [list $file]
- $owner activate [list $file] [list "${file}${baksuffix}"]
- }
- } else {
- # if we're not forcing the activation, then we bail out if
- # we find any files that already exist, or have entries in
- # the registry
- if { $owner != {} && $owner != $port } {
- throw registry::image-error "Image error: $file is being used by the active [$owner name] port. Please deactivate this port first, or use 'port -f activate [$port name]' to force the activation."
- } elseif { $owner == {} && ![catch {file type $file}] } {
- throw registry::image-error "Image error: $file already exists and does not belong to a registered port. Unable to activate port [$port name]. Use 'port -f activate [$port name]' to force the activation."
- }
+ if {$owner != "replaced"} {
+ if { [string is true -strict $force] } {
+ # if we're forcing the activation, then we move any existing
+ # files to a backup file, both in the filesystem and in the
+ # registry
+ if { [file exists $file] } {
+ set bakfile "${file}${baksuffix}"
+ ui_warn "File $file already exists. Moving to: $bakfile."
+ file rename -force -- $file $bakfile
+ lappend backups $file
}
+ if { $owner != {} } {
+ $owner deactivate [list $file]
+ $owner activate [list $file] [list "${file}${baksuffix}"]
+ }
+ } else {
+ # if we're not forcing the activation, then we bail out if
+ # we find any files that already exist, or have entries in
+ # the registry
+ if { $owner != {} && $owner != $port } {
+ throw registry::image-error "Image error: $file is being used by the active [$owner name] port. Please deactivate this port first, or use 'port -f activate [$port name]' to force the activation."
+ } elseif { $owner == {} && ![catch {file type $file}] } {
+ throw registry::image-error "Image error: $file already exists and does not belong to a registered port. Unable to activate port [$port name]. Use 'port -f activate [$port name]' to force the activation."
+ }
}
-
- # Split out the filename's subpaths and add them to the
- # imagefile list.
- # We need directories first to make sure they will be there
- # before links. However, because file mkdir creates all parent
- # directories, we don't need to have them sorted from root to
- # subpaths. We do need, nevertheless, all sub paths to make sure
- # we'll set the directory attributes properly for all
- # directories.
- set directory [file dirname $file]
- while { [lsearch -exact $files $directory] == -1 } {
- lappend files $directory
- set directory [file dirname $directory]
- }
-
- # Also add the filename to the imagefile list.
- lappend files $file
}
- }
- # deactivate ports replaced_by this one
- foreach owner [array names todeactivate] {
- if {$noexec || ![registry::run_target $owner deactivate [list ports_nodepcheck 1]]} {
- deactivate [$owner name] "" [list ports_nodepcheck 1]
+ # Split out the filename's subpaths and add them to the
+ # imagefile list.
+ # We need directories first to make sure they will be there
+ # before links. However, because file mkdir creates all parent
+ # directories, we don't need to have them sorted from root to
+ # subpaths. We do need, nevertheless, all sub paths to make sure
+ # we'll set the directory attributes properly for all
+ # directories.
+ set directory [file dirname $file]
+ while { [lsearch -exact $files $directory] == -1 } {
+ lappend files $directory
+ set directory [file dirname $directory]
}
- }
- # Sort the list in forward order, removing duplicates.
- # Since the list is sorted in forward order, we're sure that
- # directories are before their elements.
- # We don't have to do this as mentioned above, but it makes the
- # debug output of activate make more sense.
- set files [lsort -increasing -unique $files]
- set rollback_filelist {}
-
- registry::write {
- # Activate it, and catch errors so we can roll-back
- try {
- $port activate $imagefiles
- foreach file $files {
- if {[_activate_file "${extracted_dir}${file}" $file] == 1} {
- lappend rollback_filelist $file
- }
- }
- } catch {*} {
- ui_debug "Activation failed, rolling back."
- # can't do it here since we're already inside a transaction
- set deactivate_this yes
- throw
- }
+ # Also add the filename to the imagefile list.
+ lappend files $file
}
- } catch {*} {
- # roll back activation of this port
- if {[info exists deactivate_this]} {
- _deactivate_contents $port $rollback_filelist yes yes
- }
- # if any errors occurred, move backed-up files back to their original
- # locations, then rethrow the error. Transaction rollback will take care
- # of this in the registry.
- foreach file $backups {
- file rename -force -- "${file}${baksuffix}" $file
- }
- # reactivate deactivated ports
- foreach entry [array names todeactivate] {
- if {[$entry state] == "imaged" && ($noexec || ![registry::run_target $entry activate ""])} {
- set pvers "[$entry version]_[$entry revision][$entry variants]"
- activate [$entry name] $pvers [list ports_activate_no-exec $noexec]
- }
- }
- # remove temp image dir
- file delete -force $extracted_dir
- throw
}
- } else {
- # registry1.0
- set deactivated [list]
- foreach file $imagefiles {
- set srcfile "${extracted_dir}${file}"
- # To be able to install links, we test if we can lstat the file to
- # figure out if the source file exists (file exists will return
- # false for symlinks on files that do not exist)
- if { [catch {file lstat $srcfile dummystatvar}] } {
- file delete -force $extracted_dir
- return -code error "Image error: Source file $srcfile does not appear to exist (cannot lstat it). Unable to activate port $name."
+ # deactivate ports replaced_by this one
+ foreach owner [array names todeactivate] {
+ if {$noexec || ![registry::run_target $owner deactivate [list ports_nodepcheck 1]]} {
+ deactivate [$owner name] "" [list ports_nodepcheck 1]
}
-
- set port [registry::file_registered $file]
-
- if {$port != 0 && $port != $name} {
- # deactivate conflicting port if it is replaced_by this one
- if {[catch {mportlookup $port} result]} {
- global errorInfo
- ui_debug "$errorInfo"
- file delete -force $extracted_dir
- return -code error "port lookup failed: $result"
- }
- array unset portinfo
- array set portinfo [lindex $result 1]
- if {[info exists portinfo(replaced_by)] && [lsearch -regexp $portinfo(replaced_by) "(?i)^${name}\$"] != -1} {
- lappend deactivated [lindex [registry::active $port] 0]
- deactivate $port "" ""
- set port 0
- }
- }
-
- if { $port != 0 && $force != 1 && $port != $name } {
- file delete -force $extracted_dir
- return -code error "Image error: $file is being used by the active $port port. Please deactivate this port first, or use 'port -f activate $name' to force the activation."
- } elseif { [file exists $file] && $force != 1 } {
- file delete -force $extracted_dir
- return -code error "Image error: $file already exists and does not belong to a registered port. Unable to activate port $name. Use 'port -f activate $name' to force the activation."
- } elseif { $force == 1 && [file exists $file] || $port != 0 } {
- set bakfile "${file}${baksuffix}"
-
- if {[file exists $file]} {
- ui_warn "File $file already exists. Moving to: $bakfile."
- file rename -force -- $file $bakfile
- lappend backups $file
- }
-
- if { $port != 0 } {
- set bakport [registry::file_registered $file]
- registry::unregister_file $file
- if {[file exists $bakfile]} {
- registry::register_file $bakfile $bakport
- }
- }
- }
-
- # Split out the filename's subpaths and add them to the imagefile list.
- # We need directories first to make sure they will be there before
- # links. However, because file mkdir creates all parent directories,
- # we don't need to have them sorted from root to subpaths. We do need,
- # nevertheless, all sub paths to make sure we'll set the directory
- # attributes properly for all directories.
- set directory [file dirname $file]
- while { [lsearch -exact $files $directory] == -1 } {
- lappend files $directory
- set directory [file dirname $directory]
- }
-
- # Also add the filename to the imagefile list.
- lappend files $file
}
- registry::write_file_map
# Sort the list in forward order, removing duplicates.
- # Since the list is sorted in forward order, we're sure that directories
- # are before their elements.
+ # Since the list is sorted in forward order, we're sure that
+ # directories are before their elements.
# We don't have to do this as mentioned above, but it makes the
# debug output of activate make more sense.
set files [lsort -increasing -unique $files]
set rollback_filelist {}
- # Activate it, and catch errors so we can roll-back
- if { [catch { foreach file $files {
- if {[_activate_file "${extracted_dir}${file}" $file] == 1} {
- lappend rollback_filelist $file
- }
- }} result]} {
- ui_debug "Activation failed, rolling back."
- _deactivate_contents $name $rollback_filelist yes yes
- # return backed up files to their old locations
- foreach f $backups {
- set bakfile "${f}${baksuffix}"
- set bakport [registry::file_registered $bakfile]
- if {$bakport != 0} {
- registry::unregister_file $bakfile
- registry::register_file $f $bakport
+ registry::write {
+ # Activate it, and catch errors so we can roll-back
+ try {
+ $port activate $imagefiles
+ foreach file $files {
+ if {[_activate_file "${extracted_dir}${file}" $file] == 1} {
+ lappend rollback_filelist $file
+ }
}
- file rename -force -- $bakfile $file
+ } catch {*} {
+ ui_debug "Activation failed, rolling back."
+ # can't do it here since we're already inside a transaction
+ set deactivate_this yes
+ throw
}
- # reactivate deactivated ports
- foreach entry $deactivated {
- set pname [lindex $entry 0]
- set pvers "[lindex $entry 1]_[lindex $entry 2][lindex $entry 3]"
- activate $pname $pvers ""
+ }
+ } catch {*} {
+ # roll back activation of this port
+ if {[info exists deactivate_this]} {
+ _deactivate_contents $port $rollback_filelist yes yes
+ }
+ # if any errors occurred, move backed-up files back to their original
+ # locations, then rethrow the error. Transaction rollback will take care
+ # of this in the registry.
+ foreach file $backups {
+ file rename -force -- "${file}${baksuffix}" $file
+ }
+ # reactivate deactivated ports
+ foreach entry [array names todeactivate] {
+ if {[$entry state] == "imaged" && ($noexec || ![registry::run_target $entry activate ""])} {
+ set pvers "[$entry version]_[$entry revision][$entry variants]"
+ activate [$entry name] $pvers [list ports_activate_no-exec $noexec]
}
- registry::write_file_map
-
- file delete -force $extracted_dir
- return -code error $result
}
+ # remove temp image dir
+ file delete -force $extracted_dir
+ throw
}
file delete -force $extracted_dir
}
@@ -817,7 +559,6 @@
}
proc _deactivate_contents {port imagefiles {force 0} {rollback 0}} {
- variable use_reg2
set files [list]
foreach file $imagefiles {
@@ -852,7 +593,7 @@
set files [lsort -decreasing -unique $files]
# Remove all elements.
- if {$use_reg2 && !$rollback} {
+ if {!$rollback} {
registry::write {
$port deactivate $imagefiles
foreach file $files {
Modified: trunk/base/src/registry2.0/portuninstall.tcl
===================================================================
--- trunk/base/src/registry2.0/portuninstall.tcl 2011-06-01 02:17:35 UTC (rev 79069)
+++ trunk/base/src/registry2.0/portuninstall.tcl 2011-06-01 03:07:30 UTC (rev 79070)
@@ -42,7 +42,7 @@
proc uninstall {portname {v ""} optionslist} {
global uninstall.force uninstall.nochecksum UI_PREFIX \
- macports::registry.format macports::portimagefilepath
+ macports::portimagefilepath
array set options $optionslist
if {![info exists uninstall.force]} {
@@ -56,48 +56,24 @@
if {[info exists options(ports_uninstall_no-exec)]} {
set options(ports_deactivate_no-exec) $options(ports_uninstall_no-exec)
}
- # check which registry API to use
- set use_reg2 [string equal ${macports::registry.format} "receipt_sqlite"]
- if {$use_reg2} {
- if { [registry::decode_spec $v version revision variants] } {
- set ilist [registry::entry imaged $portname $version $revision $variants]
- set valid 1
- } else {
- set valid [string equal $v {}]
- set ilist [registry::entry imaged $portname]
- }
- } else {
- set ilist [registry::installed $portname $v]
+ if { [registry::decode_spec $v version revision variants] } {
+ set ilist [registry::entry imaged $portname $version $revision $variants]
set valid 1
+ } else {
+ set valid [string equal $v {}]
+ set ilist [registry::entry imaged $portname]
}
if { [llength $ilist] > 1 } {
# set portname again since the one we were passed may not have had the correct case
- if {$use_reg2} {
- set portname [[lindex $ilist 0] name]
- } else {
- set portname [lindex [lindex $ilist 0] 0]
- }
+ set portname [[lindex $ilist 0] name]
ui_msg "$UI_PREFIX [msgcat::mc "The following versions of $portname are currently installed:"]"
foreach i [portlist_sortint $ilist] {
- if {$use_reg2} {
- set ispec "[$i version]_[$i revision][$i variants]"
- if { [string equal [$i state] installed] } {
- ui_msg "$UI_PREFIX [format [msgcat::mc " %s @%s (active)"] [$i name] $ispec]"
- } else {
- ui_msg "$UI_PREFIX [format [msgcat::mc " %s @%s"] [$i name] $ispec]"
- }
+ set ispec "[$i version]_[$i revision][$i variants]"
+ if { [string equal [$i state] installed] } {
+ ui_msg "$UI_PREFIX [format [msgcat::mc " %s @%s (active)"] [$i name] $ispec]"
} else {
- set iname [lindex $i 0]
- set iversion [lindex $i 1]
- set irevision [lindex $i 2]
- set ivariants [lindex $i 3]
- set iactive [lindex $i 4]
- if { $iactive == 1 } {
- ui_msg "$UI_PREFIX [format [msgcat::mc " %s @%s_%s%s (active)"] $iname $iversion $irevision $ivariants]"
- } else {
- ui_msg "$UI_PREFIX [format [msgcat::mc " %s @%s_%s%s"] $iname $iversion $irevision $ivariants]"
- }
+ ui_msg "$UI_PREFIX [format [msgcat::mc " %s @%s"] [$i name] $ispec]"
}
}
if { $valid } {
@@ -106,17 +82,10 @@
throw registry::invalid "Registry error: Invalid version specified. Please specify a version as recorded in the port registry."
}
} elseif { [llength $ilist] == 1 } {
- if {$use_reg2} {
- set port [lindex $ilist 0]
- set version [$port version]
- set revision [$port revision]
- set variants [$port variants]
- } else {
- set version [lindex [lindex $ilist 0] 1]
- set revision [lindex [lindex $ilist 0] 2]
- set variants [lindex [lindex $ilist 0] 3]
- set active [lindex [lindex $ilist 0] 4]
- }
+ set port [lindex $ilist 0]
+ set version [$port version]
+ set revision [$port revision]
+ set variants [$port variants]
if {$v == ""} {
set v "${version}_${revision}${variants}"
}
@@ -124,104 +93,41 @@
throw registry::invalid "Registry error: $portname not registered as installed"
}
- if {$use_reg2} {
- # uninstall dependents if requested
- if {[info exists options(ports_uninstall_follow-dependents)] && $options(ports_uninstall_follow-dependents) eq "yes"} {
- foreach depport [$port dependents] {
- # make sure it's still installed, since a previous dep uninstall may have removed it
- if {[registry::entry exists $depport] && ([$depport state] == "imaged" || [$depport state] == "installed")} {
- if {[info exists options(ports_uninstall_no-exec)] || ![registry::run_target $depport uninstall $optionslist]} {
- set depname [$depport name]
- set depver "[$depport version]_[$depport revision][$depport variants]"
- registry_uninstall::uninstall $depname $depver $optionslist
- }
+ # uninstall dependents if requested
+ if {[info exists options(ports_uninstall_follow-dependents)] && $options(ports_uninstall_follow-dependents) eq "yes"} {
+ foreach depport [$port dependents] {
+ # make sure it's still installed, since a previous dep uninstall may have removed it
+ if {[registry::entry exists $depport] && ([$depport state] == "imaged" || [$depport state] == "installed")} {
+ if {[info exists options(ports_uninstall_no-exec)] || ![registry::run_target $depport uninstall $optionslist]} {
+ set depname [$depport name]
+ set depver "[$depport version]_[$depport revision][$depport variants]"
+ registry_uninstall::uninstall $depname $depver $optionslist
}
}
- } else {
- # check its dependents
- registry::check_dependents $port ${uninstall.force} "uninstall"
}
- # if it's active, deactivate it
- if { [string equal [$port state] installed] } {
- if {[info exists options(ports_dryrun)] && [string is true -strict $options(ports_dryrun)]} {
- ui_msg "For $portname @${v}: skipping deactivate (dry run)"
- } else {
- if {[info exists options(ports_uninstall_no-exec)] || ![registry::run_target $port deactivate $optionslist]} {
- portimage::deactivate $portname $v [array get options]
- }
- }
- }
} else {
- # registry1.0
-
- # determine if it's the only installed port with that name or not.
- if {$v == ""} {
- set nb_versions_installed 1
+ # check its dependents
+ registry::check_dependents $port ${uninstall.force} "uninstall"
+ }
+ # if it's active, deactivate it
+ if { [string equal [$port state] installed] } {
+ if {[info exists options(ports_dryrun)] && [string is true -strict $options(ports_dryrun)]} {
+ ui_msg "For $portname @${v}: skipping deactivate (dry run)"
} else {
- set ilist [registry::installed $portname ""]
- set nb_versions_installed [llength $ilist]
- }
-
- set ref [registry::open_entry $portname $version $revision $variants]
-
- # Check and make sure no ports depend on this one
- registry::open_dep_map
- set deplist [registry::list_dependents $portname $version $revision $variants]
- if { [llength $deplist] > 0 } {
- set dl [list]
- # Check the deps first
- foreach dep $deplist {
- set depport [lindex $dep 2]
- ui_debug "$depport depends on this port"
- if {[registry::entry_exists_for_name $depport]} {
- lappend dl $depport
- }
+ if {[info exists options(ports_uninstall_no-exec)] || ![registry::run_target $port deactivate $optionslist]} {
+ portimage::deactivate $portname $v [array get options]
}
- # Now see if we need to error
- if { [llength $dl] > 0 } {
- if {[info exists options(ports_uninstall_follow-dependents)] && $options(ports_uninstall_follow-dependents) eq "yes"} {
- foreach depport $dl {
- # make sure it's still installed, since a previous dep uninstall may have removed it
- if {[registry::entry_exists_for_name $depport]} {
- registry_uninstall::uninstall $depport "" $optionslist
- }
- }
- } else {
- # will need to change this when we get version/variant dependencies
- if {$nb_versions_installed == 1 || $active == 1} {
- ui_msg "$UI_PREFIX [format [msgcat::mc "Unable to uninstall %s %s_%s%s, the following ports depend on it:"] $portname $version $revision $variants]"
- foreach depport $dl {
- ui_msg "$UI_PREFIX [format [msgcat::mc " %s"] $depport]"
- }
- if { [string is true -strict ${uninstall.force}] } {
- ui_warn "Uninstall forced. Proceeding despite dependencies."
- } else {
- return -code error "Please uninstall the ports that depend on $portname first."
- }
- }
- }
- }
}
-
- if { [registry::property_retrieve $ref active] == 1} {
- if {[info exists options(ports_dryrun)] && [string is true -strict $options(ports_dryrun)]} {
- ui_msg "For $portname @${version}_${revision}${variants}: skipping deactivate (dry run)"
- } else {
- portimage::deactivate $portname ${version}_${revision}${variants} $optionslist
- }
- }
}
- if {$use_reg2} {
- set ref $port
- }
+ set ref $port
# note deps before we uninstall if we're going to uninstall them too
if {[info exists options(ports_uninstall_follow-dependencies)] && [string is true -strict $options(ports_uninstall_follow-dependencies)]} {
set deptypes {depends_fetch depends_extract depends_build depends_lib depends_run}
set all_dependencies {}
# look up deps from the saved portfile if possible
- if {$use_reg2 && ![catch {set mport [mportopen_installed [$port name] [$port version] [$port revision] [$port variants] $optionslist]}]} {
+ if {![catch {set mport [mportopen_installed [$port name] [$port version] [$port revision] [$port variants] $optionslist]}]} {
array set depportinfo [mportinfo $mport]
mportclose_installed $mport
foreach type $deptypes {
@@ -276,32 +182,7 @@
ui_msg "For $portname @${v}: skipping uninstall (dry run)"
} else {
ui_msg "$UI_PREFIX [format [msgcat::mc "Uninstalling %s @%s"] $portname $v]"
-
- if {!$use_reg2} {
- # Look to see if the port has registered an uninstall procedure
- set uninstall [registry::property_retrieve $ref pkg_uninstall]
- if { $uninstall != 0 } {
- if {![catch {eval [string map { \\n \n } $uninstall]} err]} {
- ui_info "Executing pkg_uninstall procedure"
- if {[catch {pkg_uninstall $portname "${version}_${revision}${variants}" } err]} {
- ui_error [format [msgcat::mc "Error executing pkg_uninstall procedure: %s"] $err]
- }
- } else {
- global errorInfo
- ui_debug "$errorInfo"
- ui_error [format [msgcat::mc "Could not evaluate pkg_uninstall procedure: %s"] $err]
- }
- }
-
- # Remove the port from the dep_map if only one version was installed.
- # This is a temporary fix for a deeper problem that is that the dependency
- # map doesn't take the port version into account (but should).
- # Fixing it means transitioning to a new dependency map format.
- if {$nb_versions_installed == 1} {
- registry::unregister_dependencies $portname
- }
- }
-
+
# Get the full path to the image file
set imagefile [registry::property_retrieve $ref location]
file delete $imagefile
@@ -309,12 +190,7 @@
# files so just ignore the failure
catch {file delete [file dirname $imagefile]}
- if {$use_reg2} {
- registry::entry delete $port
- } else {
- ui_info "$UI_PREFIX [format [msgcat::mc "Uninstall is removing %s from the port registry."] $portname]"
- registry::delete_entry $ref
- }
+ registry::entry delete $port
}
# uninstall dependencies if requested
@@ -330,7 +206,7 @@
set ivariants [lindex $i 3]
if {[llength [registry::list_dependents $dep $iversion $irevision $ivariants]] == 0} {
set regref [registry::open_entry $dep $iversion $irevision $ivariants [lindex $i 5]]
- if {![registry::property_retrieve $regref requested] && (!$use_reg2 || [info exists options(ports_uninstall_no-exec)] || ![registry::run_target $regref uninstall $optionslist])} {
+ if {![registry::property_retrieve $regref requested] && ([info exists options(ports_uninstall_no-exec)] || ![registry::run_target $regref uninstall $optionslist])} {
set depver "${iversion}_${irevision}${ivariants}"
registry_uninstall::uninstall $dep $depver $optionslist
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20110531/8106e8db/attachment-0001.html>
More information about the macports-changes
mailing list