1 |
commit: 51b5d26d5fddcffc9f89a4e5256c457182bf47c8 |
2 |
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Mar 11 03:11:28 2019 +0000 |
4 |
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Mar 11 04:56:25 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/eselect-rust.git/commit/?id=51b5d26d |
7 |
|
8 |
find_targets(): sort by version |
9 |
|
10 |
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org> |
11 |
|
12 |
rust.eselect.in | 24 ++++++++++++++++++++++-- |
13 |
1 file changed, 22 insertions(+), 2 deletions(-) |
14 |
|
15 |
diff --git a/rust.eselect.in b/rust.eselect.in |
16 |
index 0ecf87a..311d8c0 100644 |
17 |
--- a/rust.eselect.in |
18 |
+++ b/rust.eselect.in |
19 |
@@ -38,12 +38,32 @@ find_missing_broken_symlinks() { |
20 |
# in "${ENV_D_PATH}/rust" directory |
21 |
# this function prints list of $pkgname-$pkgver values |
22 |
find_targets() { |
23 |
- local f |
24 |
+ local f fn |
25 |
local -a providers |
26 |
+ local -a providers_unsorted |
27 |
+ local -a providers_sorted |
28 |
for f in "${ENV_D_PATH}"/rust/provider-*; do |
29 |
[[ -f ${f} ]] || continue |
30 |
- providers=("${providers[@]}" "${f##*/provider-}") |
31 |
+ fn="${f##*/provider-}" |
32 |
+ if [[ "${fn}" == rust-bin-* ]]; then |
33 |
+ providers_unsorted+=( "${fn##rust-bin-}-mysortA" ) |
34 |
+ elif [[ "${fn}" == rust-* ]]; then |
35 |
+ providers_unsorted+=( "${fn##rust-}-mysortZ" ) |
36 |
+ else |
37 |
+ die -q "Unsupported rust provider file '${f}' found." |
38 |
+ fi |
39 |
+ done |
40 |
+ |
41 |
+ IFS=$'\n' LC_COLLATE=C providers_sorted=( $(sort <<<"${providers_unsorted[*]}") ) |
42 |
+ |
43 |
+ for fn in "${providers_sorted[@]}"; do |
44 |
+ if [[ "${fn}" == *-mysortA ]]; then |
45 |
+ providers+=( "rust-bin-${fn%%-mysortA}" ) |
46 |
+ else |
47 |
+ providers+=( "rust-${fn%%-mysortZ}" ) |
48 |
+ fi |
49 |
done |
50 |
+ |
51 |
echo "${providers[@]}" |
52 |
} |