Skip to content

Commit 61961e3

Browse files
committed
Documentation: lib.sh: Support slot scope in get_main_tree_keyword()
In general, use more portageq instead of sed, grep, ls, sort and tail. Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
1 parent 0524ab6 commit 61961e3

File tree

1 file changed

+10
-3
lines changed
  • Documentation/maintainers/new

1 file changed

+10
-3
lines changed

Documentation/maintainers/new/lib.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ bump_packages_from_set() {
3737
ekeyword ^all ${destination} > /dev/null
3838

3939
if [[ ${destination} != *9999* ]] ; then
40-
ekeyword $(get_main_tree_keyword ${cp}) ${destination} > /dev/null
40+
local slot="$(portageq metadata / ebuild ${cp}-${sourceversion} SLOT)"
41+
ekeyword $(get_main_tree_keyword ${cp} ${slot%/*}) ${destination} > /dev/null
4142
ekeyword ~all ${destination} > /dev/null
4243
fi
4344

@@ -145,14 +146,20 @@ create_keywords_files() {
145146
}
146147

147148
# @FUNCTION: get_main_tree_keyword
148-
# @USAGE: <cp>
149+
# @USAGE: <cp> [slot]
149150
# @DESCRIPTION:
150151
# Given a <cp>, get the keywords from the highest ebuild version in the gentoo repo.
151152
get_main_tree_keyword() {
152153
local portdir="$(portageq get_repo_path / gentoo)"
153154
local cp="${1}"
155+
local slot basever
154156

155-
echo $(sed -ne 's/^\s*KEYWORDS="\(.*\)"/\1/p' "$(ls ${portdir}/${cp}/*.ebuild | sort | tail -n 1)")
157+
if [[ -n ${2} ]]; then
158+
slot=":${2}"
159+
fi
160+
slot="${slot}::gentoo"
161+
basever="$(portageq best_visible / ${cp}${slot})" # TODO: what if there is no such slot in tree?
162+
echo $(portageq metadata / ebuild ${basever} KEYWORDS)
156163
}
157164

158165
# @FUNCTION: get_package_list_from_set

0 commit comments

Comments
 (0)