public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/eselect-java:master commit in: src/modules/, /
@ 2018-01-03 22:51 James Le Cuirot
  0 siblings, 0 replies; 6+ messages in thread
From: James Le Cuirot @ 2018-01-03 22:51 UTC (permalink / raw
  To: gentoo-commits

commit:     60ae07aea7854d30bb44107733ed34c2846b2663
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 23 18:56:21 2017 +0000
Commit:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Thu Dec 28 21:38:02 2017 +0000
URL:        https://gitweb.gentoo.org/proj/eselect-java.git/commit/?id=60ae07ae

Don't emit (unset) or (not a symlink) on stderr (bug #549498)

 NEWS                         | 4 ++++
 src/modules/ecj.eselect.in   | 6 +++---
 src/modules/maven.eselect.in | 6 +++---
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/NEWS b/NEWS
index cb1a799..669548f 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+0.4.0:
+
+    * Don't emit (unset) or (not a symlink) on stderr (#549498)
+
 0.3.0:
 
     * run-java-tool.bash.in: fix shellcheck issues

diff --git a/src/modules/ecj.eselect.in b/src/modules/ecj.eselect.in
index f9d5057..7b6d784 100644
--- a/src/modules/ecj.eselect.in
+++ b/src/modules/ecj.eselect.in
@@ -1,5 +1,5 @@
 # -*-eselect-*-  vim: ft=eselect
-# Copyright 1999-2012 Gentoo Foundation
+# Copyright 1999-2017 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 DESCRIPTION="Manage ECJ targets"
@@ -57,10 +57,10 @@ do_show() {
 		get_target
 		return 0
 	elif [[ -e "${ECJ}" ]] ; then
-		echo "(not a symlink)" >&2
+		echo "(not a symlink)"
 		return 1
 	else
-		echo "(unset)" >&2
+		echo "(unset)"
 		return 1
 	fi
 }

diff --git a/src/modules/maven.eselect.in b/src/modules/maven.eselect.in
index 976e02c..f0cf2e4 100644
--- a/src/modules/maven.eselect.in
+++ b/src/modules/maven.eselect.in
@@ -1,5 +1,5 @@
 # -*-eselect-*-  vim: ft=eselect
-# Copyright 1999-2012 Gentoo Foundation
+# Copyright 1999-2017 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 DESCRIPTION="Manage Maven targets"
@@ -67,10 +67,10 @@ do_show() {
 		get_target
 		return 0
 	elif [[ -e "${MVN}" ]] ; then
-		echo "(not a symlink)" >&2
+		echo "(not a symlink)"
 		return 1
 	else
-		echo "(unset)" >&2
+		echo "(unset)"
 		return 1
 	fi
 }


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] proj/eselect-java:master commit in: src/modules/, /
@ 2018-01-03 22:51 James Le Cuirot
  0 siblings, 0 replies; 6+ messages in thread
