summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2014-01-22 23:28:28 +0100
committerUlrich Müller <ulm@gentoo.org>2014-01-22 23:28:28 +0100
commit1d055c6902f338aacd3a312a0d2275d4ca3e5e74 (patch)
tree7d5fc7a0ee866ce452b6866585a61ff47bfdd3b2 /keyword-generation.sh
parentUpdate copyright years. (diff)
downloadebuild-mode-1d055c6902f338aacd3a312a0d2275d4ca3e5e74.tar.gz
ebuild-mode-1d055c6902f338aacd3a312a0d2275d4ca3e5e74.tar.bz2
ebuild-mode-1d055c6902f338aacd3a312a0d2275d4ca3e5e74.zip
Avoid deprecated "portageq portdir" call in keyword-generation.sh.
* keyword-generation.sh (ECLASSES, ECLASSFILES): Avoid deprecated "portageq portdir" call.
Diffstat (limited to 'keyword-generation.sh')
-rwxr-xr-xkeyword-generation.sh13
1 files changed, 9 insertions, 4 deletions
diff --git a/keyword-generation.sh b/keyword-generation.sh
index bc4648b..09f028d 100755
--- a/keyword-generation.sh
+++ b/keyword-generation.sh
@@ -8,12 +8,16 @@
#
# Generate a raw list for app-emacs/ebuild-mode
+REPO=gentoo
TMPFILE="$(mktemp ${TMPDIR:-/tmp}/keyword-generation.XXXXXX)"
-ECLASSDIR="$(portageq portdir)/eclass"
-ECLASSES=$(cd ${ECLASSDIR}; ls *.eclass | sed 's/\.eclass$//' | LC_ALL=C sort)
+ECLASSES=( $(portageq available_eclasses / ${REPO} | LC_ALL=C sort) )
+ECLASSFILES=( $(portageq eclass_path / ${REPO} "${ECLASSES[@]}") )
# Obsolete eclasses
OBSOLETE="bash-completion gems leechcraft ruby x-modular"
+# Arrays should have equal size
+[[ ${#ECLASSES[@]} -eq ${#ECLASSFILES[@]} ]] || exit 1
+
has() {
local needle=$1 item
shift
@@ -25,9 +29,10 @@ has() {
echo "Output in ${TMPFILE}"
-for eclass in ${ECLASSES}; do
+for (( i = 0; i < ${#ECLASSES[@]}; i++ )); do
+ eclass=${ECLASSES[i]}
has ${eclass} ${OBSOLETE} && continue
- file="${ECLASSDIR}/${eclass}.eclass"
+ file=${ECLASSFILES[i]}
grep -q "^# @DEAD$" "${file}" && continue
functions=$(env -i bash -c ". ${file}; declare -F" 2>/dev/null \