commit:     633fc2622b79f113ea9270f78954198fe7183ebd
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 28 21:46:43 2017 +0000
Commit:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Tue Jan  2 22:54:55 2018 +0000
URL:        https://gitweb.gentoo.org/proj/eselect-java.git/commit/?id=633fc262

Sort java-vm targets in version order rather than alphanumeric

Java 10 may be around the corner.

 NEWS                           | 1 +
 src/modules/java-vm.eselect.in | 9 ++++++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/NEWS b/NEWS
index 3faaf11..a0102aa 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@
 
     * Don't emit (unset) or (not a symlink) on stderr (#549498)
     * Fix mkdir die message in java-vm module
+    * Sort java-vm targets in version order rather than alphanumeric
 
 0.3.0:
 

diff --git a/src/modules/java-vm.eselect.in b/src/modules/java-vm.eselect.in
index 3d5de4d..917b4d0 100644
--- a/src/modules/java-vm.eselect.in
+++ b/src/modules/java-vm.eselect.in
@@ -12,10 +12,13 @@ 
VM_USER="${HOME}/.gentoo${EPREFIX}/java-config-2/current-user-vm"
 VM_CONFIG="${EROOT}/usr/share/java-config-2/vm"
 
 find_targets() {
-       local f
-       for f in ${VM_BASE}/* ; do
-               [[ -L ${f} ]] && echo $(basename ${f})
+       local TARGETS=() target
+
+       for target in "${VM_BASE}"/*; do
+               [[ -L "${target}" ]] && TARGETS+=( ${target##*/} )
        done
+
+       printf "%s\n" "${TARGETS[@]}" | sort -uV
 }
 
 sym_to_vm() {

Reply via email to