public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/eselect-rust:master commit in: /
@ 2019-03-11  5:02 Thomas Deutschmann
  0 siblings, 0 replies; 14+ messages in thread
From: Thomas Deutschmann @ 2019-03-11  5:02 UTC (permalink / raw
  To: gentoo-commits

commit:     5799b7ee8492860b6dfc5542d04a2d2a2e3f7d56
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 10 03:33:35 2019 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Mon Mar 11 04:18:33 2019 +0000
URL:        https://gitweb.gentoo.org/proj/eselect-rust.git/commit/?id=5799b7ee

Use variables for common used paths

Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 rust.eselect.in | 37 ++++++++++++++++++++-----------------
 1 file changed, 20 insertions(+), 17 deletions(-)

diff --git a/rust.eselect.in b/rust.eselect.in
index 96fba74..02f7b75 100644
--- a/rust.eselect.in
+++ b/rust.eselect.in
@@ -5,17 +5,20 @@ DESCRIPTION="Manage the Rust compiler versions"
 MAINTAINER="rust@gentoo.org"
 VERSION="@VERSION@"
 
+ENV_D_PATH="${EROOT%/}/etc/env.d"
+BIN_DIR="${EROOT%/}/usr/bin"
+
 inherit package-manager path-manipulation
 
 # find a list of installed rust compilers
 # each compiler provider should install
 # a config file named provider-$pkgname-$pkgver
-# in "${EROOT}"/etc/env.d/rust directory
+# in "${ENV_D_PATH}/rust" directory
 # this function prints list of $pkgname-$pkgver values
 find_targets() {
 	local f
 	local -a providers
-	for f in "${EROOT}"/etc/env.d/rust/provider-*; do
+	for f in "${ENV_D_PATH}"/rust/provider-*; do
 		[[ -f ${f} ]] || continue
 		providers=("${providers[@]}" "${f##*/provider-}")
 	done
@@ -33,7 +36,7 @@ get_current_target() {
 	local i targets=( $(find_targets) )
 	for (( i = 0; i < ${#targets[@]}; i++ )); do
 		[[ rustc-$(get_postfix ${targets[i]}) = \
-			$(basename "$(canonicalise "${EROOT}/usr/bin/rustc")") ]] \
+			$(basename "$(canonicalise "${BIN_DIR}/rustc")") ]] \
 		&& echo $i && return 0
 	done
 	echo "NOT_SET"
@@ -60,7 +63,7 @@ get_symlinks_from_file() {
 
 #get last set symlinks
 get_last_set_symlinks() {
-	local symlinks=( $(get_symlinks_from_file "${EROOT}/etc/env.d/rust/last-set") )
+	local symlinks=( $(get_symlinks_from_file "${ENV_D_PATH}/rust/last-set") )
 	echo "${symlinks[@]}"
 }
 
@@ -76,7 +79,7 @@ get_symlinks() {
 		target=${targets[target]}
 	fi
 
-	local symlinks=( $(get_symlinks_from_file "${EROOT}/etc/env.d/rust/provider-${target}") )
+	local symlinks=( $(get_symlinks_from_file "${ENV_D_PATH}/rust/provider-${target}") )
 	echo "${symlinks[@]}"
 }
 
@@ -112,17 +115,17 @@ set_symlink() {
 unset_version() {
 	local symlinks=( $(get_last_set_symlinks) )
 	for i in "${symlinks[@]}"; do
-		remove_symlink "${EROOT}${i}"
+		remove_symlink "${EROOT%/}${i}"
 	done
-	remove_symlink "${EROOT}/usr/bin/rustc"
-	rm -f "${EROOT}/etc/env.d/rust/last-set" \
-		|| die -q "rm -f ${EROOT}/etc/env.d/rust/last-set failed"
+	remove_symlink "${BIN_DIR}/rustc"
+	rm -f "${ENV_D_PATH}/rust/last-set" \
+		|| die -q "rm -f ${ENV_D_PATH}/rust/last-set failed"
 }
 
 # set the rust version
 # each compiler provider should install
 # files named rustc-$postfix and rustdoc-$postfix
-# in ${EROOT}/usr/bin directory
+# in ${BIN_DIR} directory
 # $postfix is defined as the part of $pkgname-$pkgver after the first -
 # for dev-lang/rust-bin-9999 ebuild it would be bin-9999
 set_version() {
@@ -135,20 +138,20 @@ set_version() {
 
 	target_postfix=$(get_postfix ${target})
 
-	[[ -z ${target_postfix} || ! -x "${EROOT}/usr/bin/rustc-${target_postfix}" ]] \
+	[[ -z ${target_postfix} || ! -x "${BIN_DIR}/rustc-${target_postfix}" ]] \
 		&& die -q "Target \"$1\" doesn't appear to be valid!"
 
 	unset_version
 
-	set_symlink "${EROOT}/usr/bin/rustc-${target_postfix}" "${EROOT}/usr/bin/rustc"
+	set_symlink "${BIN_DIR}/rustc-${target_postfix}" "${BIN_DIR}/rustc"
 
 	local symlinks=( $(get_symlinks ${target}) )
 	for i in "${symlinks[@]}"; do
-		set_symlink "${EROOT}${i}-${target_postfix}" "${EROOT}${i}"
+		set_symlink "${EROOT%/}${i}-${target_postfix}" "${EROOT%/}${i}"
 	done
 
-	cp "${EROOT}/etc/env.d/rust/provider-${target}" \
-	   "${EROOT}/etc/env.d/rust/last-set" || \
+	cp "${ENV_D_PATH}/rust/provider-${target}" \
+	   "${ENV_D_PATH}/rust/last-set" || \
 	    die -q "symlink list copying failed"
 }
 
@@ -216,7 +219,7 @@ do_update() {
 		shift
 	done
 
-	if [[ "${if_unset}" == "1" && -f "${EROOT}"/usr/bin/rustc ]]; then
+	if [[ "${if_unset}" == "1" && -f "${BIN_DIR}/rustc" ]]; then
 		return
 	fi
 
@@ -248,7 +251,7 @@ do_unset() {
 		shift
 	done
 
-	if [[ "${if_invalid}" == "1" && -e "${EROOT}"/usr/bin/rustc ]]; then
+	if [[ "${if_invalid}" == "1" && -e "${BIN_DIR}/rustc" ]]; then
 		return
 	fi
 


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

* [gentoo-commits] proj/eselect-rust:master commit in: /
@ 2019-03-11  5:02 Thomas Deutschmann
  0 siblings, 0 replies; 14+ messages in thread
From: Thomas Deutschmann @ 2019-03-11  5:02 UTC (permalink / raw
  To: gentoo-commits

commit:     99577f8e98440da176709b6e4b988b40ae42b8d1
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 11 00:42:52 2019 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Mon Mar 11 04:54:36 2019 +0000
URL:        https://gitweb.gentoo.org/proj/eselect-rust.git/commit/?id=99577f8e

Add and make use of find_missing_broken_symlinks()

dev-lang/rust or dev-lang/rust-bin install more than one binary (program),
just checking for "rustc" is not enough.

In addition, set of installed programs depends on USE flags.

This new (internal) function will check for all provided programs.

Bug: https://bugs.gentoo.org/671182
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 rust.eselect.in | 40 ++++++++++++++++++++++++++++++++++++----
 1 file changed, 36 insertions(+), 4 deletions(-)

diff --git a/rust.eselect.in b/rust.eselect.in
index 02f7b75..d0f3361 100644
--- a/rust.eselect.in
+++ b/rust.eselect.in
@@ -10,6 +10,28 @@ BIN_DIR="${EROOT%/}/usr/bin"
 
 inherit package-manager path-manipulation
 
+# find a list of missing or broken symlinks
+# each compiler installs a list of provided programs.
+# this function checks if a symlink for a provided program
+# is missing or broken for the current active Rust implementation
+find_missing_broken_symlinks() {
+	local -a missing_symlinks
+	local required_symlinks=( "/usr/bin/rustc" $(get_last_set_symlinks) )
+
+	for i in "${required_symlinks[@]}"; do
+		local symlink="${EROOT%/}${i}"
+
+		if [[ -L "${symlink}" && -e "${symlink}" ]]; then
+			# existing symlink
+			continue
+		else
+			missing_symlinks+=( "${symlink}" )
+		fi
+	done
+
+	echo "${missing_symlinks[@]}"
+}
+
 # find a list of installed rust compilers
 # each compiler provider should install
 # a config file named provider-$pkgname-$pkgver
@@ -219,8 +241,13 @@ do_update() {
 		shift
 	done
 
-	if [[ "${if_unset}" == "1" && -f "${BIN_DIR}/rustc" ]]; then
-		return
+	if [[ "${if_unset}" == "1" ]]; then
+		local missing_symlinks=( $(find_missing_broken_symlinks) )
+		if [[ ${#missing_symlinks[@]} -eq 0 ]]; then
+			return
+		else
+			echo "Not all symlinks set. Will switch to the most recent Rust compiler!"
+		fi
 	fi
 
 	local targets=( $(find_targets) )
@@ -251,8 +278,13 @@ do_unset() {
 		shift
 	done
 
-	if [[ "${if_invalid}" == "1" && -e "${BIN_DIR}/rustc" ]]; then
-		return
+	if [[ "${if_invalid}" == "1" ]]; then
+		local missing_symlinks=( $(find_missing_broken_symlinks) )
+		if [[ ${#missing_symlinks[@]} -eq 0 ]]; then
+			return
+		else
+			echo "Not all symlinks set. Will unset current symlinked Rust binaries!"
+		fi
 	fi
 
 	unset_version || die -q "Couldn't unset active version"


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

* [gentoo-commits] proj/eselect-rust:master commit in: /
@ 2019-03-11  5:02 Thomas Deutschmann
  0 siblings, 0 replies; 14+ messages in thread
From: Thomas Deutschmann @ 2019-03-11  5:02 UTC (permalink / raw
  To: gentoo-commits

commit:     47ad9a4eeb74a053d1fbc854fca7d13c96fb1a5b
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 11 01:11:16 2019 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Mon Mar 11 04:54:44 2019 +0000
URL:        https://gitweb.gentoo.org/proj/eselect-rust.git/commit/?id=47ad9a4e

Add cleanup action

Cleanup action will make use of new find_missing_broken_symlinks() function
and should be called by ebuild during package removal.

If we detect a missing or broken symlink, we will automatically mark latest
available version as default (which will basically fix missing or broken
symlinks).

Bug: https://bugs.gentoo.org/671182
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 rust.eselect.in | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/rust.eselect.in b/rust.eselect.in
index d0f3361..1360dc2 100644
--- a/rust.eselect.in
+++ b/rust.eselect.in
@@ -177,6 +177,33 @@ set_version() {
 	    die -q "symlink list copying failed"
 }
 
+### cleanup action ###
+describe_cleanup() {
+	echo "This action is not to be called manually."
+}
+
+do_cleanup() {
+	[[ -z ${@} ]] || die -q "This function does not expect any arguments"
+
+	# Do we need to clean up?
+	local missing_symlinks=( $(find_missing_broken_symlinks) )
+	if [[ ${#missing_symlinks[@]} -eq 0 ]]; then
+		echo "Nothing to clean up."
+		return
+	fi
+
+	unset_version
+
+	local targets=( $(find_targets) )
+
+	if [[ ${#targets[@]} -ne 0 ]]; then
+		echo "Marking the latest still installed version as default..."
+		do_set ${#targets[@]}
+	else
+		echo "No Rust profiles left on the system. Stale symlinks removed."
+	fi
+}
+
 ### list action ###
 
 describe_list() {


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

* [gentoo-commits] proj/eselect-rust:master commit in: /
@ 2019-03-11  5:02 Thomas Deutschmann
  0 siblings, 0 replies; 14+ messages in thread
From: Thomas Deutschmann @ 2019-03-11  5:02 UTC (permalink / raw
  To: gentoo-commits

commit:     4a507f5d088260c117fc3836ecc66e468af4849b
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 10 03:18:51 2019 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Sun Mar 10 03:18:51 2019 +0000
URL:        https://gitweb.gentoo.org/proj/eselect-rust.git/commit/?id=4a507f5d

Generate & add ChangeLog when creating dist target

Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 Makefile.am | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/Makefile.am b/Makefile.am
index 144bee4..b969189 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,2 +1,20 @@
 eselectdir = $(datadir)/eselect/modules
 dist_eselect_DATA = rust.eselect
+
+dist-hook: gen-ChangeLog
+
+.PHONY: gen-ChangeLog
+gen-ChangeLog:
+	@if test -d "$(top_srcdir)/.git"; \
+	then \
+		echo "Creating ChangeLog ..." && \
+		( cd "$(top_srcdir)" && \
+		  echo '# Generated by Makefile. Do not edit.'; echo; \
+		  git log --no-color --no-decorate ) > ChangeLog.tmp \
+		&& mv -f ChangeLog.tmp $(top_distdir)/ChangeLog \
+		|| ( rm -f ChangeLog.tmp ; \
+		     echo "Failed to generate ChangeLog" >&2; \
+		     exit 1; ); \
+	else \
+		echo "A git clone is required to generate a ChangeLog" >&2; \
+	fi


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

* [gentoo-commits] proj/eselect-rust:master commit in: /
@ 2019-03-11  5:02 Thomas Deutschmann
  0 siblings, 0 replies; 14+ messages in thread
From: Thomas Deutschmann @ 2019-03-11  5:02 UTC (permalink / raw
  To: gentoo-commits

commit:     4421e5aedf451ddda2dac20a09511b9d427fecb8
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 11 04:22:23 2019 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Mon Mar 11 04:56:25 2019 +0000
URL:        https://gitweb.gentoo.org/proj/eselect-rust.git/commit/?id=4421e5ae

bump version to 20190311

Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 70b2afd..1cdbabf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT([eselect-rust], [20190310])
+AC_INIT([eselect-rust], [20190311])
 AM_INIT_AUTOMAKE([-Wall foreign no-dist-gzip dist-bzip2])
 
 # Create output files.


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

* [gentoo-commits] proj/eselect-rust:master commit in: /
@ 2019-03-11  5:02 Thomas Deutschmann
  0 siblings, 0 replies; 14+ messages in thread
From: Thomas Deutschmann @ 2019-03-11  5:02 UTC (permalink / raw
  To: gentoo-commits

commit:     51b5d26d5fddcffc9f89a4e5256c457182bf47c8
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 11 03:11:28 2019 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Mon Mar 11 04:56:25 2019 +0000
URL:        https://gitweb.gentoo.org/proj/eselect-rust.git/commit/?id=51b5d26d

find_targets(): sort by version

Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 rust.eselect.in | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/rust.eselect.in b/rust.eselect.in
index 0ecf87a..311d8c0 100644
--- a/rust.eselect.in
+++ b/rust.eselect.in
@@ -38,12 +38,32 @@ find_missing_broken_symlinks() {
 # in "${ENV_D_PATH}/rust" directory
 # this function prints list of $pkgname-$pkgver values
 find_targets() {
-	local f
+	local f fn
 	local -a providers
+	local -a providers_unsorted
+	local -a providers_sorted
 	for f in "${ENV_D_PATH}"/rust/provider-*; do
 		[[ -f ${f} ]] || continue
-		providers=("${providers[@]}" "${f##*/provider-}")
+		fn="${f##*/provider-}"
+		if [[ "${fn}" == rust-bin-* ]]; then
+			providers_unsorted+=( "${fn##rust-bin-}-mysortA" )
+		elif [[ "${fn}" == rust-* ]]; then
+			providers_unsorted+=( "${fn##rust-}-mysortZ" )
+		else
+			die -q "Unsupported rust provider file '${f}' found."
+		fi
+	done
+
+	IFS=$'\n' LC_COLLATE=C providers_sorted=( $(sort <<<"${providers_unsorted[*]}") )
+
+	for fn in "${providers_sorted[@]}"; do
+		if [[ "${fn}" == *-mysortA ]]; then
+			providers+=( "rust-bin-${fn%%-mysortA}" )
+		else
+			providers+=( "rust-${fn%%-mysortZ}" )
+		fi
 	done
+
 	echo "${providers[@]}"
 }
 


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

* [gentoo-commits] proj/eselect-rust:master commit in: /
@ 2019-03-11  5:02 Thomas Deutschmann
  0 siblings, 0 replies; 14+ messages in thread
From: Thomas Deutschmann @ 2019-03-11  5:02 UTC (permalink / raw
  To: gentoo-commits

commit:     66c4c263a0f983bfb456e43cc674a25323ea189c
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 11 01:13:53 2019 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Mon Mar 11 04:56:21 2019 +0000
URL:        https://gitweb.gentoo.org/proj/eselect-rust.git/commit/?id=66c4c263

Mark "unset" action as deprecated

As long as one Rust implementation is installed, there should be always
a Rust implementation marked as default.

However, we need to keep this function until all ebuilds which are calling
"eselect rust unset" are gone. So make this action an alias of new
cleanup action.

Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 rust.eselect.in | 30 ++----------------------------
 1 file changed, 2 insertions(+), 28 deletions(-)

diff --git a/rust.eselect.in b/rust.eselect.in
index 1360dc2..0ecf87a 100644
--- a/rust.eselect.in
+++ b/rust.eselect.in
@@ -284,37 +284,11 @@ do_update() {
 ### unset action ###
 
 describe_unset() {
-	echo "Unset active Rust version"
-}
-
-describe_unset_options() {
-	echo "--if-invalid    : Unset only if symlink is invalid (e.g. package was uninstalled)"
+	echo 'DEPRECATED: Use "cleanup" action instead!'
 }
 
 do_unset() {
-	local if_invalid="0"
-	while [[ $# > 0 ]]; do
-		case "$1" in
-			--if-invalid)
-				if_invalid="1"
-				;;
-			*)
-				die -q "Unrecognized argument '$1'"
-				;;
-		esac
-		shift
-	done
-
-	if [[ "${if_invalid}" == "1" ]]; then
-		local missing_symlinks=( $(find_missing_broken_symlinks) )
-		if [[ ${#missing_symlinks[@]} -eq 0 ]]; then
-			return
-		else
-			echo "Not all symlinks set. Will unset current symlinked Rust binaries!"
-		fi
-	fi
-
-	unset_version || die -q "Couldn't unset active version"
+	do_cleanup
 }
 
 # vim: set ft=eselect :


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

* [gentoo-commits] proj/eselect-rust:master commit in: /
@ 2020-01-01 22:05 Thomas Deutschmann
  0 siblings, 0 replies; 14+ messages in thread
From: Thomas Deutschmann @ 2020-01-01 22:05 UTC (permalink / raw
  To: gentoo-commits

commit:     c8561adb88c9ade4705ae4e56b3c50a83c9c7af4
Author:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Wed Jan  1 22:03:43 2020 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Wed Jan  1 22:05:18 2020 +0000
URL:        https://gitweb.gentoo.org/proj/eselect-rust.git/commit/?id=c8561adb

Add show action

Closes: https://bugs.gentoo.org/704502
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
Closes: https://github.com/jauhien/eselect-rust/pull/5
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 rust.eselect.in | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/rust.eselect.in b/rust.eselect.in
index 311d8c0..8e4ea3a 100644
--- a/rust.eselect.in
+++ b/rust.eselect.in
@@ -264,6 +264,26 @@ do_set() {
 	set_version "$1" || die -q "Couldn't set new active version"
 }
 
+### show action ###
+
+describe_show() {
+	echo "Show the current Rust implementation"
+}
+
+do_show() {
+	[[ -z "${@}" ]] || die -q "Too many parameters"
+	write_list_start "Current Rust implementation:"
+
+	local targets=( $(find_targets) )
+	local target=$(get_current_target)
+
+	if is_number "${target}"; then
+		write_kv_list_entry "${targets[target]}" ""
+	else
+		write_kv_list_entry "(unset)" ""
+	fi
+}
+
 ### update action ###
 
 describe_update() {


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

* [gentoo-commits] proj/eselect-rust:master commit in: /
@ 2020-01-01 22:25 Thomas Deutschmann
  0 siblings, 0 replies; 14+ messages in thread
From: Thomas Deutschmann @ 2020-01-01 22:25 UTC (permalink / raw
  To: gentoo-commits

commit:     b246a4aa6846c43791bff586c154877719f8830c
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Wed Jan  1 22:21:56 2020 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Wed Jan  1 22:21:56 2020 +0000
URL:        https://gitweb.gentoo.org/proj/eselect-rust.git/commit/?id=b246a4aa

Fix code style

Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 rust.eselect.in | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/rust.eselect.in b/rust.eselect.in
index 8e4ea3a..9de7149 100644
--- a/rust.eselect.in
+++ b/rust.eselect.in
@@ -1,4 +1,4 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 DESCRIPTION="Manage the Rust compiler versions"
@@ -77,9 +77,11 @@ get_postfix() {
 get_current_target() {
 	local i targets=( $(find_targets) )
 	for (( i = 0; i < ${#targets[@]}; i++ )); do
-		[[ rustc-$(get_postfix ${targets[i]}) = \
-			$(basename "$(canonicalise "${BIN_DIR}/rustc")") ]] \
-		&& echo $i && return 0
+		if [[ rustc-$(get_postfix ${targets[i]}) = \
+			$(basename "$(canonicalise "${BIN_DIR}/rustc")") ]]; then
+			echo $i
+			return 0
+		fi
 	done
 	echo "NOT_SET"
 }
@@ -90,7 +92,7 @@ get_symlinks_from_file() {
 	local symlinks=()
 	local i
 	if [[ -e ${filename} ]]; then
-		for i in `cat "${filename}"`; do
+		for i in $(cat "${filename}"); do
 			symlinks+=($i)
 		done
 	fi
@@ -193,8 +195,8 @@ set_version() {
 	done
 
 	cp "${ENV_D_PATH}/rust/provider-${target}" \
-	   "${ENV_D_PATH}/rust/last-set" || \
-	    die -q "symlink list copying failed"
+		"${ENV_D_PATH}/rust/last-set" \
+		|| die -q "symlink list copying failed"
 }
 
 ### cleanup action ###
@@ -250,16 +252,16 @@ describe_set() {
 }
 
 describe_set_parameters() {
-    echo "<target>"
+	echo "<target>"
 }
 
 describe_set_options() {
-    echo "target : Target number (from 'list' action)"
+	echo "target : Target number (from 'list' action)"
 }
 
 do_set() {
-    [[ -z $1 ]] && die -q "You didn't tell me what to set the version to"
-    [[ $# -gt 1 ]] && die -q "Too many parameters"
+	[[ -z $1 ]] && die -q "You didn't tell me what to set the version to"
+	[[ $# -gt 1 ]] && die -q "Too many parameters"
 
 	set_version "$1" || die -q "Couldn't set new active version"
 }


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

* [gentoo-commits] proj/eselect-rust:master commit in: /
@ 2020-01-01 22:25 Thomas Deutschmann
  0 siblings, 0 replies; 14+ messages in thread
From: Thomas Deutschmann @ 2020-01-01 22:25 UTC (permalink / raw
  To: gentoo-commits

commit:     515b080311d126e2c9e2e3b0c765b3aa32ee2353
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Wed Jan  1 22:23:53 2020 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Wed Jan  1 22:23:53 2020 +0000
URL:        https://gitweb.gentoo.org/proj/eselect-rust.git/commit/?id=515b0803

bump version to 20200101

Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 1cdbabf..2c25a9c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT([eselect-rust], [20190311])
+AC_INIT([eselect-rust], [20200101])
 AM_INIT_AUTOMAKE([-Wall foreign no-dist-gzip dist-bzip2])
 
 # Create output files.


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

* [gentoo-commits] proj/eselect-rust:master commit in: /
@ 2020-04-19  1:21 Thomas Deutschmann
  0 siblings, 0 replies; 14+ messages in thread
From: Thomas Deutschmann @ 2020-04-19  1:21 UTC (permalink / raw
  To: gentoo-commits

commit:     190fdd480d33ef378167a15a8fb4136202445805
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 19 01:20:41 2020 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Sun Apr 19 01:20:41 2020 +0000
URL:        https://gitweb.gentoo.org/proj/eselect-rust.git/commit/?id=190fdd48

rust.eselect.in: make shellcheck happy

Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 rust.eselect.in | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/rust.eselect.in b/rust.eselect.in
index 1b33280..c3ee046 100644
--- a/rust.eselect.in
+++ b/rust.eselect.in
@@ -215,7 +215,7 @@ describe_cleanup() {
 }
 
 do_cleanup() {
-	[[ -z ${@} ]] || die -q "This function does not expect any arguments"
+	[[ -z ${*} ]] || die -q "This function does not expect any arguments"
 
 	# Do we need to clean up?
 	local missing_symlinks=( $(find_missing_broken_symlinks) )
@@ -283,7 +283,7 @@ describe_show() {
 }
 
 do_show() {
-	[[ -z "${@}" ]] || die -q "Too many parameters"
+	[[ -z "${*}" ]] || die -q "Too many parameters"
 	write_list_start "Current Rust implementation:"
 
 	local targets=( $(find_targets) )
@@ -308,7 +308,7 @@ describe_update_options() {
 
 do_update() {
 	local if_unset="0"
-	while [[ $# > 0 ]]; do
+	while [[ $# -gt 0 ]]; do
 		case "$1" in
 			--if-unset)
 				if_unset="1"


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

* [gentoo-commits] proj/eselect-rust:master commit in: /
@ 2020-04-19  1:21 Thomas Deutschmann
  0 siblings, 0 replies; 14+ messages in thread
From: Thomas Deutschmann @ 2020-04-19  1:21 UTC (permalink / raw
  To: gentoo-commits

commit:     765c328b9a4fd151f21cf5fb3ed416910c4aecf4
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 19 01:14:02 2020 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Sun Apr 19 01:14:02 2020 +0000
URL:        https://gitweb.gentoo.org/proj/eselect-rust.git/commit/?id=765c328b

bump version to 20200419

Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 2c25a9c..f7a7762 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT([eselect-rust], [20200101])
+AC_INIT([eselect-rust], [20200419])
 AM_INIT_AUTOMAKE([-Wall foreign no-dist-gzip dist-bzip2])
 
 # Create output files.


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

* [gentoo-commits] proj/eselect-rust:master commit in: /
@ 2020-04-19  1:21 Thomas Deutschmann
  0 siblings, 0 replies; 14+ messages in thread
From: Thomas Deutschmann @ 2020-04-19  1:21 UTC (permalink / raw
  To: gentoo-commits

commit:     e6337fe78b77a17b23d7e7db46af7bec32f1c126
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 19 01:06:45 2020 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Sun Apr 19 01:12:26 2020 +0000
URL:        https://gitweb.gentoo.org/proj/eselect-rust.git/commit/?id=e6337fe7

find_missing_broken_symlinks(): add symlinks for new targets

This commit will ensure that we will create a new symlink
which didn't exist before for a new target, i.e. after
re-installing a rust provider with changed USE flags.

Bug: https://bugs.gentoo.org/688864
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 rust.eselect.in | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/rust.eselect.in b/rust.eselect.in
index 9de7149..1b33280 100644
--- a/rust.eselect.in
+++ b/rust.eselect.in
@@ -18,6 +18,16 @@ find_missing_broken_symlinks() {
 	local -a missing_symlinks
 	local required_symlinks=( "/usr/bin/rustc" $(get_last_set_symlinks) )
 
+	local target=$(get_current_target)
+	if [ "${target}" != "NOT_SET" ]; then
+		# make sure we add new symlinks for new targets,
+		# i.e. after changed USE flags
+		required_symlinks+=( $(get_symlinks ${target}) )
+	fi
+
+	required_symlinks=( $(printf "%s\n" "${required_symlinks[@]}" | sort -u) )
+
+	local i
 	for i in "${required_symlinks[@]}"; do
 		local symlink="${EROOT%/}${i}"
 


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

* [gentoo-commits] proj/eselect-rust:master commit in: /
@ 2021-07-03  7:49 Georgy Yakovlev
  0 siblings, 0 replies; 14+ messages in thread
From: Georgy Yakovlev @ 2021-07-03  7:49 UTC (permalink / raw
  To: gentoo-commits

commit:     7ac58a21d2fd6e66852c7ae2e6c09f3b836b73a1
Author:     David Michael <fedora.dm0 <AT> gmail <DOT> com>
AuthorDate: Fri May 14 14:16:57 2021 +0000
Commit:     Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
CommitDate: Sat Jul  3 07:48:56 2021 +0000
URL:        https://gitweb.gentoo.org/proj/eselect-rust.git/commit/?id=7ac58a21

Stop using absolute symlinks

Prefixing everything with ${EROOT} produces invalid paths on the
target system.  All of the symlinks point to files in the same
directory, so there is no reason to specify directories at all.

Bug: https://bugs.gentoo.org/790305
Signed-off-by: David Michael <fedora.dm0 <AT> gmail.com>
Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>

 README.md       | 4 ----
 rust.eselect.in | 8 ++++----
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/README.md b/README.md
index 6ae99cf..ac3a34d 100644
--- a/README.md
+++ b/README.md
@@ -75,7 +75,3 @@ then `/etc/env.d/rust/provider-TARGET` should contain:
 ```
 
 Note, that `/usr/bin/rustc` should not be listed, as it is always managed by eselect.
-
-### Notes
-
-**eselect-rust** automatically prepends every path with `${EROOT}` variable.

diff --git a/rust.eselect.in b/rust.eselect.in
index c3ee046..7ab845b 100644
--- a/rust.eselect.in
+++ b/rust.eselect.in
@@ -1,4 +1,4 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 DESCRIPTION="Manage the Rust compiler versions"
@@ -157,7 +157,7 @@ set_symlink() {
 
 	remove_symlink "${dest}"
 
-	if [[ -e ${source} ]]; then
+	if [[ -e ${dest%/*}/${source} ]]; then
 		mkdir -p "$(dirname ${dest})" || die -q "directory creation failed for $(dirname ${dest})"
 		ln -s "${source}" "${dest}" || die -q "${dest} symlink setting failed"
 	else
@@ -197,11 +197,11 @@ set_version() {
 
 	unset_version
 
-	set_symlink "${BIN_DIR}/rustc-${target_postfix}" "${BIN_DIR}/rustc"
+	set_symlink "rustc-${target_postfix}" "${BIN_DIR}/rustc"
 
 	local symlinks=( $(get_symlinks ${target}) )
 	for i in "${symlinks[@]}"; do
-		set_symlink "${EROOT%/}${i}-${target_postfix}" "${EROOT%/}${i}"
+		set_symlink "${i##*/}-${target_postfix}" "${EROOT%/}${i}"
 	done
 
 	cp "${ENV_D_PATH}/rust/provider-${target}" \


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

end of thread, other threads:[~2021-07-03  7:49 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-11  5:02 [gentoo-commits] proj/eselect-rust:master commit in: / Thomas Deutschmann
  -- strict thread matches above, loose matches on Subject: below --
2021-07-03  7:49 Georgy Yakovlev
2020-04-19  1:21 Thomas Deutschmann
2020-04-19  1:21 Thomas Deutschmann
2020-04-19  1:21 Thomas Deutschmann
2020-01-01 22:25 Thomas Deutschmann
2020-01-01 22:25 Thomas Deutschmann
2020-01-01 22:05 Thomas Deutschmann
2019-03-11  5:02 Thomas Deutschmann
2019-03-11  5:02 Thomas Deutschmann
2019-03-11  5:02 Thomas Deutschmann
2019-03-11  5:02 Thomas Deutschmann
2019-03-11  5:02 Thomas Deutschmann
2019-03-11  5:02 Thomas Deutschmann

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