Gentoo Archives: gentoo-commits

From: "Ulrich Müller" <ulm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/eselect:master commit in: /, modules/
Date: Tue, 09 Jan 2018 02:02:13
Message-Id: 1515454185.a25b292e4feaab4b3c073eeb1ed96166893e2d2b.ulm@gentoo
1 commit: a25b292e4feaab4b3c073eeb1ed96166893e2d2b
2 Author: Ulrich Müller <ulm <AT> gentoo <DOT> org>
3 AuthorDate: Mon Jan 8 23:29:45 2018 +0000
4 Commit: Ulrich Müller <ulm <AT> gentoo <DOT> org>
5 CommitDate: Mon Jan 8 23:29:45 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/eselect.git/commit/?id=a25b292e
7
8 Show the profiles' status in the profile module's list output.
9
10 * modules/profile.eselect (find_targets): Add a fourth field for
11 the profiles' status to the output.
12 (set_symlink): Account for the change in find_targets.
13 (do_list): Also show the profiles' status, but only in non-brief
14 output mode. Bug 643864.
15
16 ChangeLog | 8 ++++++++
17 modules/profile.eselect | 23 ++++++++++++++---------
18 2 files changed, 22 insertions(+), 9 deletions(-)
19
20 diff --git a/ChangeLog b/ChangeLog
21 index 97dd57f..57e768e 100644
22 --- a/ChangeLog
23 +++ b/ChangeLog
24 @@ -1,3 +1,11 @@
25 +2018-01-08 Ulrich Müller <ulm@g.o>
26 +
27 + * modules/profile.eselect (find_targets): Add a fourth field for
28 + the profiles' status to the output.
29 + (set_symlink): Account for the change in find_targets.
30 + (do_list): Also show the profiles' status, but only in non-brief
31 + output mode. Bug 643864.
32 +
33 2017-12-25 Ulrich Müller <ulm@g.o>
34
35 * configure.ac: Update version to 1.4.10.
36
37 diff --git a/modules/profile.eselect b/modules/profile.eselect
38 index c9a1edc..de85f90 100644
39 --- a/modules/profile.eselect
40 +++ b/modules/profile.eselect
41 @@ -42,7 +42,7 @@ get_repo_path() {
42 }
43
44 # get a list of valid profiles
45 -# returns a line <repo>::<repo_path>::<profile> for every profile
46 +# returns a line <repo>::<repo_path>::<profile>::<status> for every profile
47 find_targets() {
48 local arch desc repos repo_paths i p
49
50 @@ -60,7 +60,8 @@ find_targets() {
51 [[ -r ${desc} ]] || continue
52 # parse profiles.desc and find profiles suitable for arch
53 for p in $(sed -n -e \
54 - "s|^${arch}[[:space:]]\+\([^[:space:]]\+\).*$|\1|p" "${desc}")
55 + "s|^${arch}[[:space:]]\+\([^[:space:]]\+\)[[:space:]]\+\([^[:space:]]\+\).*$|\1::\2|p" \
56 + "${desc}")
57 do
58 echo "${repos[i]}::${repo_paths[i]}::${p}"
59 done
60 @@ -85,6 +86,7 @@ set_symlink() {
61 target=${targets[target-1]}
62 repo=${target%%::*}; target=${target#*::}
63 repopath=${target%%::*}; target=${target#*::}
64 + target=${target%%::*}
65 elif [[ -n ${target} ]]; then
66 # if the profile was explicitly specified (rather than a number)
67 # double check and make sure it's valid
68 @@ -174,7 +176,7 @@ describe_list() {
69 }
70
71 do_list() {
72 - local targets active i target repo repopath
73 + local targets active i target repo repopath status disp
74
75 targets=( $(find_targets) )
76 [[ ${#targets[@]} -eq 0 ]] \
77 @@ -187,13 +189,16 @@ do_list() {
78 target=${targets[i]}
79 repo=${target%%::*}; target=${target#*::}
80 repopath=${target%%::*}; target=${target#*::}
81 - if [[ ${repo} == "${DEFAULT_REPO}" ]]; then
82 - targets[i]=${target}
83 - else
84 - targets[i]=${repo}:${target}
85 + status=${target#*::}; status=${status%%::*}
86 + target=${target%%::*}
87 + disp=${target}
88 + [[ ${repo} != "${DEFAULT_REPO}" ]] && disp=${repo}:${disp}
89 + if ! is_output_mode brief; then
90 + disp+=" (${status})"
91 + [[ $(canonicalise "${repopath}/profiles/${target}") \
92 + == "${active}" ]] && disp=$(highlight_marker "${disp}")
93 fi
94 - [[ $(canonicalise "${repopath}/profiles/${target}") == "${active}" ]] \
95 - && targets[i]=$(highlight_marker "${targets[i]}")
96 + targets[i]=${disp}
97 done
98 write_list_start "Available profile symlink targets:"
99 write_numbered_list "${targets[@]}"