<pre style='margin:0'>
Chris Jones (cjones051073) pushed a commit to branch master
in repository macports-ports.
</pre>
<p><a href="https://github.com/macports/macports-ports/commit/4f6cb222e34512f1aea93586f7989c9bbc07c647">https://github.com/macports/macports-ports/commit/4f6cb222e34512f1aea93586f7989c9bbc07c647</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 4f6cb222e34 java PG: handle (rare) scenario when multiple installations of the same JVM version are available
</span>4f6cb222e34 is described below
<span style='display:block; white-space:pre;color:#808000;'>commit 4f6cb222e34512f1aea93586f7989c9bbc07c647
</span>Author: Chris Jones <jonesc@macports.org>
AuthorDate: Tue May 2 15:34:20 2023 +0100
<span style='display:block; white-space:pre;color:#404040;'> java PG: handle (rare) scenario when multiple installations of the same JVM version are available
</span>---
_resources/port1.0/group/java-1.0.tcl | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/_resources/port1.0/group/java-1.0.tcl b/_resources/port1.0/group/java-1.0.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index d2c36dca0e4..e12afbeb0c6 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/_resources/port1.0/group/java-1.0.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/_resources/port1.0/group/java-1.0.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -179,6 +179,7 @@ namespace eval java {
</span> # %3=0 -> Regex match, ignored.
# %3=1 -> Version
# %3=2 -> JAVA_HOME.
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ set version_path_dict {}
</span> for {set idx 0} {$idx < [llength $vm_versions]} {incr idx 3} {
set vers [lindex $vm_versions $idx+1]
# Normalize version 1.x -> x
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -186,7 +187,15 @@ namespace eval java {
</span> # Extract major version
set vers [regsub {(\.\d+)+} $vers ""]
set path [lindex $vm_versions $idx+2]
<span style='display:block; white-space:pre;background:#ffe0e0;'>- dict append version_path_dict $vers $path
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Note, using [dict set ...] here instead of [dict append ...] to handle scenario the
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # system could have multiple installations of the JVM for exactly the same version.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # See e.g. https://github.com/macports/macports-ports/pull/16149
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # where it was found this could happen with the CI tests.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # By using 'dict set' instead you get the last value encountered...
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if { [dict exists $version_path_dict $vers] } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_warn "java-portgroup: Found multiple installations for JVM $vers"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ dict set version_path_dict $vers $path
</span> }
} else {
set details [dict get $options -errorcode]
</pre><pre style='margin:0'>
</pre>