From: James Le Cuirot @ 2018-01-03 22:51 UTC (permalink / raw
  To: gentoo-commits

commit:     27140082a5c7f0ce57adcddf52681f556ca1fb36
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 29 22:50:36 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=27140082

Fix showing and highlighting current ecj and mvn targets (#585224)

 NEWS                         | 1 +
 src/modules/ecj.eselect.in   | 9 +++++----
 src/modules/maven.eselect.in | 9 +++++----
 3 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/NEWS b/NEWS
index a0102aa..c85ba17 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,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
+    * Fix showing and highlighting current ecj + mvn targets (#585224)
 
 0.3.0:
 

diff --git a/src/modules/ecj.eselect.in b/src/modules/ecj.eselect.in
index 7b6d784..353bcc5 100644
--- a/src/modules/ecj.eselect.in
+++ b/src/modules/ecj.eselect.in
@@ -38,8 +38,8 @@ find_target() {
 
 # determine the current target.
 get_target() {
-	local canonicalised=$(canonicalise "${ECJ}")
-	echo $(basename "${canonicalised}")
+	local target=$(readlink "${ECJ}")
+	echo ${target##*/}
 }
 
 ### show action ###
@@ -76,11 +76,12 @@ do_list() {
 		die -q "Usage error: no parameters allowed."
 	fi
 
-	local i targets
+	local i targets target
 	targets=( $(find_targets) )
+	target=$(get_target)
 
 	for (( i = 0; i < ${#targets[@]}; i++ )); do
-		[[ ${targets[i]} = $(basename "$(canonicalise "${ECJ}")") ]] \
+		[[ ${targets[i]} = ${target} ]] \
 			&& targets[i]=$(highlight_marker "${targets[i]}")
 	done
 

diff --git a/src/modules/maven.eselect.in b/src/modules/maven.eselect.in
index f0cf2e4..247fee7 100644
--- a/src/modules/maven.eselect.in
+++ b/src/modules/maven.eselect.in
@@ -41,8 +41,8 @@ remove_symlink() {
 
 # determine the current target.
 get_target() {
-	local canonicalised=$(canonicalise "${MVN}")
-	echo $(basename "${canonicalised}")
+	local target=$(readlink "${MVN}")
+	echo ${target##*/}
 }
 
 # set the Maven symlink.
@@ -86,11 +86,12 @@ do_list() {
 		die -q "Usage error: no parameters allowed."
 	fi
 
-	local i targets
+	local i targets target
 	targets=( $(find_targets) )
+	target=$(get_target)
 
 	for (( i = 0; i < ${#targets[@]}; i++ )); do
-		[[ ${targets[i]} = $(basename "$(canonicalise "${MVN}")") ]] \
+		[[ ${targets[i]} = ${target} ]] \
 			&& targets[i]=$(highlight_marker "${targets[i]}")
 	done
 


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] proj/eselect-java:master commit in: src/modules/, /
@ 2018-01-03 22:51 James Le Cuirot
  0 siblings, 0 replies; 6+ messages in thread
From: James Le Cuirot @ 2018-01-03 22:51 UTC (permalink / raw
  To: gentoo-commits

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

Fix mkdir die message in java-vm module

 NEWS                           | 1 +
 src/modules/java-vm.eselect.in | 8 +++-----
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/NEWS b/NEWS
index 669548f..3faaf11 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,7 @@
 0.4.0:
 
     * Don't emit (unset) or (not a symlink) on stderr (#549498)
+    * Fix mkdir die message in java-vm module
 
 0.3.0:
 

diff --git a/src/modules/java-vm.eselect.in b/src/modules/java-vm.eselect.in
index c964a34..3d5de4d 100644
--- a/src/modules/java-vm.eselect.in
+++ b/src/modules/java-vm.eselect.in
@@ -1,5 +1,5 @@
 # -*-eselect-*-  vim: ft=eselect
-# Copyright 1999-2013 Gentoo Foundation
+# Copyright 1999-2017 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 DESCRIPTION="Manage the Java system and user VM"
@@ -147,10 +147,8 @@ set_symlink() {
 	if [[ -z ${target} ]] ; then
 		die -q "Target \"${1}\" doesn't appear to be valid!"
 	elif [[ -d "${VM_BASE}/${target}" ]] ; then
-		local sym_dir=$(dirname ${symlink})
-		if [[ ! -d ${sym_dir} ]]; then
-			mkdir -p ${sym_dir} || die -q "Could not create ${my_dir}"
-		fi
+		local sym_dir=${symlink%/*}
+		mkdir -p "${sym_dir}" || die -q "Could not create ${sym_dir}"
 		ln -snf "${VM_BASE}/${target}" "${symlink}"
 	else
 		die -q "Target \"${1}\" doesn't appear to be valid!"


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] proj/eselect-java:java-vm-update commit in: /, src/modules/
@ 2022-06-24  9:21 Florian Schmaus
  2022-06-24 10:33 ` [gentoo-commits] proj/eselect-java:master commit in: src/modules/, / Florian Schmaus
  0 siblings, 1 reply; 6+ messages in thread
From: Florian Schmaus @ 2022-06-24  9:21 UTC (permalink / raw
  To: gentoo-commits

commit:     a9fd19b87c15c4c573ab43b8547a26d6ea894ebc
Author:     Florian Schmaus <flow <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 24 07:49:14 2022 +0000
Commit:     Florian Schmaus <flow <AT> gentoo <DOT> org>
CommitDate: Fri Jun 24 09:21:00 2022 +0000
URL:        https://gitweb.gentoo.org/proj/eselect-java.git/commit/?id=a9fd19b8

Decide based on the UID if system or user VM should be modified

Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>

 NEWS                           |  1 +
 src/modules/java-vm.eselect.in | 14 +++++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index d8ea978..52fbfe5 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,6 @@
 NEXT:
     * Add "eselect java-vm update" (#853928)
+    * Decide on UID if system or user VM should be set
 
 0.4.3:
     * install jpackage symlink

diff --git a/src/modules/java-vm.eselect.in b/src/modules/java-vm.eselect.in
index c7d5a82..7c46ff1 100644
--- a/src/modules/java-vm.eselect.in
+++ b/src/modules/java-vm.eselect.in
@@ -116,7 +116,7 @@ describe_set_parameters() {
 }
 
 do_set() {
-	local usage="Usage <user|system> <VM>"
+	local usage="Usage [user|system] <VM>"
 	local ifunset=0
 
 	if [[ ${1} == "--if-unset" ]]; then
@@ -124,6 +124,18 @@ do_set() {
 		shift
 	fi
 
+	# Automatically decide, based in the invoking user's UID, if the
+	# user or system Java VM should be modified.
+	if [[ ${#} -eq 1 ]]; then
+		local kind
+		if [[ ${UID} -eq 0 ]]; then
+			kind="system"
+		else
+			kind="user"
+		fi
+		set -- ${kind} ${@}
+	fi
+
 	if [[ ${#} != 2 ]]; then
 		die -q ${usage}
 	elif [[ ${1} == "system" ]]; then


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] proj/eselect-java:master commit in: src/modules/, /
  2022-06-24  9:21 [gentoo-commits] proj/eselect-java:java-vm-update commit in: /, src/modules/ Florian Schmaus
@ 2022-06-24 10:33 ` Florian Schmaus
  0 siblings, 0 replies; 6+ messages in thread
From: Florian Schmaus @ 2022-06-24 10:33 UTC (permalink / raw
  To: gentoo-commits

commit:     a9fd19b87c15c4c573ab43b8547a26d6ea894ebc
Author:     Florian Schmaus <flow <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 24 07:49:14 2022 +0000
Commit:     Florian Schmaus <flow <AT> gentoo <DOT> org>
CommitDate: Fri Jun 24 09:21:00 2022 +0000
URL:        https://gitweb.gentoo.org/proj/eselect-java.git/commit/?id=a9fd19b8

Decide based on the UID if system or user VM should be modified

Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>

 NEWS                           |  1 +
 src/modules/java-vm.eselect.in | 14 +++++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index d8ea978..52fbfe5 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,6 @@
 NEXT:
     * Add "eselect java-vm update" (#853928)
+    * Decide on UID if system or user VM should be set
 
 0.4.3:
     * install jpackage symlink

diff --git a/src/modules/java-vm.eselect.in b/src/modules/java-vm.eselect.in
index c7d5a82..7c46ff1 100644
--- a/src/modules/java-vm.eselect.in
+++ b/src/modules/java-vm.eselect.in
@@ -116,7 +116,7 @@ describe_set_parameters() {
 }
 
 do_set() {
-	local usage="Usage <user|system> <VM>"
+	local usage="Usage [user|system] <VM>"
 	local ifunset=0
 
 	if [[ ${1} == "--if-unset" ]]; then
@@ -124,6 +124,18 @@ do_set() {
 		shift
 	fi
 
+	# Automatically decide, based in the invoking user's UID, if the
+	# user or system Java VM should be modified.
+	if [[ ${#} -eq 1 ]]; then
+		local kind
+		if [[ ${UID} -eq 0 ]]; then
+			kind="system"
+		else
+			kind="user"
+		fi
+		set -- ${kind} ${@}
+	fi
+
 	if [[ ${#} != 2 ]]; then
 		die -q ${usage}
 	elif [[ ${1} == "system" ]]; then


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] proj/eselect-java:master commit in: src/modules/, /
@ 2022-06-24 10:33 Florian Schmaus
  0 siblings, 0 replies; 6+ messages in thread
From: Florian Schmaus @ 2022-06-24 10:33 UTC (permalink / raw
  To: gentoo-commits

commit:     561e6cb5b3fefb6c248056aa4d790276433856b3
Author:     Florian Schmaus <flow <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 24 07:02:14 2022 +0000
Commit:     Florian Schmaus <flow <AT> gentoo <DOT> org>
CommitDate: Fri Jun 24 08:16:33 2022 +0000
URL:        https://gitweb.gentoo.org/proj/eselect-java.git/commit/?id=561e6cb5

Add "eselect java-vm update"

Bug: https://bugs.gentoo.org/853928
Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>

 NEWS                           |  3 +++
 src/modules/java-vm.eselect.in | 55 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 58 insertions(+)

diff --git a/NEWS b/NEWS
index 6c331a2..d8ea978 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,6 @@
+NEXT:
+    * Add "eselect java-vm update" (#853928)
+
 0.4.3:
     * install jpackage symlink
 

diff --git a/src/modules/java-vm.eselect.in b/src/modules/java-vm.eselect.in
index e332c5a..c7d5a82 100644
--- a/src/modules/java-vm.eselect.in
+++ b/src/modules/java-vm.eselect.in
@@ -177,3 +177,58 @@ set_symlink() {
 		die -q "Target \"${1}\" doesn't appear to be valid!"
 	fi
 }
+
+describe_update() {
+	echo "Automatically update the Java system VM"
+}
+
+do_update() {
+	local targets
+	targets=( $(find_targets) )
+
+	if [[ ${#targets[@]} -eq 0 ]]; then
+		echo "No installed Java VMs found, can not update"
+		return
+	fi
+
+	if [[ -e "${VM_SYSTEM}" ]]; then
+		local current_system_vm_name=$(sym_to_vm "${VM_SYSTEM}")
+		echo "Current Java system VM ${current_system_vm_name} is valid, no need to update"
+		return
+	fi
+
+	local new_target old_system_vm_name
+	if [[ -L "${VM_SYSTEM}" ]]; then
+		# There exists a Java system VM symlink that has become stale,
+		# try to find another available VM with the same slot.
+		old_system_vm_name=$(sym_to_vm "${VM_SYSTEM}")
+
+		local old_system_vm_slot="${old_system_vm_name##*-}"
+
+		local target
+		for target in "${targets[@]}"; do
+			local target_slot="${target##*-}"
+			if [[ ${target_slot} -eq ${old_system_vm_slot} ]]; then
+				new_target="${target}"
+				break
+			fi
+		done
+	fi
+
+	if [[ -z "${new_target}" ]]; then
+		# There is no Java system VM symlink or we could not find a
+		# slot-matching replacement. But there are potential targets,
+		# simply choose the first.
+		# TODO: We could get more sophisticated here to select the "best"
+		# target, but that is far from trivial.
+		new_target="${targets[0]}"
+	fi
+
+	local from_vm_text=""
+	if [[ -n "${old_system_vm_name}" ]]; then
+		from_vm_text="from ${old_system_vm_name} "
+	fi
+
+	echo "Updating Java system VM ${from_vm_text}to ${new_target}"
+	set_symlink "${new_target}" "${VM_SYSTEM}"
+}


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-06-24 10:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-24  9:21 [gentoo-commits] proj/eselect-java:java-vm-update commit in: /, src/modules/ Florian Schmaus
2022-06-24 10:33 ` [gentoo-commits] proj/eselect-java:master commit in: src/modules/, / Florian Schmaus
  -- strict thread matches above, loose matches on Subject: below --
2022-06-24 10:33 Florian Schmaus
2018-01-03 22:51 James Le Cuirot
2018-01-03 22:51 James Le Cuirot
2018-01-03 22:51 James Le Cuirot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox