<pre style='margin:0'>
Joshua Root (jmroot) pushed a commit to branch master
in repository macports-base.
</pre>
<p><a href="https://github.com/macports/macports-base/commit/4df3e1c9f3f80dc05a0f6ca69f7fe585a27b8fd5">https://github.com/macports/macports-base/commit/4df3e1c9f3f80dc05a0f6ca69f7fe585a27b8fd5</a></p>
<pre style="white-space: pre; background: #F8F8F8">The following commit(s) were added to refs/heads/master by this push:
<span style='display:block; white-space:pre;color:#404040;'> new 4df3e1c9 Further adopt registry2 API
</span>4df3e1c9 is described below
<span style='display:block; white-space:pre;color:#808000;'>commit 4df3e1c9f3f80dc05a0f6ca69f7fe585a27b8fd5
</span>Author: Joshua Root <jmr@macports.org>
AuthorDate: Fri Jun 11 18:42:14 2021 +1000
<span style='display:block; white-space:pre;color:#404040;'> Further adopt registry2 API
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Marking where registry entries could be closed, but not actually doing
</span><span style='display:block; white-space:pre;color:#404040;'> it yet in most cases, because it's all too easy to close an entry that
</span><span style='display:block; white-space:pre;color:#404040;'> is still in use somewhere else. We may need some form of reference
</span><span style='display:block; white-space:pre;color:#404040;'> counting to make it safe to close entries in the general case.
</span>---
src/cxx_stdlib_overridden.tcl.in | 2 +
src/dedup_portfiles.tcl.in | 1 +
src/images_to_archives.tcl.in | 28 +++---
src/macports1.0/diagnose.tcl | 2 +
src/macports1.0/macports.tcl | 195 +++++++++++++++++++++++--------------
src/macports1.0/reclaim.tcl | 22 ++++-
src/registry2.0/portimage.tcl | 96 +++++++++++++-----
src/registry2.0/portuninstall.tcl | 61 ++++++++----
src/registry2.0/receipt_sqlite.tcl | 26 ++++-
src/registry2.0/registry_util.tcl | 13 ++-
10 files changed, 314 insertions(+), 132 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/cxx_stdlib_overridden.tcl.in b/src/cxx_stdlib_overridden.tcl.in
</span><span style='display:block; white-space:pre;color:#808080;'>index 1774947e..26e257a8 100755
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/cxx_stdlib_overridden.tcl.in
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/cxx_stdlib_overridden.tcl.in
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -39,10 +39,12 @@ foreach portname $known_ports {
</span> set binary_files {}
foreach filehandle [registry::file search id [$entry id] binary 1] {
lappend binary_files [$filehandle actual_path]
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ registry::file close $filehandle
</span> }
$entry cxx_stdlib [macports::get_actual_cxx_stdlib $binary_files]
$entry cxx_stdlib_overridden 1
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ registry::entry close $entry
</span> }
}
}
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/dedup_portfiles.tcl.in b/src/dedup_portfiles.tcl.in
</span><span style='display:block; white-space:pre;color:#808080;'>index 1982a6c0..8a239b9b 100755
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/dedup_portfiles.tcl.in
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/dedup_portfiles.tcl.in
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -36,6 +36,7 @@ if {[registry::metadata get portfiles_update_needed] == 1} {
</span>
$portref portfile $hash_size
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ registry::entry close $portref
</span> }
registry::metadata del portfiles_update_needed
}
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/images_to_archives.tcl.in b/src/images_to_archives.tcl.in
</span><span style='display:block; white-space:pre;color:#808080;'>index 86cc87c2..d28665ec 100755
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/images_to_archives.tcl.in
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/images_to_archives.tcl.in
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -19,7 +19,7 @@ mportinit ui_options
</span> set tarcmd [macports::findBinary tar ${macports::autoconf::tar_path}]
set bzip2cmd [macports::findBinary bzip2 ${macports::autoconf::bzip2_path}]
<span style='display:block; white-space:pre;background:#ffe0e0;'>-if {[catch {set ilist [registry::installed]}]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if {[catch {set ilist [registry::entry imaged]}]} {
</span> # no ports installed
puts "No ports installed to convert."
exit 0
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -35,17 +35,16 @@ set counter 0
</span>
foreach installed $ilist {
incr counter
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set iname [lindex $installed 0]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set iversion [lindex $installed 1]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set irevision [lindex $installed 2]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set ivariants [lindex $installed 3]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set iepoch [lindex $installed 5]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set iref [registry::open_entry $iname $iversion $irevision $ivariants $iepoch]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set installtype [registry::property_retrieve $iref installtype]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set iname [$installed name]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set iversion [$installed version]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set irevision [$installed revision]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set ivariants [$installed variants]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set iepoch [$installed epoch]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set installtype [$installed installtype]
</span> if {$installtype eq "image"} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set location [registry::property_retrieve $iref location]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set location [$installed location]
</span> if {$location == 0} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set location [registry::property_retrieve $iref imagedir]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set location [$installed imagedir]
</span> }
} else {
set location ""
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -53,7 +52,7 @@ foreach installed $ilist {
</span>
if {$location eq "" || ![file isfile $location]} {
# no image archive present, so make one
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set archs [registry::property_retrieve $iref archs]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set archs [$installed archs]
</span> if {$archs eq "" || $archs == 0} {
set archs ${macports::os_arch}
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -91,7 +90,7 @@ foreach installed $ilist {
</span> set targetdir [file join ${macports::registry.path} software ${iname}]
}
if {$location eq "" || ![file isdirectory $location]} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set contents [$iref imagefiles]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set contents [$installed imagefiles]
</span> }
file mkdir $targetdir
set newlocation [file join $targetdir $archivename]
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -114,7 +113,9 @@ foreach installed $ilist {
</span> file delete -force ${targetdir}/tarlist ${targetdir}/error.log
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- lappend archived_list [list $installtype $iref $location $newlocation]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ lappend archived_list [list $installtype $installed $location $newlocation]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ registry::entry close $installed
</span> }
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -139,6 +140,7 @@ registry::write {
</span>
# set the new location in the registry and delete the old dir
$iref location $newlocation
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ registry::entry close $iref
</span> }
}
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/macports1.0/diagnose.tcl b/src/macports1.0/diagnose.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index f53ea3da..6c98ca3a 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/macports1.0/diagnose.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/macports1.0/diagnose.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -369,6 +369,7 @@ namespace eval diagnose {
</span> set activeApps([$app name]) $files
incr totalFiles [llength $files]
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $app
</span> }
set fancyOutput [expr { ![macports::ui_isset ports_debug] \
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -440,6 +441,7 @@ namespace eval diagnose {
</span> if {![file exists [$port location]]} {
ui_warn "couldn't find the archive for '[$port name] @[$port version]_[$port revision][$port variants]'. Please uninstall and reinstall this port."
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $port
</span> }
}
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/macports1.0/macports.tcl b/src/macports1.0/macports.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index e9e0b800..457ba8f0 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/macports1.0/macports.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/macports1.0/macports.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -1982,11 +1982,16 @@ proc mportopen_installed {name version revision variants options} {
</span> set pgdirlist [list]
foreach pg [$regref groups_used] {
lappend pgdirlist [file join ${registry.path} registry portgroups [$pg sha256]-[$pg size]]
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ registry::portgroup close $pg
</span> }
if {$pgdirlist ne ""} {
set options_array(_portgroup_search_dirs) $pgdirlist
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Don't close as the reference is usually in use by the caller.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # (Maybe this proc should take a regref as input?)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $regref
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> set retmport [mportopen file://${portfile_dir}/ [array get options_array] $variations]
set workername [ditem_key $retmport workername]
foreach var {version revision variants} {
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -2092,21 +2097,27 @@ proc _mportinstalled {mport} {
</span> # Determine if a port is active
proc _mportactive {mport} {
set portname [ditem_key $mport provides]
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ set ret 0
</span> set reslist [registry::entry installed $portname]
if {$reslist ne {}} {
set i [lindex $reslist 0]
array set portinfo [mportinfo $mport]
if {[$i version] eq $portinfo(version) && [$i revision] == $portinfo(revision)
&& [$i variants] eq $portinfo(canonical_active_variants)} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- return 1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set ret 1
</span> }
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $i
</span> }
<span style='display:block; white-space:pre;background:#ffe0e0;'>- return 0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return $ret
</span> }
# Determine if the named port is active
proc _portnameactive {portname} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- return [expr {[registry::entry installed $portname] ne {}}]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set ilist [registry::entry installed $portname]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #foreach i $ilist {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # registry::entry close $i
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return [expr {$ilist ne {}}]
</span> }
### _mportispresent is private; may change without notice
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -3644,8 +3655,13 @@ proc macports::_active_supports_archs {portname required_archs} {
</span> if {$required_archs eq "noarch"} {
return 1
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[registry::entry installed $portname] eq ""} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set ilist [registry::entry installed $portname]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {$ilist eq ""} {
</span> return 0
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #foreach i $ilist {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # registry::entry close $i
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #}
</span> }
set provided_archs [_active_archs $portname]
if {$provided_archs eq "noarch" || $provided_archs eq ""} {
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -3666,6 +3682,7 @@ proc macports::_active_archs {portname} {
</span> if {[catch {$i archs} archs]} {
set archs {}
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #catch {registry::entry close $i}
</span> return $archs
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -3824,10 +3841,14 @@ proc macports::selfupdate {{optionslist {}} {updatestatusvar {}}} {
</span> # 3 = port not installed
proc macports::upgrade {portname dspec variationslist optionslist {depscachename {}}} {
# only installed ports can be upgraded
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[registry::entry imaged $portname] eq {}} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set ilist [registry::entry imaged $portname]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {$ilist eq {}} {
</span> ui_error "$portname is not installed"
return 3
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #foreach i $ilist {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # registry::entry close $i
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #}
</span> if {$depscachename ne ""} {
upvar $depscachename depscache
} else {
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -3902,7 +3923,7 @@ proc macports::_upgrade {portname dspec variationslist optionslist {depscachenam
</span> set options(subport) $portname
set ilist {}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[catch {set ilist [registry::installed $portname {}]} result]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[catch {set ilist [registry::entry imaged $portname]} result]} {
</span> if {$result eq "Registry error: $portname not registered as installed."} {
ui_debug "$portname is *not* installed by MacPorts"
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -3970,6 +3991,7 @@ proc macports::_upgrade {portname dspec variationslist optionslist {depscachenam
</span> # set version_in_tree and revision_in_tree
if {![info exists portinfo(version)]} {
ui_error "Invalid port entry for ${portname}, missing version"
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ _upgrade_cleanup
</span> return 1
}
set version_in_tree $portinfo(version)
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -3980,10 +4002,10 @@ proc macports::_upgrade {portname dspec variationslist optionslist {depscachenam
</span> set anyactive no
set version_installed {}
foreach i $ilist {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set variant [lindex $i 3]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set version [lindex $i 1]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set revision [lindex $i 2]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set epoch [lindex $i 5]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set variant [$i variants]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set version [$i version]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set revision [$i revision]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set epoch [$i epoch]
</span> if {$version_installed eq "" || ($epoch > $epoch_installed && $version ne $version_installed) ||
($epoch >= $epoch_installed && [vercmp $version $version_installed] > 0)
|| ($epoch >= $epoch_installed
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -3995,8 +4017,7 @@ proc macports::_upgrade {portname dspec variationslist optionslist {depscachenam
</span> set epoch_installed $epoch
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set isactive [lindex $i 4]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {$isactive == 1} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[$i state] eq "installed"} {
</span> set anyactive yes
set version_active $version
set revision_active $revision
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -4013,21 +4034,21 @@ proc macports::_upgrade {portname dspec variationslist optionslist {depscachenam
</span> ui_debug "$portname ${version_active}_$revision_active $variant_active is active"
# save existing variant for later use
set oldvariant $variant_active
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set regref [registry::open_entry $portname $version_active $revision_active $variant_active $epoch_active]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set regref [registry::entry open $portname $version_active $revision_active $variant_active $epoch_active]
</span> } else {
ui_debug "no version of $portname is active"
set oldvariant $variant_installed
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set regref [registry::open_entry $portname $version_installed $revision_installed $variant_installed $epoch_installed]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set regref [registry::entry open $portname $version_installed $revision_installed $variant_installed $epoch_installed]
</span> }
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set oldrequestedvariant [registry::property_retrieve $regref requested_variants]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set oldrequestedvariant [$regref requested_variants]
</span> if {$oldrequestedvariant == 0} {
set oldrequestedvariant {}
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set requestedflag [registry::property_retrieve $regref requested]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set os_platform_installed [registry::property_retrieve $regref os_platform]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set os_major_installed [registry::property_retrieve $regref os_major]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set cxx_stdlib_installed [registry::property_retrieve $regref cxx_stdlib]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set cxx_stdlib_overridden [registry::property_retrieve $regref cxx_stdlib_overridden]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set requestedflag [$regref requested]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set os_platform_installed [$regref os_platform]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set os_major_installed [$regref os_major]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set cxx_stdlib_installed [$regref cxx_stdlib]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set cxx_stdlib_overridden [$regref cxx_stdlib_overridden]
</span>
# Before we do
# dependencies, we need to figure out the final variants,
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -4094,10 +4115,12 @@ proc macports::_upgrade {portname dspec variationslist optionslist {depscachenam
</span> if {[catch {mportlookup $portinfo(replaced_by)} result]} {
ui_debug $::errorInfo
ui_error "port lookup failed: $result"
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ _upgrade_cleanup
</span> return 1
}
if {$result eq ""} {
ui_error "No port $portinfo(replaced_by) found."
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ _upgrade_cleanup
</span> return 1
}
array unset portinfo
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -4125,6 +4148,7 @@ proc macports::_upgrade {portname dspec variationslist optionslist {depscachenam
</span> if {[catch {set mport [mportopen $porturl [array get interp_options] [array get variations]]} result]} {
ui_debug $::errorInfo
ui_error "Unable to open port: $result"
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ _upgrade_cleanup
</span> return 1
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -4177,6 +4201,7 @@ proc macports::_upgrade {portname dspec variationslist optionslist {depscachenam
</span> if {[catch {set mport [mportopen $porturl [array get interp_options] [array get installedvariations]]} result]} {
ui_debug $::errorInfo
ui_error "Unable to open port: $result"
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ _upgrade_cleanup
</span> return 1
}
} else {
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -4203,7 +4228,7 @@ proc macports::_upgrade {portname dspec variationslist optionslist {depscachenam
</span> # the last arg is because we might have to build from source if a rebuild is being forced
set status [_upgrade_dependencies portinfo depscache variationslist options [expr {$will_build && $already_installed}]]
if {$status != 0 && $status != 2 && ![ui_isset ports_processall]} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- catch {mportclose $mport}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ _upgrade_cleanup
</span> return $status
}
} else {
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -4216,27 +4241,20 @@ proc macports::_upgrade {portname dspec variationslist optionslist {depscachenam
</span> # We do dependents ..
set options(ports_nodeps) 1
<span style='display:block; white-space:pre;background:#ffe0e0;'>- registry::open_dep_map
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {$anyactive} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set deplist [registry::list_dependents $portname $version_active $revision_active $variant_active]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- } else {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set deplist [registry::list_dependents $portname $version_installed $revision_installed $variant_installed]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set deplist [$regref dependents]
</span>
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[llength deplist] > 0} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- foreach dep $deplist {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set mpname [lindex $dep 2]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {![info exists depscache(port:$mpname)]} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set status [macports::_upgrade $mpname port:$mpname $variationslist [array get options] depscache]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {$status != 0 && $status != 2 && ![ui_isset ports_processall]} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- catch {mportclose $mport}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- return $status
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach dep $deplist {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set mpname [$dep name]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![info exists depscache(port:$mpname)]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set status [macports::_upgrade $mpname port:$mpname $variationslist [array get options] depscache]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {$status != 0 && $status != 2 && ![ui_isset ports_processall]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ _upgrade_cleanup
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return $status
</span> }
}
}
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- mportclose $mport
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ _upgrade_cleanup
</span> return 0
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -4258,7 +4276,7 @@ proc macports::_upgrade {portname dspec variationslist optionslist {depscachenam
</span> if {[info exists ::errorInfo]} {
ui_debug $::errorInfo
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- catch {mportclose $mport}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ _upgrade_cleanup
</span> return 1
}
# the following is a noop if archivefetch found an archive
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -4266,7 +4284,7 @@ proc macports::_upgrade {portname dspec variationslist optionslist {depscachenam
</span> if {[info exists ::errorInfo]} {
ui_debug $::errorInfo
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- catch {mportclose $mport}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ _upgrade_cleanup
</span> return 1
}
} else {
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -4276,7 +4294,7 @@ proc macports::_upgrade {portname dspec variationslist optionslist {depscachenam
</span> if {[info exists ::errorInfo]} {
ui_debug $::errorInfo
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- catch {mportclose $mport}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ _upgrade_cleanup
</span> return 1
}
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -4296,15 +4314,14 @@ proc macports::_upgrade {portname dspec variationslist optionslist {depscachenam
</span> # we have to force the uninstall in case of dependents
set force_cur [info exists options(ports_force)]
set options(ports_force) yes
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set existing_epoch [lindex [registry::installed $newname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants)] 0 5]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set newregref [registry::open_entry $newname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants) $existing_epoch]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set newregref [registry::entry open $newname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants) ""]
</span> if {$is_dryrun} {
ui_msg "Skipping uninstall $newname @${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) (dry run)"
} 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]} {
ui_debug $::errorInfo
ui_error "Uninstall $newname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) failed: $result"
<span style='display:block; white-space:pre;background:#ffe0e0;'>- catch {mportclose $mport}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ _upgrade_cleanup
</span> return 1
}
if {!$force_cur} {
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -4322,12 +4339,11 @@ proc macports::_upgrade {portname dspec variationslist optionslist {depscachenam
</span> set options(ports_force) yes
if {$is_dryrun} {
ui_msg "Skipping deactivate $portname @${version_active}_${revision_active}$variant_active (dry run)"
<span style='display:block; white-space:pre;background:#ffe0e0;'>- } elseif {![catch {registry::active $portname}] &&
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ![registry::run_target $regref deactivate [array get options]]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } elseif {![registry::run_target $regref deactivate [array get options]]
</span> && [catch {portimage::deactivate $portname $version_active $revision_active $variant_active [array get options]} result]} {
ui_debug $::errorInfo
ui_error "Deactivating $portname @${version_active}_${revision_active}$variant_active failed: $result"
<span style='display:block; white-space:pre;background:#ffe0e0;'>- catch {mportclose $mport}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ _upgrade_cleanup
</span> return 1
}
if {!$force_cur} {
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -4350,7 +4366,7 @@ proc macports::_upgrade {portname dspec variationslist optionslist {depscachenam
</span> if {[catch {mportexec $mport activate} result]} {
ui_debug $::errorInfo
ui_error "Couldn't activate $newname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants): $result"
<span style='display:block; white-space:pre;background:#ffe0e0;'>- catch {mportclose $mport}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ _upgrade_cleanup
</span> return 1
}
if {$loaded_startupitems ne ""} {
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -4368,27 +4384,23 @@ proc macports::_upgrade {portname dspec variationslist optionslist {depscachenam
</span> # We do dependents ..
set options(ports_nodeps) 1
<span style='display:block; white-space:pre;background:#ffe0e0;'>- registry::open_dep_map
</span> if {$portname ne $newname} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set deplist [registry::list_dependents $newname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants)]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![info exists newregref]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set newregref [registry::entry open $newname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants) ""]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set deplist [$newregref dependents]
</span> } else {
set deplist [list]
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {$anyactive} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set deplist [concat $deplist [registry::list_dependents $portname $version_active $revision_active $variant_active]]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- } else {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set deplist [concat $deplist [registry::list_dependents $portname $version_installed $revision_installed $variant_installed]]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set deplist [concat $deplist [$regref dependents]]
</span>
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[llength deplist] > 0} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- foreach dep $deplist {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set mpname [lindex $dep 2]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {![info exists depscache(port:$mpname)]} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set status [macports::_upgrade $mpname port:$mpname $variationslist [array get options] depscache]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {$status != 0 && $status != 2 && ![ui_isset ports_processall]} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- catch {mportclose $mport}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- return $status
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach dep $deplist {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set mpname [$dep name]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![info exists depscache(port:$mpname)]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set status [macports::_upgrade $mpname port:$mpname $variationslist [array get options] depscache]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {$status != 0 && $status != 2 && ![ui_isset ports_processall]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ _upgrade_cleanup
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return $status
</span> }
}
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -4396,35 +4408,59 @@ proc macports::_upgrade {portname dspec variationslist optionslist {depscachenam
</span>
if {[info exists uninstall_later] && $uninstall_later} {
foreach i $ilist {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set version [lindex $i 1]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set revision [lindex $i 2]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set variant [lindex $i 3]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set version [$i version]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set revision [$i revision]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set variant [$i variants]
</span> if {$version eq $version_in_tree && $revision == $revision_in_tree && $variant eq $portinfo(canonical_active_variants) && $portname eq $newname} {
continue
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set epoch [lindex $i 5]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set epoch [$i epoch]
</span> ui_debug "Uninstalling $portname ${version}_${revision}$variant"
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set regref [registry::open_entry $portname $version $revision $variant $epoch]
</span> if {$is_dryrun} {
ui_msg "Skipping uninstall $portname @${version}_${revision}$variant (dry run)"
<span style='display:block; white-space:pre;background:#ffe0e0;'>- } elseif {![registry::run_target $regref uninstall $optionslist]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } elseif {![registry::run_target $i uninstall $optionslist]
</span> && [catch {registry_uninstall::uninstall $portname $version $revision $variant $optionslist} result]} {
ui_debug $::errorInfo
# replaced_by can mean that we try to uninstall all versions of the old port, so handle errors due to dependents
if {$result ne "Please uninstall the ports that depend on $portname first." && ![ui_isset ports_processall]} {
ui_error "Uninstall $portname @${version}_${revision}$variant failed: $result"
<span style='display:block; white-space:pre;background:#ffe0e0;'>- catch {mportclose $mport}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ _upgrade_cleanup
</span> return 1
}
}
}
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- # close the port handle
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- mportclose $mport
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ _upgrade_cleanup
</span> return 0
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+# _upgrade calls this to clean up before returning
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+proc macports::_upgrade_cleanup {} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #upvar ilist ilist regref regref newregref newregref \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # deplist deplist
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ upvar mport mport
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[info exists mport]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ catch {mportclose $mport}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #if {[info exists ilist]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # foreach i $ilist {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # catch {registry::entry close $i}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #if {[info exists regref]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # catch {registry::entry close $regref}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #if {[info exists newregref]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # catch {registry::entry close $newregref}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #if {[info exists deplist]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # foreach i $deplist {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # catch {registry::entry close $i}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> # upgrade_dependencies: helper proc for upgrade
# Calls upgrade on each dependency listed in the PortInfo.
# Uses upvar to access the variables.
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -4836,6 +4872,10 @@ proc macports::revupgrade_update_binary {fancy_output {revupgrade_progress ""}}
</span> }
ui_error "Updating database of binaries failed"
throw
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ } finally {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach f $files {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ registry::file close $f
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span> }
}
if {$fancy_output} {
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -4877,6 +4917,7 @@ proc macports::revupgrade_update_cxx_stdlib {fancy_output {revupgrade_progress "
</span> $maybe_port cxx_stdlib_overridden 0
}
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $maybe_port
</span> }
if {$fancy_output} {
$revupgrade_progress finish
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -5121,6 +5162,10 @@ proc macports::revupgrade_scanandrebuild {broken_port_counts_name opts} {
</span> $revupgrade_progress intermission
}
throw
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ } finally {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach b $binaries {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ registry::file close $b
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span> }
if {$fancy_output} {
$revupgrade_progress finish
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -5177,6 +5222,7 @@ proc macports::revupgrade_scanandrebuild {broken_port_counts_name opts} {
</span> if {[llength $result] >= 2} {
lappend temp_broken_ports $port
} else {
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $port
</span> ui_warn "No port $portname found in the index; can't rebuild"
}
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -5231,6 +5277,7 @@ proc macports::revupgrade_scanandrebuild {broken_port_counts_name opts} {
</span> } else {
ui_msg " (cxx_stdlib mismatch)"
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $port
</span> }
return 0
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -5322,6 +5369,9 @@ proc macports::revupgrade_scanandrebuild {broken_port_counts_name opts} {
</span> set retvalue [$macports::ui_options(questions_yesno) "The following ports will be rebuilt:" "TestCase#1" $broken_portnames {y} 0]
if {$retvalue == 1} {
# quit as user answered 'no'
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #foreach p $topsort_ports {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # registry::entry close $p
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #}
</span> return 0
}
unset macports::ui_options(questions_yesno)
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -5355,6 +5405,7 @@ proc macports::revupgrade_scanandrebuild {broken_port_counts_name opts} {
</span> error "Error rebuilding $portname"
}
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $port
</span> }
if {[info exists options(ports_dryrun)] && $options(ports_dryrun)} {
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/macports1.0/reclaim.tcl b/src/macports1.0/reclaim.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index f06566cc..8fd21859 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/macports1.0/reclaim.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/macports1.0/reclaim.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -258,6 +258,7 @@ namespace eval reclaim {
</span> } catch {{*} eCode eMessage} {
$progress intermission
ui_warn [msgcat::mc "Failed to open port %s from registry: %s" [$port name] $eMessage]
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $port
</span> continue
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -291,6 +292,7 @@ namespace eval reclaim {
</span> mportclose $mport
$progress update $i $port_count
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $port
</span> incr i
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -539,6 +541,8 @@ namespace eval reclaim {
</span> if {[$port state] eq "imaged"} {
lappend inactive_ports $port
incr inactive_count
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $port
</span> }
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -570,6 +574,10 @@ namespace eval reclaim {
</span> } else {
ui_msg "Not uninstalling ports."
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach port $inactive_ports {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # may have been uninstalled and thus already closed
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #catch {registry::entry close $port}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span> }
return 0
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -598,7 +606,8 @@ namespace eval reclaim {
</span> set isrequested($portname) [$port requested]
}
if {$isrequested($portname) == 0} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- foreach dependent [$port dependents] {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set dependents [$port dependents]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach dependent $dependents {
</span> set dname [$dependent name]
if {![info exists isrequested($dname)]} {
ui_debug "$portname appears to have a circular dependency involving $dname"
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -610,11 +619,16 @@ namespace eval reclaim {
</span> break
}
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #foreach dependent $dependents {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # registry::entry close $dependent
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #}
</span>
if {$isrequested($portname) == 0} {
lappend unnecessary_ports $port
lappend unnecessary_names "$portname @[$port version]_[$port revision][$port variants]"
incr unnecessary_count
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $port
</span> }
}
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -640,7 +654,11 @@ namespace eval reclaim {
</span> }
}
} else {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_msg "Not uninstalling ports; use 'port setrequested' mark a port as explicitly requested."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_msg "Not uninstalling ports; use 'port setrequested' to mark a port as explicitly requested."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach port $unnecessary_ports {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # may have been uninstalled and thus already closed
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #catch {registry::entry close $port}
</span> }
}
return 0
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/registry2.0/portimage.tcl b/src/registry2.0/portimage.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index 31a05be9..70b79aae 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/registry2.0/portimage.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/registry2.0/portimage.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -111,34 +111,48 @@ proc activate {name {version ""} {revision ""} {variants 0} {optionslist ""}} {
</span>
if {[$requested state] eq "installed"} {
ui_info "${name} @${specifier} is already active."
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $requested
</span> return
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- # if another version of this port is active, deactivate it first
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set current [registry::entry installed $name]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- foreach i $current {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if { $specifier ne "[$i version]_[$i revision][$i variants]" } {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- lappend todeactivate $i
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span> # this shouldn't be possible
if { [$requested installtype] ne "image" } {
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $requested
</span> return -code error "Image error: ${name} @${specifier} not installed as an image."
}
if {![::file isfile $location]} {
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $requested
</span> return -code error "Image error: Can't find image file $location"
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- foreach a $todeactivate {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {$noexec || ![registry::run_target $a deactivate [list ports_nodepcheck 1]]} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- deactivate $name [$a version] [$a revision] [$a variants] [list ports_nodepcheck 1]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # if another version of this port is active, deactivate it first
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set current [registry::entry installed $name]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach i $current {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if { $specifier ne "[$i version]_[$i revision][$i variants]" } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ lappend todeactivate $i
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $i
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span> }
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_msg "$UI_PREFIX [format [msgcat::mc "Activating %s @%s"] $name $specifier]"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ try {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach a $todeactivate {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {$noexec || ![registry::run_target $a deactivate [list ports_nodepcheck 1]]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ deactivate $name [$a version] [$a revision] [$a variants] [list ports_nodepcheck 1]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_msg "$UI_PREFIX [format [msgcat::mc "Activating %s @%s"] $name $specifier]"
</span>
<span style='display:block; white-space:pre;background:#ffe0e0;'>- _activate_contents $requested $rename_list
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ _activate_contents $requested $rename_list
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } finally {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $requested
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach a $todeactivate {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # may have been closed by deactivate
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #catch {registry::entry close $a}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span> }
# takes a composite version spec rather than separate version,revision,variants
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -178,6 +192,9 @@ proc deactivate {name {version ""} {revision ""} {variants 0} {optionslist ""}}
</span> set ilist [_check_registry $name $version $revision $variants 1]
if {[llength $ilist] > 0} {
ui_info "port ${name} is already inactive"
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #foreach i $ilist {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # registry::entry close $i
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #}
</span> return
} else {
set v ""
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -209,30 +226,45 @@ proc deactivate {name {version ""} {revision ""} {variants 0} {optionslist ""}}
</span> }
if {$v eq $thisv} {
ui_info "port ${name} @${thisv} is already inactive"
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $requested
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #foreach inact $ilist {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # registry::entry close $inact
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #}
</span> return
}
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $requested
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #foreach inact $ilist {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # registry::entry close $inact
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #}
</span> return -code error "Active version of $name is not $v but ${specifier}."
}
if { [$requested installtype] ne "image" } {
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $requested
</span> return -code error "Image error: ${name} @${specifier} not installed as an image."
}
# this shouldn't be possible
if { [$requested state] ne "installed" } {
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $requested
</span> return -code error "Image error: ${name} @${specifier} is not active."
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> if {![info exists options(ports_nodepcheck)] || ![string is true -strict $options(ports_nodepcheck)]} {
set retvalue [registry::check_dependents $requested $force "deactivate"]
if {$retvalue eq "quit"} {
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $requested
</span> return
}
}
ui_msg "$UI_PREFIX [format [msgcat::mc "Deactivating %s @%s"] $name $specifier]"
<span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- _deactivate_contents $requested [$requested files] $force
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ try {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ _deactivate_contents $requested [$requested files] $force
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } finally {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $requested
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span> }
proc _check_registry {name version revision variants {return_all 0}} {
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -274,9 +306,18 @@ proc _check_registry {name version revision variants {return_all 0}} {
</span> }
}
if {[info exists macports::ui_options(questions_singlechoice)]} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set retvalue [$macports::ui_options(questions_singlechoice) $msg "Choice_Q1" $portilist]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- return [lindex $ilist $retvalue]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set retindex [$macports::ui_options(questions_singlechoice) $msg "Choice_Q1" $portilist]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set retvalue [lindex $ilist $retindex]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #foreach i $ilist {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # if {$i ne $retvalue} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # registry::entry close $i
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return $retvalue
</span> }
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #foreach i $ilist {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # registry::entry close $i
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #}
</span> throw registry::invalid "Registry error: Please specify the full version as recorded in the port registry."
} elseif { [llength $ilist] == 1 } {
return [lindex $ilist 0]
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -553,11 +594,17 @@ proc _activate_contents {port {rename_list {}}} {
</span> # we find any files that already exist, or have entries in
# the registry
if { $owner ne {} && $owner ne $port } {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- 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."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set msg "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."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $owner
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ throw registry::image-error $msg
</span> } elseif { $owner eq {} && ![catch {::file type $file}] } {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- 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."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set msg "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."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ throw registry::image-error $msg
</span> }
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #if {$owner ne {}} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # registry::entry close $owner
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #}
</span> }
# Split out the filename's subpaths and add them to the
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -680,11 +727,14 @@ proc _activate_contents {port {rename_list {}}} {
</span> signal set $osignals
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ throw
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } finally {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #foreach entry [array names todeactivate] {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # registry::entry close $entry
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #}
</span> # remove temp image dir
::file delete -force $extracted_dir
<span style='display:block; white-space:pre;background:#ffe0e0;'>- throw
</span> }
<span style='display:block; white-space:pre;background:#ffe0e0;'>- ::file delete -force $extracted_dir
</span> }
# These directories should not be removed during deactivation even if they are empty.
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/registry2.0/portuninstall.tcl b/src/registry2.0/portuninstall.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index 638f3d06..624ed81b 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/registry2.0/portuninstall.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/registry2.0/portuninstall.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -59,14 +59,15 @@ proc generate_deplist {port {optslist ""}} {
</span> # append those from the registry (could be different because of path deps)
foreach dep [$port dependencies] {
lappend all_dependencies [$dep name]
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $dep
</span> }
} else {
# grab the deps from the dep map
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set portname [$port name]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set depmaplist [registry::list_depends $portname [$port version] [$port revision] [$port variants]]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- foreach dep $depmaplist {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- lappend all_dependencies [lindex $dep 0]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach dep [$port dependencies] {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ lappend all_dependencies [$dep name]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $dep
</span> }
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ set portname [$port name]
</span> # and the ones from the current portfile
if {![catch {mportlookup $portname} result] && [llength $result] >= 2} {
array set depportinfo [lindex $result 1]
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -174,8 +175,14 @@ proc uninstall {portname {version ""} {revision ""} {variants 0} {optionslist ""
</span> set uport [lindex $sortedlist $index]
uninstall [$uport name] [$uport version] [$uport revision] [$uport variants]
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #foreach i $ilist {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # registry::entry close $i
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #}
</span> return 0
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #foreach i $ilist {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # registry::entry close $i
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #}
</span> throw registry::invalid "Registry error: Please specify the full version as recorded in the port registry."
} elseif { [llength $ilist] == 1 } {
set port [lindex $ilist 0]
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -206,6 +213,7 @@ proc uninstall {portname {version ""} {revision ""} {variants 0} {optionslist ""
</span> registry_uninstall::uninstall [$depport name] [$depport version] [$depport revision] [$depport variants] $optionslist
}
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #catch {registry::entry close $depport}
</span> }
if {[info exists orig_follow_dependencies]} {
set options(ports_uninstall_follow-dependencies) $orig_follow_dependencies
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -215,6 +223,7 @@ proc uninstall {portname {version ""} {revision ""} {variants 0} {optionslist ""
</span> # check its dependents
set userinput [registry::check_dependents $port ${uninstall.force} "uninstall"]
if {$userinput eq "quit"} {
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $port
</span> return 0
}
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -252,20 +261,20 @@ proc uninstall {portname {version ""} {revision ""} {variants 0} {optionslist ""
</span> ui_msg "$UI_PREFIX [format [msgcat::mc "Uninstalling %s @%s"] $portname $composite_spec]"
# Get the full path to the image file
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set ref $port
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set imagefile [registry::property_retrieve $ref location]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set imagefile [$port location]
</span> file delete $imagefile
# Try to delete the port's image dir; will fail if there are more image
# files so just ignore the failure
catch {file delete [::file dirname $imagefile]}
# We want to delete the portfile if not referenced by any other ports
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set portfile [$ref portfile]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set portfile [$port portfile]
</span>
# and likewise the portgroups
set portgroups [list]
<span style='display:block; white-space:pre;background:#ffe0e0;'>- foreach pg [$ref groups_used] {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach pg [$port groups_used] {
</span> lappend portgroups [list [$pg name] [$pg version] [$pg size] [$pg sha256]]
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ registry::portgroup close $pg
</span> }
registry::write {
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -273,10 +282,14 @@ proc uninstall {portname {version ""} {revision ""} {variants 0} {optionslist ""
</span> }
set portfile_path [file join ${registry.path} registry portfiles ${portname}-${version}_${revision} $portfile]
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[registry::entry search portfile $portfile name $portname version $version revision $revision] eq {}} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set other_entries [registry::entry search portfile $portfile name $portname version $version revision $revision]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {$other_entries eq {}} {
</span> file delete -force $portfile_path
catch {file delete [file dirname $portfile_path]}
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #foreach e $other_entries {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # registry::entry close $e
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #}
</span>
set reg_portgroups_dir [file join ${registry.path} registry portgroups]
foreach pg $portgroups {
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -284,11 +297,15 @@ proc uninstall {portname {version ""} {revision ""} {variants 0} {optionslist ""
</span> set pgversion [lindex $pg 1]
set pgsize [lindex $pg 2]
set pgsha256 [lindex $pg 3]
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[registry::portgroup search name $pgname version $pgversion size $pgsize sha256 $pgsha256] eq {}} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set other_pgs [registry::portgroup search name $pgname version $pgversion size $pgsize sha256 $pgsha256]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {$other_pgs eq {}} {
</span> set pg_reg_dir [file join $reg_portgroups_dir ${pgsha256}-${pgsize}]
file delete -force ${pg_reg_dir}/${pgname}-${pgversion}.tcl
catch {file delete $pg_reg_dir}
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach p $other_pgs {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ registry::portgroup close $p
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span> }
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -302,27 +319,31 @@ proc uninstall {portname {version ""} {revision ""} {variants 0} {optionslist ""
</span> for {set j 0} {$j < [llength $alldeps]} {incr j} {
set dep [lindex $alldeps $j]
set uninstalling_this_dep 0
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {![catch {set ilist [registry::installed $dep]}]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![catch {set ilist [registry::entry imaged $dep]}]} {
</span> foreach i $ilist {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- lassign $i dep iversion irevision ivariants
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[list $dep $iversion $irevision $ivariants] in $uports} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[list [$i name] [$i version] [$i revision] [$i variants]] in $uports} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $i
</span> continue
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set regref [registry::open_entry $dep $iversion $irevision $ivariants [lindex $i 5]]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {![registry::property_retrieve $regref requested]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![$i requested]} {
</span> set all_dependents_uninstalling 1
<span style='display:block; white-space:pre;background:#ffe0e0;'>- foreach depdt [$regref dependents] {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set depdts [$i dependents]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach depdt $depdts {
</span> if {[list [$depdt name] [$depdt version] [$depdt revision] [$depdt variants]] ni $uports} {
set all_dependents_uninstalling 0
break
}
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #foreach depdt $depdts {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # registry::entry close $depdt
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #}
</span> if {$all_dependents_uninstalling} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- lappend uports [list $dep $iversion $irevision $ivariants]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- lappend portilist $dep@${iversion}_${irevision}${ivariants}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ lappend uports [list [$i name] [$i version] [$i revision] [$i variants]]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ lappend portilist [$i name]@[$i version]_[$i revision][$i variants]
</span> set uninstalling_this_dep 1
}
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $i
</span> }
}
if {$uninstalling_this_dep} {
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -334,6 +355,7 @@ proc uninstall {portname {version ""} {revision ""} {variants 0} {optionslist ""
</span> lappend alldeps $d
}
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $depref
</span> }
}
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -348,7 +370,7 @@ proc uninstall {portname {version ""} {revision ""} {variants 0} {optionslist ""
</span> # uninstall all dependencies in order from uports
foreach dp $uports {
lassign $dp iname iversion irevision ivariants
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {![catch {registry::open_entry $iname $iversion $irevision $ivariants ""} regref]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![catch {registry::entry open $iname $iversion $irevision $ivariants ""} regref]} {
</span> if {[info exists options(ports_dryrun)] && [string is true -strict $options(ports_dryrun)]} {
if {$iname ne $portname} {
ui_msg "For $iname @${iversion}_${irevision}${ivariants}: skipping uninstall (dry run)"
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -358,6 +380,7 @@ proc uninstall {portname {version ""} {revision ""} {variants 0} {optionslist ""
</span> registry_uninstall::uninstall $iname $iversion $irevision $ivariants [array get options]
}
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $regref
</span> }
}
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/registry2.0/receipt_sqlite.tcl b/src/registry2.0/receipt_sqlite.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index 4541e9d0..74f9a47f 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/registry2.0/receipt_sqlite.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/registry2.0/receipt_sqlite.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -59,6 +59,7 @@ proc active {name} {
</span> set rlist [list]
foreach port $ports {
lappend rlist [list [$port name] [$port version] [$port revision] [$port variants] [string equal [$port state] "installed"] [$port epoch]]
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $port
</span> }
return $rlist
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -99,6 +100,9 @@ proc open_entry {name version revision variants epoch} {
</span> # @return 1, if the port exists, 0 otherwise.
proc entry_exists {name version {revision 0} {variants ""}} {
if {![catch {set ports [registry::entry search name $name version $version revision $revision variants $variants]}] && [llength $ports] > 0} {
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #foreach port $ports {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # registry::entry close $port
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #}
</span> return 1
}
return 0
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -112,6 +116,9 @@ proc entry_exists {name version {revision 0} {variants ""}} {
</span> # @return 1 if a port with the given name exists in the registry, 0 otherwise.
proc entry_exists_for_name {name} {
if {![catch {set ports [registry::entry search name $name]}] && [llength $ports] > 0} {
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #foreach port $ports {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # registry::entry close $port
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #}
</span> return 1
}
return 0
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -130,7 +137,9 @@ proc entry_exists_for_name {name} {
</span> proc file_registered {file cs} {
set port [registry::entry owner $file $cs]
if {$port ne ""} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- return [$port name]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set ret [$port name]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $port
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return $ret
</span> } else {
return 0
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -150,8 +159,13 @@ proc port_registered {name} {
</span> if {![catch {set ports [registry::entry installed $name]}] && [llength $ports] > 0} {
# should never return more than one port
set port [lindex $ports 0]
<span style='display:block; white-space:pre;background:#ffe0e0;'>- return [$port files]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set ret [$port files]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $port
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return $ret
</span> } elseif {![catch {set ports [registry::entry imaged $name]}] && [llength $ports] > 0} {
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #foreach port $ports {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # registry::entry close $port
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #}
</span> return ""
} else {
return 0
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -236,6 +250,8 @@ proc installed {{name ""} {version ""}} {
</span> foreach p $possible_ports {
if {"[$p version]_[$p revision][$p variants]" eq $version || [$p version] eq $version} {
lappend ports $p
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $p
</span> }
}
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -243,6 +259,7 @@ proc installed {{name ""} {version ""}} {
</span> set rlist [list]
foreach port $ports {
lappend rlist [list [$port name] [$port version] [$port revision] [$port variants] [string equal [$port state] "installed"] [$port epoch]]
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $port
</span> }
return $rlist
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -291,7 +308,9 @@ proc list_depends {name version revision variants} {
</span> foreach port $ports {
foreach dep [$port dependencies] {
lappend rlist [list [$dep name] port [$port name]]
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $dep
</span> }
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $port
</span> }
return [lsort -unique $rlist]
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -334,7 +353,9 @@ proc list_dependents {name version revision variants} {
</span> set dependents [$port dependents]
foreach dependent $dependents {
lappend rlist [list [$port name] port [$dependent name]]
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $dependent
</span> }
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $port
</span> }
return [lsort -unique $rlist]
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -407,6 +428,7 @@ proc create_entry_l {proplist} {
</span> }
$regref portfile $props(portfile)
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $regref
</span> }
# End of receipt_sqlite namespace
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/registry2.0/registry_util.tcl b/src/registry2.0/registry_util.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index 5aca79c7..35c9d517 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/registry2.0/registry_util.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/registry2.0/registry_util.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -62,7 +62,14 @@ proc decode_spec {specifier version revision variants} {
</span> ## @param [in] force if true, continue even if there are dependents
proc check_dependents {port force {action "uninstall/deactivate"}} {
global UI_PREFIX
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[$port state] eq "installed" || [llength [registry::entry imaged [$port name]]] == 1} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set imaged [registry::entry imaged [$port name]]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set imaged_len [llength $imaged]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #foreach i $imaged {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # if {$i ne $port} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # registry::entry close $i
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[$port state] eq "installed" || $imaged_len == 1} {
</span> # Check if any installed ports depend on this one
set deplist [$port dependents]
if {$action eq "deactivate"} {
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -71,6 +78,8 @@ proc check_dependents {port force {action "uninstall/deactivate"}} {
</span> foreach p $deplist {
if {[$p state] eq "installed"} {
lappend active_deplist $p
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $p
</span> }
}
set deplist $active_deplist
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -82,6 +91,7 @@ proc check_dependents {port force {action "uninstall/deactivate"}} {
</span> set portulist [list]
foreach depport $deplist {
lappend portulist [$depport name]@[$depport version]_[$depport revision]
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $depport
</span> }
ui_msg "Note: It is not recommended to uninstall/deactivate a port that has dependents as it breaks the dependents."
set retvalue [$macports::ui_options(questions_yesno) "The following ports will break:" "breakDeps" $portulist {n} 0]
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -94,6 +104,7 @@ proc check_dependents {port force {action "uninstall/deactivate"}} {
</span> ui_msg "$UI_PREFIX [format [msgcat::mc "Unable to %s %s @%s_%s%s, the following ports depend on it:"] $action [$port name] [$port version] [$port revision] [$port variants]]"
foreach depport $deplist {
ui_msg "$UI_PREFIX [format [msgcat::mc " %s @%s_%s%s"] [$depport name] [$depport version] [$depport revision] [$depport variants]]"
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ #registry::entry close $depport
</span> }
}
if { [string is true -strict $force] } {
</pre><pre style='margin:0'>
</pre>