summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2012-09-22 19:14:20 +0200
committerUlrich Müller <ulm@gentoo.org>2012-09-22 19:14:20 +0200
commit9175c9a69a32d23bbc4fdc921fe6ebad9e1dd333 (patch)
tree43751d3b47731e94138a87f369df1076b063c0d6
parentkeyword-generation.sh: Add myself as author. (diff)
downloadebuild-mode-9175c9a69a32d23bbc4fdc921fe6ebad9e1dd333.tar.gz
ebuild-mode-9175c9a69a32d23bbc4fdc921fe6ebad9e1dd333.tar.bz2
ebuild-mode-9175c9a69a32d23bbc4fdc921fe6ebad9e1dd333.zip
Use the shell for parsing of eclasses' environment.
-rw-r--r--ChangeLog3
-rw-r--r--keyword-generation.sh21
2 files changed, 15 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 01e4472..abf170d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,7 +2,8 @@
* keyword-generation.sh: Drop dead or removed eclasses from
obsolete list. Sort it alphabetically. Skip any eclass that is
- marked with a @DEAD token.
+ marked with a @DEAD token. Use the shell for parsing of eclasses'
+ environment.
(has): New function.
(ECLASSDIR, OBSOLETE): New variables.
diff --git a/keyword-generation.sh b/keyword-generation.sh
index dd7027f..6d88e17 100644
--- a/keyword-generation.sh
+++ b/keyword-generation.sh
@@ -24,21 +24,26 @@ has() {
return 1
}
-echo Output in ${TMPFILE}
-echo Manual parsing of mercurial.eclass needed! Do not forget!
+echo "Output in ${TMPFILE}"
for eclass in ${ECLASSES}; do
has ${eclass%.eclass} ${OBSOLETE} && continue
grep -q "^# @DEAD$" "${ECLASSDIR}/${eclass}" && continue
- echo '(defvar ebuild-mode-keywords-'${eclass//.eclass/} >>${TMPFILE}
- echo -n \'\(\($(LC_ALL=C grep '^[A-Za-z0-9._-]*()' "${ECLASSDIR}/${eclass}"|sed -e 's:\(^.*\)().*:"\1":g')\)>>${TMPFILE}
- echo >>${TMPFILE}
- echo font-lock-type-face\)\)>>${TMPFILE}
- echo >>${TMPFILE}
+
+ functions=$(env -i bash -c \
+ ". ${ECLASSDIR}/${eclass}; declare -F" 2>/dev/null \
+ | sed 's/.*[[:space:]]\(.*\)/"\1"/')
+
+ {
+ echo "(defvar ebuild-mode-keywords-${eclass%.eclass}"
+ echo " '(("${functions}")"
+ echo " font-lock-type-face))"
+ echo
+ } >>"${TMPFILE}"
done
emacs -q --batch \
- --visit ${TMPFILE} \
+ --visit "${TMPFILE}" \
--eval "(emacs-lisp-mode)" \
--eval "(indent-region (point-min) (point-max))" \
--eval "(let ((fill-column 78)