Hi Prado, It's really a good idea. I've tried it out.
Attached is a patch to improve speed, accuracy and user experience. Regards, Chen Qi On 11/12/2014 08:27 AM, Sergio Prado wrote:
Hello all, I have just written a bitbake bash completion script so it could make my life easier when trying to discover a recipe name and bake it. https://github.com/sergioprado/bitbake-bash-completion It should complete all commands (bitbake 1.22.0), recipes and tasks. When running for the first time, it will execute "bitbake -e" to get the BBPATH variable and save it in a hidden file. It will use this file on subsequent executions. Feel free to try it and let me know if you find any bug or have suggestions on how to improve it. Thanks, Sergio Prado www.sergioprado.org https://twitter.com/sergioprado
>From 40497abfe58313ed9171abc122bffe559ca85509 Mon Sep 17 00:00:00 2001 From: Chen Qi <[email protected]> Date: Wed, 12 Nov 2014 02:06:49 -0500 Subject: [PATCH] Improve speed, accuracy and user experience Signed-off-by: Chen Qi <[email protected]> --- bitbake | 42 ++++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/bitbake b/bitbake index e904d97..63f2d52 100644 --- a/bitbake +++ b/bitbake @@ -9,7 +9,7 @@ _bitbake() { local cur prev opts_short opts_long tasks bbdir bbfile recipes - local ui bblayers_conf bblayers_md5 bblayers_bbpath + local ui bblayers_conf bblayers_md5 bblayers_bbfile bblayers_recipes COMPREPLY=() @@ -79,30 +79,40 @@ _bitbake() bblayers_conf="conf/bblayers.conf" bblayers_md5=".bblayers.conf.md5" - bblayers_bbpath=".bblayers.bbpath" + bblayers_bbfile=".bblayers.bbfile" + bblayers_recipes=".bblayers.recipes" + + _parse_recipes () { + echo `bitbake -e | grep "^BBFILES=" | cut -d "=" -f 2 | sed -e 's/"//g'` > $bblayers_bbfile + for bbfile_entry in `cat $bblayers_bbfile`; do + if [ "${bbfile_entry%.bbappend}" = "${bbfile_entry}" ]; then + echo $bbfile_entry + fi + done | while read recipe_path; do + recipe="${recipe_path##*/}" + recipe="${recipe%%_*.bb}" + recipe="${recipe%%.bb}" + if [ "$recipe" != "*" ]; then + echo $recipe + fi + done > $bblayers_recipes + } if [ ! -e $bblayers_conf ]; then return 0; fi + if [ "$prev" = "bitbake" -a "$cur" = "" ]; then + _parse_recipes + fi + md5sum --quiet --status -c $bblayers_md5 2>/dev/null - if [ $? != 0 -o ! -e $bblayers_bbpath ]; then - printf "\nReading BBPATH..." + if [ $? != 0 -o ! -e $bblayers_recipes ]; then md5sum $bblayers_conf > $bblayers_md5 - echo `bitbake -e | grep "^BBPATH=" | cut -d "=" -f 2 | sed -e 's/^"//' -e 's/"$//'` > $bblayers_bbpath - echo "done! Press TAB to continue..." + _parse_recipes fi - for bbdir in `cat $bblayers_bbpath | sed s/:/\ /g`; do - for bbfile in `echo $bbdir/*/*/${cur}*.bb`; do - if [ -e $bbfile ]; then - bbfile=`basename $bbfile` - bbfile=${bbfile%%_*.bb} - bbfile=${bbfile%%.bb} - recipes="$recipes $bbfile" - fi - done - done + recipes=`cat $bblayers_recipes` COMPREPLY=( $(compgen -W "${recipes}" -- ${cur}) ) return 0 -- 1.7.9.5
-- _______________________________________________ yocto mailing list [email protected] https://lists.yoctoproject.org/listinfo/yocto
