From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 88252138334 for ; Mon, 11 Mar 2019 05:02:51 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5ED63E0C3D; Mon, 11 Mar 2019 05:02:49 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 37E54E0C3D for ; Mon, 11 Mar 2019 05:02:49 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 130C1335D47 for ; Mon, 11 Mar 2019 05:02:48 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 23D8B56A for ; Mon, 11 Mar 2019 05:02:45 +0000 (UTC) From: "Thomas Deutschmann" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Thomas Deutschmann" Message-ID: <1552280185.51b5d26d5fddcffc9f89a4e5256c457182bf47c8.whissi@gentoo> Subject: [gentoo-commits] proj/eselect-rust:master commit in: / X-VCS-Repository: proj/eselect-rust X-VCS-Files: rust.eselect.in X-VCS-Directories: / X-VCS-Committer: whissi X-VCS-Committer-Name: Thomas Deutschmann X-VCS-Revision: 51b5d26d5fddcffc9f89a4e5256c457182bf47c8 X-VCS-Branch: master Date: Mon, 11 Mar 2019 05:02:45 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 16e0d351-69aa-4b2d-8ca6-6f216019bc23 X-Archives-Hash: 6eb3aea34203cf539e4c3b953b80b614 commit: 51b5d26d5fddcffc9f89a4e5256c457182bf47c8 Author: Thomas Deutschmann gentoo org> AuthorDate: Mon Mar 11 03:11:28 2019 +0000 Commit: Thomas Deutschmann gentoo 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 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[@]}" }