├── LICENSE ├── README.md └── bitbake /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Sergio Prado 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | bitbake-bash-completion 2 | ======================= 3 | 4 | Bitbake bash completion script 5 | 6 | 7 | How to use it? 8 | ============== 9 | 10 | Just copy the "bitbake" file to /etc/bash_completion.d: 11 | 12 | # cp bitbake /etc/bash_completion.d/ 13 | 14 | 15 | How does it work? 16 | ================= 17 | 18 | It will create 2 hidden files in the build directory on the first 19 | execution: 20 | 21 | .bblayers.recipes -> cache of available bitbake recipes 22 | .bblayers.conf.md5 -> bblayers.conf md5 checksum file 23 | 24 | It will create a new cache of available bitbake recipes in the 25 | following situations: 26 | 27 | 1. When updating the bblayers.conf file. 28 | 2. When running bitbake . 29 | 30 | 31 | Contributing and reporting bugs 32 | =============================== 33 | 34 | Please send any bug report, pull requests, patches, comments or questions 35 | to Sergio Prado . 36 | 37 | 38 | Maintainers 39 | =========== 40 | 41 | Sergio Prado 42 | -------------------------------------------------------------------------------- /bitbake: -------------------------------------------------------------------------------- 1 | #!bash 2 | # 3 | # Bash completion support for Bitbake 4 | # 5 | # Copyright (C) 2014 Sergio Prado 6 | # Distributed under the MIT License (MIT) 7 | # 8 | 9 | _bitbake() 10 | { 11 | local cur prev opts_short opts_long tasks recipes bbfile_entry recipe 12 | local ui bblayers_conf bblayers_md5 bblayers_bbfile bblayers_recipes 13 | local recipe_path 14 | 15 | COMPREPLY=() 16 | 17 | cur="${COMP_WORDS[COMP_CWORD]}" 18 | prev="${COMP_WORDS[COMP_CWORD-1]}" 19 | 20 | opts_short="-h -b -k -a -f -c -C -r -R -v -D -n -S -p -s -e -g -I \ 21 | -l -P -u -t -B -m" 22 | 23 | opts_long="--version --help --buildfile= --continue --tryaltconfigs \ 24 | --force --cmd= --clear-stamp= --read= --postread= --verbose \ 25 | --debug --dry-run --dump-signatures= --parse-only \ 26 | --show-versions --environment --graphviz --ignore-deps= \ 27 | --log-domains= --profile --ui= --servertype= --token= \ 28 | --revisions-changed --server-only --bind= --no-setscene \ 29 | --remote-server= --kill-server --observe-only \ 30 | --status-only" 31 | 32 | tasks="build bundle_initramfs checkuri checkuriall clean cleanall \ 33 | cleansstate compile configure devshell fetch fetchall \ 34 | install listtasks package package_setscene \ 35 | package_write_rpm package_write_rpm_setscene packagedata \ 36 | packagedata_setscene patch populate_lic \ 37 | populate_lic_setscene populate_sdk populate_sysroot \ 38 | populate_sysroot_setscene rootfs unpack compile_ptest_base \ 39 | configure_ptest_base diffconfig install_ptest_base \ 40 | menuconfig patch" 41 | 42 | ui="knotty hob depexp" 43 | 44 | if [[ "$prev" == "=" ]]; then 45 | prev="${COMP_WORDS[COMP_CWORD - 2]}" 46 | elif [[ "$cur" == "=" ]]; then 47 | cur="" 48 | fi 49 | 50 | case "$prev" in 51 | 52 | "-c"|"--cmd"|"-C"|"--clear-stamp") 53 | COMPREPLY=( $(compgen -W "${tasks}" -- ${cur}) ) 54 | return 0 55 | ;; 56 | 57 | "-u"|"--ui") 58 | COMPREPLY=( $(compgen -W "${ui}" -- ${cur}) ) 59 | return 0 60 | ;; 61 | 62 | esac 63 | 64 | case "$cur" in 65 | 66 | "--"*) 67 | COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) ) 68 | if [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} == "--"*"=" ]] ; then 69 | compopt -o nospace 70 | fi 71 | return 0 72 | ;; 73 | 74 | "-"*) 75 | COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) ) 76 | return 0 77 | ;; 78 | 79 | esac 80 | 81 | bblayers_conf="conf/bblayers.conf" 82 | bblayers_md5=".bblayers.conf.md5" 83 | bblayers_bbfile=".bblayers.bbfile" 84 | bblayers_recipes=".bblayers.recipes" 85 | 86 | _parse_recipes () { 87 | echo `bitbake -e | grep "^BBFILES=" | cut -d "=" -f 2 | sed -e 's/"//g'` > $bblayers_bbfile 88 | for bbfile_entry in `cat $bblayers_bbfile`; do 89 | if [ "${bbfile_entry%.bbappend}" = "${bbfile_entry}" ]; then 90 | echo $bbfile_entry 91 | fi 92 | done | while read recipe_path; do 93 | recipe="${recipe_path##*/}" 94 | recipe="${recipe%%_*.bb}" 95 | recipe="${recipe%%.bb}" 96 | if [ "$recipe" != "*" ]; then 97 | echo $recipe 98 | fi 99 | done > $bblayers_recipes 100 | rm -Rf $bblayers_bbfile 101 | } 102 | 103 | if [ ! -e $bblayers_conf ]; then 104 | return 0; 105 | fi 106 | 107 | if [ "$prev" = "bitbake" -a "$cur" = "" ]; then 108 | _parse_recipes 109 | fi 110 | 111 | md5sum --quiet --status -c $bblayers_md5 2>/dev/null 112 | if [ $? != 0 -o ! -e $bblayers_recipes ]; then 113 | md5sum $bblayers_conf > $bblayers_md5 114 | _parse_recipes 115 | fi 116 | 117 | recipes=`cat $bblayers_recipes` 118 | 119 | COMPREPLY=( $(compgen -W "${recipes}" -- ${cur}) ) 120 | return 0 121 | } 122 | complete -F _bitbake bitbake 123 | --------------------------------------------------------------------------------