Skip to contentSkip to conversation

[] Add files supporting bash completion for bitbake tools

PATCH Łukasz Gardoń 3 participants 7 messages Sep 1, 2018 – Sep 7, 2018 11 messages not in the archive

lore
Share & tools
lore
#0 lore raw

Repository with more details:
https://github.com/lukaszgard/bitbake-completion

---
 contrib/completion/bash/bitbake_completion    | 108 ++++++++++
 .../bash/bitbake_diffsigs_completion          |  86 ++++++++
 .../bash/bitbake_dumpsig_completion           |  89 +++++++++
 .../completion/bash/bitbake_layers_completion | 188 ++++++++++++++++++
 .../completion/bash/bitbake_prserv_completion |  76 +++++++
 .../bash/bitbake_selftest_completion          |  34 ++++
 6 files changed, 581 insertions(+)
 create mode 100644 contrib/completion/bash/bitbake_completion
 create mode 100644 contrib/completion/bash/bitbake_diffsigs_completion
 create mode 100644 contrib/completion/bash/bitbake_dumpsig_completion
 create mode 100644 contrib/completion/bash/bitbake_layers_completion
 create mode 100644 contrib/completion/bash/bitbake_prserv_completion
 create mode 100644 contrib/completion/bash/bitbake_selftest_completion
contrib/completion/bash/bitbake_completion new file +108 -0
new file mode 100644
index 00000000..23cadf6e
@@ -0,0 +1,108 @@
+#!bash
+# Bash completion support for bitbake 1.39.1 release.
+#
+# Copyright (C) 2014 Sergio Prado <[email protected]>
+# Copyright (C) 2018 Lukasz Gardon <[email protected]>
+#
+# Distributed under the MIT License (MIT)
+#
+
+_bitbake()
+{
+    local cur prev opts_short opts_long tasks recipes ui
+    local bb_layers_conf bb_layers_md5 bb_recipes
+
+    COMPREPLY=()
+
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+    opts_short="-h -b -k -f -c -C -r -R -v -D -q -n -S -p -s -e -g -I \
+                -l -P -u -B -T -m -w"
+
+    opts_long="--version --help --buildfile= --continue --force --cmd= \
+               --clear-stamp= --read= --postread= --verbose --debug --quiet \
+               --dry-run --dump-signatures= --parse-only --show-versions \
+               --environment --graphviz --ignore-deps= --log-domains= --profile \
+               --ui= --token= --revisions-changed --server-only --bind= \
+               --idle-timeout= --no-setscene --setscene-only --remote-server= \
+               --kill-server --observe-only --status-only --write-log= --runall= \
+               --runonly="
+
+    tasks="build compile compile_ptest_base configure configure_ptest_base deploy \
+           distrodata fetch image image_complete install install_ptest_base package \
+           package_qa package_write_deb package_write_ipk package_write_rpm package_write_tar \
+           packagedata patch populate_lic populate_sdk populate_sysroot prepare_recipe_sysroot \
+           rm_work rm_work_all unpack checkpkg checkuri clean cleanall cleansstate devpyshell \
+           devshell listtasks package_index bootimg bundle_initramfs rootfs testimage \
+           testimage_auto compile_kernelmodules diffconfig kernel_checkout kernel_configcheck \
+           kernel_configme kernel_menuconfig kernel_metadata menuconfig savedefconfig shared_workdir \
+           sizecheck strip validate_branches spdx"
+
+    ui="knotty ncurses taskexp"
+
+    if [[ "$prev" == "=" ]]; then
+        prev="${COMP_WORDS[COMP_CWORD - 2]}"
+    elif [[ "$cur" == "=" ]]; then
+        cur=""
+    fi
+
+    conf_files=$(find . -maxdepth 1 -name "*.conf" -type f -printf '%P\n')
+
+    case "$prev" in
+        "-c"|"--cmd"|"-C"|"--clear-stamp"|"--ignore-deps"|"--runall"|"--runonly")
+            COMPREPLY=( $(compgen -W "${tasks}" -- ${cur}) )
+            return 0
+        ;;
+        "-r"|"--read"|"-R"|"--postread")
+            COMPREPLY=( $(compgen -W "${conf_files}" -- ${cur}) )
+            return 0
+        ;;
+        "-u"|"--ui")
+            COMPREPLY=( $(compgen -W "${ui}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+
+    case "$cur" in
+        "--"*)
+            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
+            if [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} == "--"*"=" ]] ; then
+                compopt -o nospace
+            fi
+            return 0
+        ;;
+        "-"*)
+            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+
+    bb_layers_conf="conf/bblayers.conf"
+    bb_layers_md5=".bb_layers_conf.md5"
+    bb_recipes=".bb_recipes"
+
+    _parse_recipes () {
+        bitbake -s | sed -e '0,/^=.*/d' -e '/^\s*$/d' -e '/^Summary:/d' | awk '{print $1}' > $bb_recipes
+    }
+
+    if [ ! -e $bb_layers_conf ]; then
+        return 0
+    fi
+
+    if [ "$prev" = "bitbake" -a "$cur" = "" ]; then
+        _parse_recipes
+    fi
+
+    md5sum --quiet --status -c $bb_layers_md5 2>/dev/null
+    if [ $? != 0 -o ! -e $bb_recipes ]; then
+         md5sum $bb_layers_conf > $bb_layers_md5
+         _parse_recipes
+    fi
+
+    recipes=$(cat $bb_recipes)
+
+    COMPREPLY=( $(compgen -W "${recipes}" -- ${cur}) )
+    return 0
+}
+complete -F _bitbake bitbake
\ No newline at end of file
contrib/completion/bash/bitbake_diffsigs_completion new file +86 -0

87 lines not on this page · raw message

contrib/completion/bash/bitbake_dumpsig_completion new file +89 -0

90 lines not on this page · raw message

contrib/completion/bash/bitbake_layers_completion new file +188 -0

189 lines not on this page · raw message

contrib/completion/bash/bitbake_prserv_completion new file +76 -0

77 lines not on this page · raw message

contrib/completion/bash/bitbake_selftest_completion new file +34 -0
new file mode 100644
index 00000000..8b6bf641
@@ -0,0 +1,34 @@
+#!bash
+# Bash completion support for bitbake-selftest tool,
+# compatible with Bitbake version 1.39.1.
+#
+# Copyright (C) 2018 Lukasz Gardon <[email protected]>
+#
+# Distributed under the MIT License (MIT)
+#
+
+_bitbake_selftest()
+{
+    local cur prev opts_short opts_long
+
+    COMPREPLY=()
+
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+    opts_short="-h -v -q -f -c"
+
+    opts_long="--help --verbose --quiet --locals --failfast --catch"
+
+    case "$cur" in
+        "--"*)
+            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
+            return 0
+        ;;
+        "-"*)
+            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+}
+complete -F _bitbake_selftest bitbake-selftest
\ No newline at end of file
Signature · 1 line
2.18.0
#1 lore raw

The right upstream destination for this is almost certainly
https://github.com/scop/bash-completion

Alex

2018-09-01 15:36 GMT+02:00 Łukasz Gardoń <[email protected]>:

Quoted 650 lines

Repository with more details:
https://github.com/lukaszgard/bitbake-completion

---
 contrib/completion/bash/bitbake_completion    | 108 ++++++++++
 .../bash/bitbake_diffsigs_completion          |  86 ++++++++
 .../bash/bitbake_dumpsig_completion           |  89 +++++++++
 .../completion/bash/bitbake_layers_completion | 188 ++++++++++++++++++
 .../completion/bash/bitbake_prserv_completion |  76 +++++++
 .../bash/bitbake_selftest_completion          |  34 ++++
 6 files changed, 581 insertions(+)
 create mode 100644 contrib/completion/bash/bitbake_completion
 create mode 100644 contrib/completion/bash/bitbake_diffsigs_completion
 create mode 100644 contrib/completion/bash/bitbake_dumpsig_completion
 create mode 100644 contrib/completion/bash/bitbake_layers_completion
 create mode 100644 contrib/completion/bash/bitbake_prserv_completion
 create mode 100644 contrib/completion/bash/bitbake_selftest_completion
contrib/completion/bash/bitbake_completion new file +108 -0
new file mode 100644
index 00000000..23cadf6e
@@ -0,0 +1,108 @@
+#!bash
+# Bash completion support for bitbake 1.39.1 release.
+#
+# Copyright (C) 2014 Sergio Prado <[email protected]>
+# Copyright (C) 2018 Lukasz Gardon <[email protected]>
+#
+# Distributed under the MIT License (MIT)
+#
+
+_bitbake()
+{
+    local cur prev opts_short opts_long tasks recipes ui
+    local bb_layers_conf bb_layers_md5 bb_recipes
+
+    COMPREPLY=()
+
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+    opts_short="-h -b -k -f -c -C -r -R -v -D -q -n -S -p -s -e -g -I \
+                -l -P -u -B -T -m -w"
+
+    opts_long="--version --help --buildfile= --continue --force --cmd= \
+               --clear-stamp= --read= --postread= --verbose --debug --quiet \
+               --dry-run --dump-signatures= --parse-only --show-versions \
+               --environment --graphviz --ignore-deps= --log-domains= --profile \
+               --ui= --token= --revisions-changed --server-only --bind= \
+               --idle-timeout= --no-setscene --setscene-only --remote-server= \
+               --kill-server --observe-only --status-only --write-log= --runall= \
+               --runonly="
+
+    tasks="build compile compile_ptest_base configure configure_ptest_base deploy \
+           distrodata fetch image image_complete install install_ptest_base package \
+           package_qa package_write_deb package_write_ipk package_write_rpm package_write_tar \
+           packagedata patch populate_lic populate_sdk populate_sysroot prepare_recipe_sysroot \
+           rm_work rm_work_all unpack checkpkg checkuri clean cleanall cleansstate devpyshell \
+           devshell listtasks package_index bootimg bundle_initramfs rootfs testimage \
+           testimage_auto compile_kernelmodules diffconfig kernel_checkout kernel_configcheck \
+           kernel_configme kernel_menuconfig kernel_metadata menuconfig savedefconfig shared_workdir \
+           sizecheck strip validate_branches spdx"
+
+    ui="knotty ncurses taskexp"
+
+    if [[ "$prev" == "=" ]]; then
+        prev="${COMP_WORDS[COMP_CWORD - 2]}"
+    elif [[ "$cur" == "=" ]]; then
+        cur=""
+    fi
+
+    conf_files=$(find . -maxdepth 1 -name "*.conf" -type f -printf '%P\n')
+
+    case "$prev" in
+        "-c"|"--cmd"|"-C"|"--clear-stamp"|"--ignore-deps"|"--runall"|"--runonly")
+            COMPREPLY=( $(compgen -W "${tasks}" -- ${cur}) )
+            return 0
+        ;;
+        "-r"|"--read"|"-R"|"--postread")
+            COMPREPLY=( $(compgen -W "${conf_files}" -- ${cur}) )
+            return 0
+        ;;
+        "-u"|"--ui")
+            COMPREPLY=( $(compgen -W "${ui}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+
+    case "$cur" in
+        "--"*)
+            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
+            if [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} == "--"*"=" ]] ; then
+                compopt -o nospace
+            fi
+            return 0
+        ;;
+        "-"*)
+            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+
+    bb_layers_conf="conf/bblayers.conf"
+    bb_layers_md5=".bb_layers_conf.md5"
+    bb_recipes=".bb_recipes"
+
+    _parse_recipes () {
+        bitbake -s | sed -e '0,/^=.*/d' -e '/^\s*$/d' -e '/^Summary:/d' | awk '{print $1}' > $bb_recipes
+    }
+
+    if [ ! -e $bb_layers_conf ]; then
+        return 0
+    fi
+
+    if [ "$prev" = "bitbake" -a "$cur" = "" ]; then
+        _parse_recipes
+    fi
+
+    md5sum --quiet --status -c $bb_layers_md5 2>/dev/null
+    if [ $? != 0 -o ! -e $bb_recipes ]; then
+         md5sum $bb_layers_conf > $bb_layers_md5
+         _parse_recipes
+    fi
+
+    recipes=$(cat $bb_recipes)
+
+    COMPREPLY=( $(compgen -W "${recipes}" -- ${cur}) )
+    return 0
+}
+complete -F _bitbake bitbake
\ No newline at end of file
contrib/completion/bash/bitbake_diffsigs_completion new file +86 -0
new file mode 100644
index 00000000..cbf2c5f1
@@ -0,0 +1,86 @@
+#!bash
+# Bash completion support for bitbake-diffsigs tool,
+# compatible with Bitbake 1.39.1.
+#
+# Copyright (C) 2018 Lukasz Gardon <[email protected]>
+#
+# Distributed under the MIT License (MIT)
+#
+
+_bitbake_diffsigs()
+{
+    local cur prev opts_short opts_long tasks colors
+    local bb_layers_conf bb_layers_md5 bb_recipes
+
+    COMPREPLY=()
+
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+    opts_short="-h -d -t -s"
+
+    opts_long="--help --debug --color --task --signature"
+
+    tasks="build compile compile_ptest_base configure configure_ptest_base deploy \
+           distrodata fetch image image_complete install install_ptest_base package \
+           package_qa package_write_deb package_write_ipk package_write_rpm package_write_tar \
+           packagedata patch populate_lic populate_sdk populate_sysroot prepare_recipe_sysroot \
+           rm_work rm_work_all unpack checkpkg checkuri clean cleanall cleansstate devpyshell \
+           devshell listtasks package_index bootimg bundle_initramfs rootfs testimage \
+           testimage_auto compile_kernelmodules diffconfig kernel_checkout kernel_configcheck \
+           kernel_configme kernel_menuconfig kernel_metadata menuconfig savedefconfig shared_workdir \
+           sizecheck strip validate_branches spdx"
+
+    colors="auto always never"
+
+    case "$cur" in
+        "--"*)
+            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
+            return 0
+        ;;
+        "-"*)
+            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+
+    bb_layers_conf="conf/bblayers.conf"
+    bb_layers_md5=".bb_layers_conf.md5"
+    bb_recipes=".bb_recipes"
+
+    _parse_recipes () {
+        bitbake -s | sed -e '0,/^=.*/d' -e '/^\s*$/d' -e '/^Summary:/d' | awk '{print $1}' > $bb_recipes
+    }
+
+    if [ ! -e $bb_layers_conf ]; then
+        return 0
+    fi
+
+    if [ "$prev" = "bitbake" -a "$cur" = "" ]; then
+           _parse_recipes
+    fi
+
+    md5sum --quiet --status -c $bb_layers_md5 2>/dev/null
+    if [ $? != 0 -o ! -e $bb_recipes ]; then
+        md5sum $bb_layers_conf > $bb_layers_md5
+        _parse_recipes
+    fi
+
+    recipes=$(cat $bb_recipes)
+
+    case "$prev" in
+        "-c"|"--color")
+            COMPREPLY=( $(compgen -W "${colors}" -- ${cur}) )
+            return 0
+        ;;
+        "-t"|"--task")
+          COMPREPLY=( $(compgen -W "${recipes}" -- ${cur}) )
+          return 0
+    esac
+
+    if [[ ${COMP_WORDS[COMP_CWORD -2]} == "-t" ]] || [[ ${COMP_WORDS[COMP_CWORD -2]} == "--task" ]]; then
+        COMPREPLY=( $(compgen -W "${tasks}" -- ${cur}) )
+           return 0
+    fi
+}
+complete -F _bitbake_diffsigs bitbake-diffsigs
\ No newline at end of file
contrib/completion/bash/bitbake_dumpsig_completion new file +89 -0
new file mode 100644
index 00000000..95eb2394
@@ -0,0 +1,89 @@
+#!bash
+# Bash completion support for bitbake-dumpsig tool,
+# compatible with Bitbake 1.39.1.
+#
+# Copyright (C) 2018 Lukasz Gardon <[email protected]>
+#
+# Distributed under the MIT License (MIT)
+#
+
+_bitbake_dumpsig()
+{
+    local cur prev opts_short opts_long tasks
+    local bb_layers_conf bb_layers_md5 bb_recipes
+
+    COMPREPLY=()
+
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+    opts_short="-h -d -t"
+
+    opts_long="--help --debug --task="
+
+    tasks="build compile compile_ptest_base configure configure_ptest_base deploy \
+           distrodata fetch image image_complete install install_ptest_base package \
+           package_qa package_write_deb package_write_ipk package_write_rpm package_write_tar \
+           packagedata patch populate_lic populate_sdk populate_sysroot prepare_recipe_sysroot \
+           rm_work rm_work_all unpack checkpkg checkuri clean cleanall cleansstate devpyshell \
+           devshell listtasks package_index bootimg bundle_initramfs rootfs testimage \
+           testimage_auto compile_kernelmodules diffconfig kernel_checkout kernel_configcheck \
+           kernel_configme kernel_menuconfig kernel_metadata menuconfig savedefconfig shared_workdir \
+           sizecheck strip validate_branches spdx"
+
+    if [[ "$prev" == "=" ]]; then
+        prev="${COMP_WORDS[COMP_CWORD - 2]}"
+    elif [[ "$cur" == "=" ]]; then
+        cur=""
+    fi
+
+    case "$cur" in
+        "--"*)
+            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
+            if [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} == "--"*"=" ]] ; then
+                compopt -o nospace
+            fi
+            return 0
+        ;;
+        "-"*)
+            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+
+    bb_layers_conf="conf/bblayers.conf"
+    bb_layers_md5=".bb_layers_conf.md5"
+    bb_recipes=".bb_recipes"
+
+    _parse_recipes () {
+        bitbake -s | sed -e '0,/^=.*/d' -e '/^\s*$/d' -e '/^Summary:/d' | awk '{print $1}' > $bb_recipes
+    }
+
+    if [ ! -e $bb_layers_conf ]; then
+        return 0
+    fi
+
+    if [ "$prev" = "bitbake" -a "$cur" = "" ]; then
+           _parse_recipes
+    fi
+
+    md5sum --quiet --status -c $bb_layers_md5 2>/dev/null
+    if [ $? != 0 -o ! -e $bb_recipes ]; then
+        md5sum $bb_layers_conf > $bb_layers_md5
+        _parse_recipes
+    fi
+
+    recipes=$(cat $bb_recipes)
+
+    case "$prev" in
+        "-t"|"--task")
+           COMPREPLY=( $(compgen -W "${recipes}" -- ${cur}) )
+           return 0
+    esac
+
+    if [[ ${COMP_WORDS[COMP_CWORD -2]} =~ "-t" ]] || [[ ${COMP_WORDS[COMP_CWORD -3]} == "--task" ]]; then
+        COMPREPLY=( $(compgen -W "${tasks}" -- ${cur}) )
+           return 0
+    fi
+}
+complete -F _bitbake_dumpsig bitbake-dumpsig
\ No newline at end of file
contrib/completion/bash/bitbake_layers_completion new file +188 -0
new file mode 100644
index 00000000..37ca8afb
@@ -0,0 +1,188 @@
+#!bash
+# Bash completion support for bitbake-layers tool,
+# compatible with Bitbake 1.39.1.
+#
+# Copyright (C) 2018 Lukasz Gardon <[email protected]>
+#
+# Distributed under the MIT License (MIT)
+#
+
+_bitbake_layers()
+{
+    local cur prev opts_short opts_long subcommands colors
+    local opts_long_add_layer opts_short_add_layer opts_long_show_overlayed
+    local opts_short_show_overlayed opts_long_show_recipes opts_short_show_recipes
+    local opts_long_show_cross_depends opts_short_show_cross_depends
+    local opts_long_show_layerindex_fetch opts_short_show_layerindex_fetch
+    local opts_long_show_layerindex_show_depends opts_short_show_layerindex_show_depends
+    local opts_long_show_create_layer opts_short_show_create_layer bb_class_files classes
+
+    COMPREPLY=()
+
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+    opts_short="-d -q -F -h"
+
+    opts_long="--debug --quiet --force --color --help"
+
+    subcommands="layerindex-fetch layerindex-show-depends add-layer \
+                    remove-layer flatten show-layers show-overlayed \
+                        show-recipes show-appends show-cross-depends \
+                        create-layer"
+
+    colors="auto always never"
+
+    opts_long_show_overlayed="--help --filenames --same-version"
+    opts_short_show_overlayed="-h -f -s"
+
+    opts_long_show_recipes="--help --filenames --multiple --inherits"
+    opts_short_show_recipes="-h -f -m -i"
+
+    opts_long_show_layerindex_fetch="--help --show-only --branch --ignore"
+    opts_short_show_layerindex_fetch="-h -n -b -i"
+
+    opts_long_add_layer="--help --priority --example-recipe-name --example-recipe-version"
+    opts_short_add_layer="-h"
+
+    opts_long_show_cross_depends="--help --filenames --ignore"
+    opts_short_show_cross_depends="-h -f -i"
+
+    opts_long_show_layerindex_show_depends="--help --branch"
+    opts_short_show_layerindex_show_depends="-h -b"
+
+    opts_long_show_create_layer="--help --priority --example-recipe-name --example-recipe-version"
+    opts_short_show_create_layer="-h -p -e -v"
+
+    bb_class_files=".bb_class_files"
+
+    _get_classes() {
+        find $BBPATH/../meta*/classes/ -name *.bbclass -exec basename {} \; | sed 's/.bbclass//' > $bb_class_files
+    }
+
+    if [[ "${COMP_WORDS[@]}" =~ show-recipes ]] ; then
+        if [[ "$prev" == "--inherits" ]] || [[ "$prev" == "-i" ]]; then
+            _get_classes
+            classes=$(cat $bb_class_files)
+            COMPREPLY=( $(compgen -W "${classes}" -- ${cur}) )
+            return 0
+        fi
+    fi
+
+    if [[ "${COMP_WORDS[1]}" =~ show-layers|show-appends|remove-layer|flatten ]]; then
+        case "$cur" in
+            "--"*)
+                COMPREPLY=( $(compgen -W "--help" -- ${cur}) )
+                return 0
+            ;;
+            "-"*)
+                COMPREPLY=( $(compgen -W "-h" -- ${cur}) )
+                return 0
+            ;;
+        esac
+    elif [[ "${COMP_WORDS[1]}" == "add-layer" ]]; then
+        case "$cur" in
+            "--"*|"")
+                COMPREPLY=( $(compgen -W "${opts_long_add_layer}" -- ${cur}) )
+                return 0
+            ;;
+            "-"*)
+                COMPREPLY=( $(compgen -W "${opts_short_add_layer}" -- ${cur}) )
+                return 0
+            ;;
+        esac
+    elif [[ "${COMP_WORDS[1]}" == "show-overlayed" ]]; then
+        case "$cur" in
+            "--"*|"")
+                COMPREPLY=( $(compgen -W "${opts_long_show_overlayed}" -- ${cur}) )
+                return 0
+            ;;
+            "-"*)
+                COMPREPLY=( $(compgen -W "${opts_short_show_overlayed}" -- ${cur}) )
+                return 0
+            ;;
+        esac
+    elif [[ "${COMP_WORDS[1]}" == "show-recipes" ]]; then
+        case "$cur" in
+            "--"*|"")
+                COMPREPLY=( $(compgen -W "${opts_long_show_recipes}" -- ${cur}) )
+                return 0
+            ;;
+            "-"*)
+                COMPREPLY=( $(compgen -W "${opts_short_show_recipes}" -- ${cur}) )
+                return 0
+            ;;
+        esac
+    elif [[ "${COMP_WORDS[1]}" == "show-cross-depends" ]]; then
+        case "$cur" in
+            "--"*|"")
+                COMPREPLY=( $(compgen -W "${opts_long_show_cross_depends}" -- ${cur}) )
+                return 0
+            ;;
+            "-"*)
+                COMPREPLY=( $(compgen -W "${opts_short_show_cross_depends}" -- ${cur}) )
+                return 0
+            ;;
+        esac
+    elif [[ "${COMP_WORDS[1]}" == "layerindex-fetch" ]]; then
+        case "$cur" in
+            "--"*|"")
+                COMPREPLY=( $(compgen -W "${opts_long_show_layerindex_fetch}" -- ${cur}) )
+                return 0
+            ;;
+            "-"*)
+                COMPREPLY=( $(compgen -W "${opts_short_show_layerindex_fetch}" -- ${cur}) )
+                return 0
+            ;;
+        esac
+    elif [[ "${COMP_WORDS[1]}" == "layerindex-show-depends" ]]; then
+        case "$cur" in
+            "--"*|"")
+                COMPREPLY=( $(compgen -W "${opts_long_show_layerindex_show_depends}" -- ${cur}) )
+                return 0
+            ;;
+            "-"*)
+                COMPREPLY=( $(compgen -W "${opts_short_show_layerindex_show_depends}" -- ${cur}) )
+                return 0
+            ;;
+        esac
+    elif [[ "${COMP_WORDS[1]}" == "create-layer" ]]; then
+        case "$cur" in
+            "--"*|"")
+                COMPREPLY=( $(compgen -W "${opts_long_show_create_layer}" -- ${cur}) )
+                return 0
+            ;;
+            "-"*)
+                COMPREPLY=( $(compgen -W "${opts_short_show_create_layer}" -- ${cur}) )
+                return 0
+            ;;
+        esac
+    fi
+
+    case "$prev" in
+        "-c"|"--color")
+            COMPREPLY=( $(compgen -W "${colors}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+
+    case "$cur" in
+        "--"*)
+            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
+            return 0
+        ;;
+        "-"*)
+            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+
+    if [[ ${prev} == "bitbake-layers" ]]; then
+        COMPREPLY=( $(compgen -W "${subcommands}" -- ${cur}) )
+        return 0
+    elif [[ ! ${subcommands} =~ [[:space:]]${cur}[[:space:]] ]]; then
+        COMPREPLY=( $(compgen -W "${subcommands}" -- ${cur}) )
+        return 0
+    fi
+}
+complete -F _bitbake_layers bitbake-layers
\ No newline at end of file
contrib/completion/bash/bitbake_prserv_completion new file +76 -0
new file mode 100644
index 00000000..3bca1197
@@ -0,0 +1,76 @@
+#!bash
+# Bash completion support for bitbake-prserv tool,
+# compatible with Bitbake 1.39.1.
+#
+# Copyright (C) 2018 Lukasz Gardon <[email protected]>
+#
+# Distributed under the MIT License (MIT)
+#
+
+_bitbake_prserv()
+{
+    local cur prev opts_short opts_long subcommands file_default log_default log_levels
+
+    COMPREPLY=()
+
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+    opts_short="-h -f -l"
+
+    opts_long="--version --help --file= --log= --loglevel= --start \
+                  --stop --host= --port="
+
+    subcommands="layerindex-fetch layerindex-show-depends add-layer \
+                    remove-layer flatten show-layers show-overlayed \
+                        show-recipes show-appends show-cross-depends \
+                        create-layer"
+
+    file_default="prserv.sqlite3"
+    log_default="prserv.log"
+    log_levels="CRITICAL ERROR WARNING INFO DEBUG"
+
+    if [[ "$prev" == "=" ]]; then
+        prev="${COMP_WORDS[COMP_CWORD -2]}"
+    elif [[ "$cur" == "=" ]]; then
+        cur=""
+    fi
+
+    case "$prev" in
+        "-f"|"--file")
+            COMPREPLY=( $(compgen -W "${file_default}" -- ${cur}) )
+            return 0
+        ;;
+        "-l"|"--log")
+            COMPREPLY=( $(compgen -W "${log_default}" -- ${cur}) )
+            return 0
+        ;;
+        "--loglevel")
+            COMPREPLY=( $(compgen -W "${log_levels}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+
+    case "$cur" in
+        "--"*|"")
+            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
+            if [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} == "--"*"=" ]] ; then
+                compopt -o nospace
+            fi
+            return 0
+        ;;
+        "-"*)
+            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+
+    if [[ ${prev} == "bitbake-layers" ]]; then
+        COMPREPLY=( $(compgen -W "${subcommands}" -- ${cur}) )
+        return 0
+    elif [[ ! ${subcommands} =~ [[:space:]]${cur}[[:space:]] ]]; then
+        COMPREPLY=( $(compgen -W "${subcommands}" -- ${cur}) )
+        return 0
+    fi
+}
+complete -F _bitbake_prserv bitbake-prserv
\ No newline at end of file
contrib/completion/bash/bitbake_selftest_completion new file +34 -1
new file mode 100644
index 00000000..8b6bf641
@@ -0,0 +1,34 @@
+#!bash
+# Bash completion support for bitbake-selftest tool,
+# compatible with Bitbake version 1.39.1.
+#
+# Copyright (C) 2018 Lukasz Gardon <[email protected]>
+#
+# Distributed under the MIT License (MIT)
+#
+
+_bitbake_selftest()
+{
+    local cur prev opts_short opts_long
+
+    COMPREPLY=()
+
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+    opts_short="-h -v -q -f -c"
+
+    opts_long="--help --verbose --quiet --locals --failfast --catch"
+
+    case "$cur" in
+        "--"*)
+            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
+            return 0
+        ;;
+        "-"*)
+            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+}
+complete -F _bitbake_selftest bitbake-selftest
\ No newline at end of file
--

2.18.0

--
_______________________________________________
bitbake-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/bitbake-devel

#3 lore raw

Re: Add files supporting bash completion for bitbake tools

In reply to a message not in the archive

Hello Lukasz,

nobody will find your contributions in bitbake/contrib, and so they will be unused and will bitrot. The proper place is the upstream bash-completion project, which will get picked up by all Linux distributions.

Alex

2018-09-02 12:27 GMT+02:00 Łukasz Gardoń <[email protected]>:

Quoted 734 lines

Hi Alex,

With information comes file from bitbake repository - bitbake/contrib/README: "This directory is for additional contributed files which may be useful.”.
I think that this is proper place for such files.

Wiadomość napisana przez Alexander Kanavin <[email protected]> w dniu 01.09.2018, o godz. 21:33:

The right upstream destination for this is almost certainly
https://github.com/scop/bash-completion

Alex

2018-09-01 15:36 GMT+02:00 Łukasz Gardoń <[email protected]>:

Repository with more details:
https://github.com/lukaszgard/bitbake-completion

---

contrib/completion/bash/bitbake_completion    | 108 ++++++++++
.../bash/bitbake_diffsigs_completion          |  86 ++++++++
.../bash/bitbake_dumpsig_completion           |  89 +++++++++
.../completion/bash/bitbake_layers_completion | 188 ++++++++++++++++++
.../completion/bash/bitbake_prserv_completion |  76 +++++++
.../bash/bitbake_selftest_completion          |  34 ++++
6 files changed, 581 insertions(+)

create mode 100644 contrib/completion/bash/bitbake_completion create mode 100644 contrib/completion/bash/bitbake_diffsigs_completion create mode 100644 contrib/completion/bash/bitbake_dumpsig_completion create mode 100644 contrib/completion/bash/bitbake_layers_completion create mode 100644 contrib/completion/bash/bitbake_prserv_completion create mode 100644 contrib/completion/bash/bitbake_selftest_completion

contrib/completion/bash/bitbake_completion new file +24 -0
new file mode 100644
index 00000000..23cadf6e
@@ -0,0 +1,108 @@
+#!bash
+# Bash completion support for bitbake 1.39.1 release.
+#
+# Copyright (C) 2014 Sergio Prado <[email protected]>
+# Copyright (C) 2018 Lukasz Gardon <[email protected]>
+#
+# Distributed under the MIT License (MIT)
+#
+
+_bitbake()
+{
+    local cur prev opts_short opts_long tasks recipes ui
+    local bb_layers_conf bb_layers_md5 bb_recipes
+
+    COMPREPLY=()
+
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+    opts_short="-h -b -k -f -c -C -r -R -v -D -q -n -S -p -s -e -g -I \
+                -l -P -u -B -T -m -w"
+
+    opts_long="--version --help --buildfile= --continue --force --cmd= \
+               --clear-stamp= --read= --postread= --verbose --debug --quiet

\

contrib/completion/bash/bitbake_completion new file +8 -3
+               --dry-run --dump-signatures= --parse-only --show-versions \
+               --environment --graphviz --ignore-deps= --log-domains=
--profile \
+               --ui= --token= --revisions-changed --server-only --bind= \
+               --idle-timeout= --no-setscene --setscene-only
--remote-server= \
+               --kill-server --observe-only --status-only --write-log=
--runall= \
+               --runonly="
+
+    tasks="build compile compile_ptest_base configure configure_ptest_base

deploy \
+ distrodata fetch image image_complete install install_ptest_base
package \
+ package_qa package_write_deb package_write_ipk package_write_rpm
package_write_tar \
+ packagedata patch populate_lic populate_sdk populate_sysroot
prepare_recipe_sysroot \
+ rm_work rm_work_all unpack checkpkg checkuri clean cleanall
cleansstate devpyshell \
+ devshell listtasks package_index bootimg bundle_initramfs rootfs
testimage \
+ testimage_auto compile_kernelmodules diffconfig kernel_checkout
kernel_configcheck \
+ kernel_configme kernel_menuconfig kernel_metadata menuconfig
savedefconfig shared_workdir \

contrib/completion/bash/bitbake_completion new file +14 -0
+           sizecheck strip validate_branches spdx"
+
+    ui="knotty ncurses taskexp"
+
+    if [[ "$prev" == "=" ]]; then
+        prev="${COMP_WORDS[COMP_CWORD - 2]}"
+    elif [[ "$cur" == "=" ]]; then
+        cur=""
+    fi
+
+    conf_files=$(find . -maxdepth 1 -name "*.conf" -type f -printf '%P\n')
+
+    case "$prev" in
+

"-c"|"--cmd"|"-C"|"--clear-stamp"|"--ignore-deps"|"--runall"|"--runonly")

contrib/completion/bash/bitbake_completion new file +17 -0
+            COMPREPLY=( $(compgen -W "${tasks}" -- ${cur}) )
+            return 0
+        ;;
+        "-r"|"--read"|"-R"|"--postread")
+            COMPREPLY=( $(compgen -W "${conf_files}" -- ${cur}) )
+            return 0
+        ;;
+        "-u"|"--ui")
+            COMPREPLY=( $(compgen -W "${ui}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+
+    case "$cur" in
+        "--"*)
+            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
+            if [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} == "--"*"=" ]] ;

then

contrib/completion/bash/bitbake_completion new file +16 -0
+                compopt -o nospace
+            fi
+            return 0
+        ;;
+        "-"*)
+            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+
+    bb_layers_conf="conf/bblayers.conf"
+    bb_layers_md5=".bb_layers_conf.md5"
+    bb_recipes=".bb_recipes"
+
+    _parse_recipes () {
+        bitbake -s | sed -e '0,/^=.*/d' -e '/^\s*$/d' -e '/^Summary:/d' |

awk '{print $1}' > $bb_recipes

contrib/completion/bash/bitbake_completion new file +22 -0
+    }
+
+    if [ ! -e $bb_layers_conf ]; then
+        return 0
+    fi
+
+    if [ "$prev" = "bitbake" -a "$cur" = "" ]; then
+        _parse_recipes
+    fi
+
+    md5sum --quiet --status -c $bb_layers_md5 2>/dev/null
+    if [ $? != 0 -o ! -e $bb_recipes ]; then
+         md5sum $bb_layers_conf > $bb_layers_md5
+         _parse_recipes
+    fi
+
+    recipes=$(cat $bb_recipes)
+
+    COMPREPLY=( $(compgen -W "${recipes}" -- ${cur}) )
+    return 0
+}
+complete -F _bitbake bitbake
\ No newline at end of file
contrib/completion/bash/bitbake_diffsigs_completion new file +24 -0
new file mode 100644
index 00000000..cbf2c5f1
@@ -0,0 +1,86 @@
+#!bash
+# Bash completion support for bitbake-diffsigs tool,
+# compatible with Bitbake 1.39.1.
+#
+# Copyright (C) 2018 Lukasz Gardon <[email protected]>
+#
+# Distributed under the MIT License (MIT)
+#
+
+_bitbake_diffsigs()
+{
+    local cur prev opts_short opts_long tasks colors
+    local bb_layers_conf bb_layers_md5 bb_recipes
+
+    COMPREPLY=()
+
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+    opts_short="-h -d -t -s"
+
+    opts_long="--help --debug --color --task --signature"
+
+    tasks="build compile compile_ptest_base configure configure_ptest_base

deploy \
+ distrodata fetch image image_complete install install_ptest_base
package \
+ package_qa package_write_deb package_write_ipk package_write_rpm
package_write_tar \
+ packagedata patch populate_lic populate_sdk populate_sysroot
prepare_recipe_sysroot \
+ rm_work rm_work_all unpack checkpkg checkuri clean cleanall
cleansstate devpyshell \
+ devshell listtasks package_index bootimg bundle_initramfs rootfs
testimage \
+ testimage_auto compile_kernelmodules diffconfig kernel_checkout
kernel_configcheck \
+ kernel_configme kernel_menuconfig kernel_metadata menuconfig
savedefconfig shared_workdir \

contrib/completion/bash/bitbake_diffsigs_completion new file +21 -0
+           sizecheck strip validate_branches spdx"
+
+    colors="auto always never"
+
+    case "$cur" in
+        "--"*)
+            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
+            return 0
+        ;;
+        "-"*)
+            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+
+    bb_layers_conf="conf/bblayers.conf"
+    bb_layers_md5=".bb_layers_conf.md5"
+    bb_recipes=".bb_recipes"
+
+    _parse_recipes () {
+        bitbake -s | sed -e '0,/^=.*/d' -e '/^\s*$/d' -e '/^Summary:/d' |

awk '{print $1}' > $bb_recipes

contrib/completion/bash/bitbake_diffsigs_completion new file +29 -0
+    }
+
+    if [ ! -e $bb_layers_conf ]; then
+        return 0
+    fi
+
+    if [ "$prev" = "bitbake" -a "$cur" = "" ]; then
+           _parse_recipes
+    fi
+
+    md5sum --quiet --status -c $bb_layers_md5 2>/dev/null
+    if [ $? != 0 -o ! -e $bb_recipes ]; then
+        md5sum $bb_layers_conf > $bb_layers_md5
+        _parse_recipes
+    fi
+
+    recipes=$(cat $bb_recipes)
+
+    case "$prev" in
+        "-c"|"--color")
+            COMPREPLY=( $(compgen -W "${colors}" -- ${cur}) )
+            return 0
+        ;;
+        "-t"|"--task")
+          COMPREPLY=( $(compgen -W "${recipes}" -- ${cur}) )
+          return 0
+    esac
+
+    if [[ ${COMP_WORDS[COMP_CWORD -2]} == "-t" ]] || [[

${COMP_WORDS[COMP_CWORD -2]} == "--task" ]]; then

contrib/completion/bash/bitbake_diffsigs_completion new file +5 -0
+        COMPREPLY=( $(compgen -W "${tasks}" -- ${cur}) )
+           return 0
+    fi
+}
+complete -F _bitbake_diffsigs bitbake-diffsigs
\ No newline at end of file
contrib/completion/bash/bitbake_dumpsig_completion new file +24 -0
new file mode 100644
index 00000000..95eb2394
@@ -0,0 +1,89 @@
+#!bash
+# Bash completion support for bitbake-dumpsig tool,
+# compatible with Bitbake 1.39.1.
+#
+# Copyright (C) 2018 Lukasz Gardon <[email protected]>
+#
+# Distributed under the MIT License (MIT)
+#
+
+_bitbake_dumpsig()
+{
+    local cur prev opts_short opts_long tasks
+    local bb_layers_conf bb_layers_md5 bb_recipes
+
+    COMPREPLY=()
+
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+    opts_short="-h -d -t"
+
+    opts_long="--help --debug --task="
+
+    tasks="build compile compile_ptest_base configure configure_ptest_base

deploy \
+ distrodata fetch image image_complete install install_ptest_base
package \
+ package_qa package_write_deb package_write_ipk package_write_rpm
package_write_tar \
+ packagedata patch populate_lic populate_sdk populate_sysroot
prepare_recipe_sysroot \
+ rm_work rm_work_all unpack checkpkg checkuri clean cleanall
cleansstate devpyshell \
+ devshell listtasks package_index bootimg bundle_initramfs rootfs
testimage \
+ testimage_auto compile_kernelmodules diffconfig kernel_checkout
kernel_configcheck \
+ kernel_configme kernel_menuconfig kernel_metadata menuconfig
savedefconfig shared_workdir \

contrib/completion/bash/bitbake_dumpsig_completion new file +12 -0
+           sizecheck strip validate_branches spdx"
+
+    if [[ "$prev" == "=" ]]; then
+        prev="${COMP_WORDS[COMP_CWORD - 2]}"
+    elif [[ "$cur" == "=" ]]; then
+        cur=""
+    fi
+
+    case "$cur" in
+        "--"*)
+            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
+            if [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} == "--"*"=" ]] ;

then

contrib/completion/bash/bitbake_dumpsig_completion new file +16 -0
+                compopt -o nospace
+            fi
+            return 0
+        ;;
+        "-"*)
+            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+
+    bb_layers_conf="conf/bblayers.conf"
+    bb_layers_md5=".bb_layers_conf.md5"
+    bb_recipes=".bb_recipes"
+
+    _parse_recipes () {
+        bitbake -s | sed -e '0,/^=.*/d' -e '/^\s*$/d' -e '/^Summary:/d' |

awk '{print $1}' > $bb_recipes

contrib/completion/bash/bitbake_dumpsig_completion new file +25 -0
+    }
+
+    if [ ! -e $bb_layers_conf ]; then
+        return 0
+    fi
+
+    if [ "$prev" = "bitbake" -a "$cur" = "" ]; then
+           _parse_recipes
+    fi
+
+    md5sum --quiet --status -c $bb_layers_md5 2>/dev/null
+    if [ $? != 0 -o ! -e $bb_recipes ]; then
+        md5sum $bb_layers_conf > $bb_layers_md5
+        _parse_recipes
+    fi
+
+    recipes=$(cat $bb_recipes)
+
+    case "$prev" in
+        "-t"|"--task")
+           COMPREPLY=( $(compgen -W "${recipes}" -- ${cur}) )
+           return 0
+    esac
+
+    if [[ ${COMP_WORDS[COMP_CWORD -2]} =~ "-t" ]] || [[

${COMP_WORDS[COMP_CWORD -3]} == "--task" ]]; then

contrib/completion/bash/bitbake_dumpsig_completion new file +5 -0
+        COMPREPLY=( $(compgen -W "${tasks}" -- ${cur}) )
+           return 0
+    fi
+}
+complete -F _bitbake_dumpsig bitbake-dumpsig
\ No newline at end of file
contrib/completion/bash/bitbake_layers_completion new file +14 -0
new file mode 100644
index 00000000..37ca8afb
@@ -0,0 +1,188 @@
+#!bash
+# Bash completion support for bitbake-layers tool,
+# compatible with Bitbake 1.39.1.
+#
+# Copyright (C) 2018 Lukasz Gardon <[email protected]>
+#
+# Distributed under the MIT License (MIT)
+#
+
+_bitbake_layers()
+{
+    local cur prev opts_short opts_long subcommands colors
+    local opts_long_add_layer opts_short_add_layer opts_long_show_overlayed
+    local opts_short_show_overlayed opts_long_show_recipes

opts_short_show_recipes

contrib/completion/bash/bitbake_layers_completion new file +3 -0
+    local opts_long_show_cross_depends opts_short_show_cross_depends
+    local opts_long_show_layerindex_fetch opts_short_show_layerindex_fetch
+    local opts_long_show_layerindex_show_depends

opts_short_show_layerindex_show_depends
+ local opts_long_show_create_layer opts_short_show_create_layer
bb_class_files classes

contrib/completion/bash/bitbake_layers_completion new file +42 -2
+
+    COMPREPLY=()
+
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+    opts_short="-d -q -F -h"
+
+    opts_long="--debug --quiet --force --color --help"
+
+    subcommands="layerindex-fetch layerindex-show-depends add-layer \
+                    remove-layer flatten show-layers show-overlayed \
+                        show-recipes show-appends show-cross-depends \
+                        create-layer"
+
+    colors="auto always never"
+
+    opts_long_show_overlayed="--help --filenames --same-version"
+    opts_short_show_overlayed="-h -f -s"
+
+    opts_long_show_recipes="--help --filenames --multiple --inherits"
+    opts_short_show_recipes="-h -f -m -i"
+
+    opts_long_show_layerindex_fetch="--help --show-only --branch --ignore"
+    opts_short_show_layerindex_fetch="-h -n -b -i"
+
+    opts_long_add_layer="--help --priority --example-recipe-name
--example-recipe-version"
+    opts_short_add_layer="-h"
+
+    opts_long_show_cross_depends="--help --filenames --ignore"
+    opts_short_show_cross_depends="-h -f -i"
+
+    opts_long_show_layerindex_show_depends="--help --branch"
+    opts_short_show_layerindex_show_depends="-h -b"
+
+    opts_long_show_create_layer="--help --priority --example-recipe-name
--example-recipe-version"
+    opts_short_show_create_layer="-h -p -e -v"
+
+    bb_class_files=".bb_class_files"
+
+    _get_classes() {
+        find $BBPATH/../meta*/classes/ -name *.bbclass -exec basename {} \;

| sed 's/.bbclass//' > $bb_class_files

contrib/completion/bash/bitbake_layers_completion new file +12 -0
+    }
+
+    if [[ "${COMP_WORDS[@]}" =~ show-recipes ]] ; then
+        if [[ "$prev" == "--inherits" ]] || [[ "$prev" == "-i" ]]; then
+            _get_classes
+            classes=$(cat $bb_class_files)
+            COMPREPLY=( $(compgen -W "${classes}" -- ${cur}) )
+            return 0
+        fi
+    fi
+
+    if [[ "${COMP_WORDS[1]}" =~

show-layers|show-appends|remove-layer|flatten ]]; then

contrib/completion/bash/bitbake_layers_completion new file +14 -0
+        case "$cur" in
+            "--"*)
+                COMPREPLY=( $(compgen -W "--help" -- ${cur}) )
+                return 0
+            ;;
+            "-"*)
+                COMPREPLY=( $(compgen -W "-h" -- ${cur}) )
+                return 0
+            ;;
+        esac
+    elif [[ "${COMP_WORDS[1]}" == "add-layer" ]]; then
+        case "$cur" in
+            "--"*|"")
+                COMPREPLY=( $(compgen -W "${opts_long_add_layer}" --

${cur}) )

contrib/completion/bash/bitbake_layers_completion new file +4 -0
+                return 0
+            ;;
+            "-"*)
+                COMPREPLY=( $(compgen -W "${opts_short_add_layer}" --

${cur}) )

contrib/completion/bash/bitbake_layers_completion new file +7 -0
+                return 0
+            ;;
+        esac
+    elif [[ "${COMP_WORDS[1]}" == "show-overlayed" ]]; then
+        case "$cur" in
+            "--"*|"")
+                COMPREPLY=( $(compgen -W "${opts_long_show_overlayed}" --

${cur}) )

contrib/completion/bash/bitbake_layers_completion new file +4 -0
+                return 0
+            ;;
+            "-"*)
+                COMPREPLY=( $(compgen -W "${opts_short_show_overlayed}" --

${cur}) )

contrib/completion/bash/bitbake_layers_completion new file +7 -0
+                return 0
+            ;;
+        esac
+    elif [[ "${COMP_WORDS[1]}" == "show-recipes" ]]; then
+        case "$cur" in
+            "--"*|"")
+                COMPREPLY=( $(compgen -W "${opts_long_show_recipes}" --

${cur}) )

contrib/completion/bash/bitbake_layers_completion new file +4 -0
+                return 0
+            ;;
+            "-"*)
+                COMPREPLY=( $(compgen -W "${opts_short_show_recipes}" --

${cur}) )

contrib/completion/bash/bitbake_layers_completion new file +18 -2
+                return 0
+            ;;
+        esac
+    elif [[ "${COMP_WORDS[1]}" == "show-cross-depends" ]]; then
+        case "$cur" in
+            "--"*|"")
+                COMPREPLY=( $(compgen -W "${opts_long_show_cross_depends}"
-- ${cur}) )
+                return 0
+            ;;
+            "-"*)
+                COMPREPLY=( $(compgen -W "${opts_short_show_cross_depends}"
-- ${cur}) )
+                return 0
+            ;;
+        esac
+    elif [[ "${COMP_WORDS[1]}" == "layerindex-fetch" ]]; then
+        case "$cur" in
+            "--"*|"")
+                COMPREPLY=( $(compgen -W

"${opts_long_show_layerindex_fetch}" -- ${cur}) )

contrib/completion/bash/bitbake_layers_completion new file +4 -0
+                return 0
+            ;;
+            "-"*)
+                COMPREPLY=( $(compgen -W

"${opts_short_show_layerindex_fetch}" -- ${cur}) )

contrib/completion/bash/bitbake_layers_completion new file +7 -0
+                return 0
+            ;;
+        esac
+    elif [[ "${COMP_WORDS[1]}" == "layerindex-show-depends" ]]; then
+        case "$cur" in
+            "--"*|"")
+                COMPREPLY=( $(compgen -W

"${opts_long_show_layerindex_show_depends}" -- ${cur}) )

contrib/completion/bash/bitbake_layers_completion new file +4 -0
+                return 0
+            ;;
+            "-"*)
+                COMPREPLY=( $(compgen -W

"${opts_short_show_layerindex_show_depends}" -- ${cur}) )

contrib/completion/bash/bitbake_layers_completion new file +43 -2
+                return 0
+            ;;
+        esac
+    elif [[ "${COMP_WORDS[1]}" == "create-layer" ]]; then
+        case "$cur" in
+            "--"*|"")
+                COMPREPLY=( $(compgen -W "${opts_long_show_create_layer}"
-- ${cur}) )
+                return 0
+            ;;
+            "-"*)
+                COMPREPLY=( $(compgen -W "${opts_short_show_create_layer}"
-- ${cur}) )
+                return 0
+            ;;
+        esac
+    fi
+
+    case "$prev" in
+        "-c"|"--color")
+            COMPREPLY=( $(compgen -W "${colors}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+
+    case "$cur" in
+        "--"*)
+            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
+            return 0
+        ;;
+        "-"*)
+            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+
+    if [[ ${prev} == "bitbake-layers" ]]; then
+        COMPREPLY=( $(compgen -W "${subcommands}" -- ${cur}) )
+        return 0
+    elif [[ ! ${subcommands} =~ [[:space:]]${cur}[[:space:]] ]]; then
+        COMPREPLY=( $(compgen -W "${subcommands}" -- ${cur}) )
+        return 0
+    fi
+}
+complete -F _bitbake_layers bitbake-layers
\ No newline at end of file
contrib/completion/bash/bitbake_prserv_completion new file +12 -0
new file mode 100644
index 00000000..3bca1197
@@ -0,0 +1,76 @@
+#!bash
+# Bash completion support for bitbake-prserv tool,
+# compatible with Bitbake 1.39.1.
+#
+# Copyright (C) 2018 Lukasz Gardon <[email protected]>
+#
+# Distributed under the MIT License (MIT)
+#
+
+_bitbake_prserv()
+{
+    local cur prev opts_short opts_long subcommands file_default

log_default log_levels

contrib/completion/bash/bitbake_prserv_completion new file +45 -0
+
+    COMPREPLY=()
+
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+    opts_short="-h -f -l"
+
+    opts_long="--version --help --file= --log= --loglevel= --start \
+                  --stop --host= --port="
+
+    subcommands="layerindex-fetch layerindex-show-depends add-layer \
+                    remove-layer flatten show-layers show-overlayed \
+                        show-recipes show-appends show-cross-depends \
+                        create-layer"
+
+    file_default="prserv.sqlite3"
+    log_default="prserv.log"
+    log_levels="CRITICAL ERROR WARNING INFO DEBUG"
+
+    if [[ "$prev" == "=" ]]; then
+        prev="${COMP_WORDS[COMP_CWORD -2]}"
+    elif [[ "$cur" == "=" ]]; then
+        cur=""
+    fi
+
+    case "$prev" in
+        "-f"|"--file")
+            COMPREPLY=( $(compgen -W "${file_default}" -- ${cur}) )
+            return 0
+        ;;
+        "-l"|"--log")
+            COMPREPLY=( $(compgen -W "${log_default}" -- ${cur}) )
+            return 0
+        ;;
+        "--loglevel")
+            COMPREPLY=( $(compgen -W "${log_levels}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+
+    case "$cur" in
+        "--"*|"")
+            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
+            if [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} == "--"*"=" ]] ;

then

contrib/completion/bash/bitbake_prserv_completion new file +19 -0
+                compopt -o nospace
+            fi
+            return 0
+        ;;
+        "-"*)
+            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+
+    if [[ ${prev} == "bitbake-layers" ]]; then
+        COMPREPLY=( $(compgen -W "${subcommands}" -- ${cur}) )
+        return 0
+    elif [[ ! ${subcommands} =~ [[:space:]]${cur}[[:space:]] ]]; then
+        COMPREPLY=( $(compgen -W "${subcommands}" -- ${cur}) )
+        return 0
+    fi
+}
+complete -F _bitbake_prserv bitbake-prserv
\ No newline at end of file
contrib/completion/bash/bitbake_selftest_completion new file +34 -1
new file mode 100644
index 00000000..8b6bf641
@@ -0,0 +1,34 @@
+#!bash
+# Bash completion support for bitbake-selftest tool,
+# compatible with Bitbake version 1.39.1.
+#
+# Copyright (C) 2018 Lukasz Gardon <[email protected]>
+#
+# Distributed under the MIT License (MIT)
+#
+
+_bitbake_selftest()
+{
+    local cur prev opts_short opts_long
+
+    COMPREPLY=()
+
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+    opts_short="-h -v -q -f -c"
+
+    opts_long="--help --verbose --quiet --locals --failfast --catch"
+
+    case "$cur" in
+        "--"*)
+            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
+            return 0
+        ;;
+        "-"*)
+            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+}
+complete -F _bitbake_selftest bitbake-selftest
\ No newline at end of file
--

2.18.0

--
_______________________________________________
bitbake-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/bitbake-devel

#5 lore raw

Re: Add files supporting bash completion for bitbake tools

In reply to a message not in the archive

Add missed [email protected] <mailto:[email protected]> mailing group to this thread.

Quoted 760 lines

Wiadomość napisana przez Łukasz Gardoń <[email protected]> w dniu 03.09.2018, o godz. 21:22:

Hi Alex,

thank’s for Your suggestion but for in my opinion keeping this files in bitbake repository is the better place. I would not know to find/search such completion files in bash-completion or any other place. What about vim plugin which is stored in contrib/ dir[1] and which is also comes from dedicated repo[2] same thing.

Anyway, could someone from project architects could comment and help here ?

[1] vim bitbake plugin in bitbake: https://github.com/openembedded/bitbake/tree/master/contrib/vim <https://github.com/openembedded/bitbake/tree/master/contrib/vim>
[2] vim bitbake plugin repo: https://github.com/kergoth/vim-bitbake <https://github.com/kergoth/vim-bitbake>

Quoted 746 lines

Wiadomość napisana przez Alexander Kanavin <[email protected] <mailto:[email protected]>> w dniu 03.09.2018, o godz. 11:25:

Hello Lukasz,

nobody will find your contributions in bitbake/contrib, and so they will be unused and will bitrot. The proper place is the upstream bash-completion project, which will get picked up by all Linux distributions.

Alex

2018-09-02 12:27 GMT+02:00 Łukasz Gardoń <[email protected] <mailto:[email protected]>>:

Quoted 734 lines

Hi Alex,

With information comes file from bitbake repository - bitbake/contrib/README: "This directory is for additional contributed files which may be useful.”.
I think that this is proper place for such files.

Wiadomość napisana przez Alexander Kanavin <[email protected] <mailto:[email protected]>> w dniu 01.09.2018, o godz. 21:33:

The right upstream destination for this is almost certainly
https://github.com/scop/bash-completion <https://github.com/scop/bash-completion>

Alex

2018-09-01 15:36 GMT+02:00 Łukasz Gardoń <[email protected]>:

Repository with more details:
https://github.com/lukaszgard/bitbake-completion

---

contrib/completion/bash/bitbake_completion    | 108 ++++++++++
.../bash/bitbake_diffsigs_completion          |  86 ++++++++
.../bash/bitbake_dumpsig_completion           |  89 +++++++++
.../completion/bash/bitbake_layers_completion | 188 ++++++++++++++++++
.../completion/bash/bitbake_prserv_completion |  76 +++++++
.../bash/bitbake_selftest_completion          |  34 ++++
6 files changed, 581 insertions(+)

create mode 100644 contrib/completion/bash/bitbake_completion create mode 100644 contrib/completion/bash/bitbake_diffsigs_completion create mode 100644 contrib/completion/bash/bitbake_dumpsig_completion create mode 100644 contrib/completion/bash/bitbake_layers_completion create mode 100644 contrib/completion/bash/bitbake_prserv_completion create mode 100644 contrib/completion/bash/bitbake_selftest_completion

contrib/completion/bash/bitbake_completion new file +24 -0
new file mode 100644
index 00000000..23cadf6e
@@ -0,0 +1,108 @@
+#!bash
+# Bash completion support for bitbake 1.39.1 release.
+#
+# Copyright (C) 2014 Sergio Prado <[email protected]>
+# Copyright (C) 2018 Lukasz Gardon <[email protected]>
+#
+# Distributed under the MIT License (MIT)
+#
+
+_bitbake()
+{
+    local cur prev opts_short opts_long tasks recipes ui
+    local bb_layers_conf bb_layers_md5 bb_recipes
+
+    COMPREPLY=()
+
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+    opts_short="-h -b -k -f -c -C -r -R -v -D -q -n -S -p -s -e -g -I \
+                -l -P -u -B -T -m -w"
+
+    opts_long="--version --help --buildfile= --continue --force --cmd= \
+               --clear-stamp= --read= --postread= --verbose --debug --quiet

\

contrib/completion/bash/bitbake_completion new file +8 -3
+               --dry-run --dump-signatures= --parse-only --show-versions \
+               --environment --graphviz --ignore-deps= --log-domains=
--profile \
+               --ui= --token= --revisions-changed --server-only --bind= \
+               --idle-timeout= --no-setscene --setscene-only
--remote-server= \
+               --kill-server --observe-only --status-only --write-log=
--runall= \
+               --runonly="
+
+    tasks="build compile compile_ptest_base configure configure_ptest_base

deploy \
+ distrodata fetch image image_complete install install_ptest_base
package \
+ package_qa package_write_deb package_write_ipk package_write_rpm
package_write_tar \
+ packagedata patch populate_lic populate_sdk populate_sysroot
prepare_recipe_sysroot \
+ rm_work rm_work_all unpack checkpkg checkuri clean cleanall
cleansstate devpyshell \
+ devshell listtasks package_index bootimg bundle_initramfs rootfs
testimage \
+ testimage_auto compile_kernelmodules diffconfig kernel_checkout
kernel_configcheck \
+ kernel_configme kernel_menuconfig kernel_metadata menuconfig
savedefconfig shared_workdir \

contrib/completion/bash/bitbake_completion new file +14 -0
+           sizecheck strip validate_branches spdx"
+
+    ui="knotty ncurses taskexp"
+
+    if [[ "$prev" == "=" ]]; then
+        prev="${COMP_WORDS[COMP_CWORD - 2]}"
+    elif [[ "$cur" == "=" ]]; then
+        cur=""
+    fi
+
+    conf_files=$(find . -maxdepth 1 -name "*.conf" -type f -printf '%P\n')
+
+    case "$prev" in
+

"-c"|"--cmd"|"-C"|"--clear-stamp"|"--ignore-deps"|"--runall"|"--runonly")

contrib/completion/bash/bitbake_completion new file +17 -0
+            COMPREPLY=( $(compgen -W "${tasks}" -- ${cur}) )
+            return 0
+        ;;
+        "-r"|"--read"|"-R"|"--postread")
+            COMPREPLY=( $(compgen -W "${conf_files}" -- ${cur}) )
+            return 0
+        ;;
+        "-u"|"--ui")
+            COMPREPLY=( $(compgen -W "${ui}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+
+    case "$cur" in
+        "--"*)
+            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
+            if [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} == "--"*"=" ]] ;

then

contrib/completion/bash/bitbake_completion new file +16 -0
+                compopt -o nospace
+            fi
+            return 0
+        ;;
+        "-"*)
+            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+
+    bb_layers_conf="conf/bblayers.conf"
+    bb_layers_md5=".bb_layers_conf.md5"
+    bb_recipes=".bb_recipes"
+
+    _parse_recipes () {
+        bitbake -s | sed -e '0,/^=.*/d' -e '/^\s*$/d' -e '/^Summary:/d' |

awk '{print $1}' > $bb_recipes

contrib/completion/bash/bitbake_completion new file +22 -0
+    }
+
+    if [ ! -e $bb_layers_conf ]; then
+        return 0
+    fi
+
+    if [ "$prev" = "bitbake" -a "$cur" = "" ]; then
+        _parse_recipes
+    fi
+
+    md5sum --quiet --status -c $bb_layers_md5 2>/dev/null
+    if [ $? != 0 -o ! -e $bb_recipes ]; then
+         md5sum $bb_layers_conf > $bb_layers_md5
+         _parse_recipes
+    fi
+
+    recipes=$(cat $bb_recipes)
+
+    COMPREPLY=( $(compgen -W "${recipes}" -- ${cur}) )
+    return 0
+}
+complete -F _bitbake bitbake
\ No newline at end of file
contrib/completion/bash/bitbake_diffsigs_completion new file +24 -0
new file mode 100644
index 00000000..cbf2c5f1
@@ -0,0 +1,86 @@
+#!bash
+# Bash completion support for bitbake-diffsigs tool,
+# compatible with Bitbake 1.39.1.
+#
+# Copyright (C) 2018 Lukasz Gardon <[email protected]>
+#
+# Distributed under the MIT License (MIT)
+#
+
+_bitbake_diffsigs()
+{
+    local cur prev opts_short opts_long tasks colors
+    local bb_layers_conf bb_layers_md5 bb_recipes
+
+    COMPREPLY=()
+
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+    opts_short="-h -d -t -s"
+
+    opts_long="--help --debug --color --task --signature"
+
+    tasks="build compile compile_ptest_base configure configure_ptest_base

deploy \
+ distrodata fetch image image_complete install install_ptest_base
package \
+ package_qa package_write_deb package_write_ipk package_write_rpm
package_write_tar \
+ packagedata patch populate_lic populate_sdk populate_sysroot
prepare_recipe_sysroot \
+ rm_work rm_work_all unpack checkpkg checkuri clean cleanall
cleansstate devpyshell \
+ devshell listtasks package_index bootimg bundle_initramfs rootfs
testimage \
+ testimage_auto compile_kernelmodules diffconfig kernel_checkout
kernel_configcheck \
+ kernel_configme kernel_menuconfig kernel_metadata menuconfig
savedefconfig shared_workdir \

contrib/completion/bash/bitbake_diffsigs_completion new file +21 -0
+           sizecheck strip validate_branches spdx"
+
+    colors="auto always never"
+
+    case "$cur" in
+        "--"*)
+            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
+            return 0
+        ;;
+        "-"*)
+            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+
+    bb_layers_conf="conf/bblayers.conf"
+    bb_layers_md5=".bb_layers_conf.md5"
+    bb_recipes=".bb_recipes"
+
+    _parse_recipes () {
+        bitbake -s | sed -e '0,/^=.*/d' -e '/^\s*$/d' -e '/^Summary:/d' |

awk '{print $1}' > $bb_recipes

contrib/completion/bash/bitbake_diffsigs_completion new file +29 -0
+    }
+
+    if [ ! -e $bb_layers_conf ]; then
+        return 0
+    fi
+
+    if [ "$prev" = "bitbake" -a "$cur" = "" ]; then
+           _parse_recipes
+    fi
+
+    md5sum --quiet --status -c $bb_layers_md5 2>/dev/null
+    if [ $? != 0 -o ! -e $bb_recipes ]; then
+        md5sum $bb_layers_conf > $bb_layers_md5
+        _parse_recipes
+    fi
+
+    recipes=$(cat $bb_recipes)
+
+    case "$prev" in
+        "-c"|"--color")
+            COMPREPLY=( $(compgen -W "${colors}" -- ${cur}) )
+            return 0
+        ;;
+        "-t"|"--task")
+          COMPREPLY=( $(compgen -W "${recipes}" -- ${cur}) )
+          return 0
+    esac
+
+    if [[ ${COMP_WORDS[COMP_CWORD -2]} == "-t" ]] || [[

${COMP_WORDS[COMP_CWORD -2]} == "--task" ]]; then

contrib/completion/bash/bitbake_diffsigs_completion new file +5 -0
+        COMPREPLY=( $(compgen -W "${tasks}" -- ${cur}) )
+           return 0
+    fi
+}
+complete -F _bitbake_diffsigs bitbake-diffsigs
\ No newline at end of file
contrib/completion/bash/bitbake_dumpsig_completion new file +24 -0
new file mode 100644
index 00000000..95eb2394
@@ -0,0 +1,89 @@
+#!bash
+# Bash completion support for bitbake-dumpsig tool,
+# compatible with Bitbake 1.39.1.
+#
+# Copyright (C) 2018 Lukasz Gardon <[email protected]>
+#
+# Distributed under the MIT License (MIT)
+#
+
+_bitbake_dumpsig()
+{
+    local cur prev opts_short opts_long tasks
+    local bb_layers_conf bb_layers_md5 bb_recipes
+
+    COMPREPLY=()
+
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+    opts_short="-h -d -t"
+
+    opts_long="--help --debug --task="
+
+    tasks="build compile compile_ptest_base configure configure_ptest_base

deploy \
+ distrodata fetch image image_complete install install_ptest_base
package \
+ package_qa package_write_deb package_write_ipk package_write_rpm
package_write_tar \
+ packagedata patch populate_lic populate_sdk populate_sysroot
prepare_recipe_sysroot \
+ rm_work rm_work_all unpack checkpkg checkuri clean cleanall
cleansstate devpyshell \
+ devshell listtasks package_index bootimg bundle_initramfs rootfs
testimage \
+ testimage_auto compile_kernelmodules diffconfig kernel_checkout
kernel_configcheck \
+ kernel_configme kernel_menuconfig kernel_metadata menuconfig
savedefconfig shared_workdir \

contrib/completion/bash/bitbake_dumpsig_completion new file +12 -0
+           sizecheck strip validate_branches spdx"
+
+    if [[ "$prev" == "=" ]]; then
+        prev="${COMP_WORDS[COMP_CWORD - 2]}"
+    elif [[ "$cur" == "=" ]]; then
+        cur=""
+    fi
+
+    case "$cur" in
+        "--"*)
+            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
+            if [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} == "--"*"=" ]] ;

then

contrib/completion/bash/bitbake_dumpsig_completion new file +16 -0
+                compopt -o nospace
+            fi
+            return 0
+        ;;
+        "-"*)
+            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+
+    bb_layers_conf="conf/bblayers.conf"
+    bb_layers_md5=".bb_layers_conf.md5"
+    bb_recipes=".bb_recipes"
+
+    _parse_recipes () {
+        bitbake -s | sed -e '0,/^=.*/d' -e '/^\s*$/d' -e '/^Summary:/d' |

awk '{print $1}' > $bb_recipes

contrib/completion/bash/bitbake_dumpsig_completion new file +25 -0
+    }
+
+    if [ ! -e $bb_layers_conf ]; then
+        return 0
+    fi
+
+    if [ "$prev" = "bitbake" -a "$cur" = "" ]; then
+           _parse_recipes
+    fi
+
+    md5sum --quiet --status -c $bb_layers_md5 2>/dev/null
+    if [ $? != 0 -o ! -e $bb_recipes ]; then
+        md5sum $bb_layers_conf > $bb_layers_md5
+        _parse_recipes
+    fi
+
+    recipes=$(cat $bb_recipes)
+
+    case "$prev" in
+        "-t"|"--task")
+           COMPREPLY=( $(compgen -W "${recipes}" -- ${cur}) )
+           return 0
+    esac
+
+    if [[ ${COMP_WORDS[COMP_CWORD -2]} =~ "-t" ]] || [[

${COMP_WORDS[COMP_CWORD -3]} == "--task" ]]; then

contrib/completion/bash/bitbake_dumpsig_completion new file +5 -0
+        COMPREPLY=( $(compgen -W "${tasks}" -- ${cur}) )
+           return 0
+    fi
+}
+complete -F _bitbake_dumpsig bitbake-dumpsig
\ No newline at end of file
contrib/completion/bash/bitbake_layers_completion new file +14 -0
new file mode 100644
index 00000000..37ca8afb
@@ -0,0 +1,188 @@
+#!bash
+# Bash completion support for bitbake-layers tool,
+# compatible with Bitbake 1.39.1.
+#
+# Copyright (C) 2018 Lukasz Gardon <[email protected]>
+#
+# Distributed under the MIT License (MIT)
+#
+
+_bitbake_layers()
+{
+    local cur prev opts_short opts_long subcommands colors
+    local opts_long_add_layer opts_short_add_layer opts_long_show_overlayed
+    local opts_short_show_overlayed opts_long_show_recipes

opts_short_show_recipes

contrib/completion/bash/bitbake_layers_completion new file +3 -0
+    local opts_long_show_cross_depends opts_short_show_cross_depends
+    local opts_long_show_layerindex_fetch opts_short_show_layerindex_fetch
+    local opts_long_show_layerindex_show_depends

opts_short_show_layerindex_show_depends
+ local opts_long_show_create_layer opts_short_show_create_layer
bb_class_files classes

contrib/completion/bash/bitbake_layers_completion new file +42 -2
+
+    COMPREPLY=()
+
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+    opts_short="-d -q -F -h"
+
+    opts_long="--debug --quiet --force --color --help"
+
+    subcommands="layerindex-fetch layerindex-show-depends add-layer \
+                    remove-layer flatten show-layers show-overlayed \
+                        show-recipes show-appends show-cross-depends \
+                        create-layer"
+
+    colors="auto always never"
+
+    opts_long_show_overlayed="--help --filenames --same-version"
+    opts_short_show_overlayed="-h -f -s"
+
+    opts_long_show_recipes="--help --filenames --multiple --inherits"
+    opts_short_show_recipes="-h -f -m -i"
+
+    opts_long_show_layerindex_fetch="--help --show-only --branch --ignore"
+    opts_short_show_layerindex_fetch="-h -n -b -i"
+
+    opts_long_add_layer="--help --priority --example-recipe-name
--example-recipe-version"
+    opts_short_add_layer="-h"
+
+    opts_long_show_cross_depends="--help --filenames --ignore"
+    opts_short_show_cross_depends="-h -f -i"
+
+    opts_long_show_layerindex_show_depends="--help --branch"
+    opts_short_show_layerindex_show_depends="-h -b"
+
+    opts_long_show_create_layer="--help --priority --example-recipe-name
--example-recipe-version"
+    opts_short_show_create_layer="-h -p -e -v"
+
+    bb_class_files=".bb_class_files"
+
+    _get_classes() {
+        find $BBPATH/../meta*/classes/ -name *.bbclass -exec basename {} \;

| sed 's/.bbclass//' > $bb_class_files

contrib/completion/bash/bitbake_layers_completion new file +12 -0
+    }
+
+    if [[ "${COMP_WORDS[@]}" =~ show-recipes ]] ; then
+        if [[ "$prev" == "--inherits" ]] || [[ "$prev" == "-i" ]]; then
+            _get_classes
+            classes=$(cat $bb_class_files)
+            COMPREPLY=( $(compgen -W "${classes}" -- ${cur}) )
+            return 0
+        fi
+    fi
+
+    if [[ "${COMP_WORDS[1]}" =~

show-layers|show-appends|remove-layer|flatten ]]; then

contrib/completion/bash/bitbake_layers_completion new file +14 -0
+        case "$cur" in
+            "--"*)
+                COMPREPLY=( $(compgen -W "--help" -- ${cur}) )
+                return 0
+            ;;
+            "-"*)
+                COMPREPLY=( $(compgen -W "-h" -- ${cur}) )
+                return 0
+            ;;
+        esac
+    elif [[ "${COMP_WORDS[1]}" == "add-layer" ]]; then
+        case "$cur" in
+            "--"*|"")
+                COMPREPLY=( $(compgen -W "${opts_long_add_layer}" --

${cur}) )

contrib/completion/bash/bitbake_layers_completion new file +4 -0
+                return 0
+            ;;
+            "-"*)
+                COMPREPLY=( $(compgen -W "${opts_short_add_layer}" --

${cur}) )

contrib/completion/bash/bitbake_layers_completion new file +7 -0
+                return 0
+            ;;
+        esac
+    elif [[ "${COMP_WORDS[1]}" == "show-overlayed" ]]; then
+        case "$cur" in
+            "--"*|"")
+                COMPREPLY=( $(compgen -W "${opts_long_show_overlayed}" --

${cur}) )

contrib/completion/bash/bitbake_layers_completion new file +4 -0
+                return 0
+            ;;
+            "-"*)
+                COMPREPLY=( $(compgen -W "${opts_short_show_overlayed}" --

${cur}) )

contrib/completion/bash/bitbake_layers_completion new file +7 -0
+                return 0
+            ;;
+        esac
+    elif [[ "${COMP_WORDS[1]}" == "show-recipes" ]]; then
+        case "$cur" in
+            "--"*|"")
+                COMPREPLY=( $(compgen -W "${opts_long_show_recipes}" --

${cur}) )

contrib/completion/bash/bitbake_layers_completion new file +4 -0
+                return 0
+            ;;
+            "-"*)
+                COMPREPLY=( $(compgen -W "${opts_short_show_recipes}" --

${cur}) )

contrib/completion/bash/bitbake_layers_completion new file +18 -2
+                return 0
+            ;;
+        esac
+    elif [[ "${COMP_WORDS[1]}" == "show-cross-depends" ]]; then
+        case "$cur" in
+            "--"*|"")
+                COMPREPLY=( $(compgen -W "${opts_long_show_cross_depends}"
-- ${cur}) )
+                return 0
+            ;;
+            "-"*)
+                COMPREPLY=( $(compgen -W "${opts_short_show_cross_depends}"
-- ${cur}) )
+                return 0
+            ;;
+        esac
+    elif [[ "${COMP_WORDS[1]}" == "layerindex-fetch" ]]; then
+        case "$cur" in
+            "--"*|"")
+                COMPREPLY=( $(compgen -W

"${opts_long_show_layerindex_fetch}" -- ${cur}) )

contrib/completion/bash/bitbake_layers_completion new file +4 -0
+                return 0
+            ;;
+            "-"*)
+                COMPREPLY=( $(compgen -W

"${opts_short_show_layerindex_fetch}" -- ${cur}) )

contrib/completion/bash/bitbake_layers_completion new file +7 -0
+                return 0
+            ;;
+        esac
+    elif [[ "${COMP_WORDS[1]}" == "layerindex-show-depends" ]]; then
+        case "$cur" in
+            "--"*|"")
+                COMPREPLY=( $(compgen -W

"${opts_long_show_layerindex_show_depends}" -- ${cur}) )

contrib/completion/bash/bitbake_layers_completion new file +4 -0
+                return 0
+            ;;
+            "-"*)
+                COMPREPLY=( $(compgen -W

"${opts_short_show_layerindex_show_depends}" -- ${cur}) )

contrib/completion/bash/bitbake_layers_completion new file +43 -2
+                return 0
+            ;;
+        esac
+    elif [[ "${COMP_WORDS[1]}" == "create-layer" ]]; then
+        case "$cur" in
+            "--"*|"")
+                COMPREPLY=( $(compgen -W "${opts_long_show_create_layer}"
-- ${cur}) )
+                return 0
+            ;;
+            "-"*)
+                COMPREPLY=( $(compgen -W "${opts_short_show_create_layer}"
-- ${cur}) )
+                return 0
+            ;;
+        esac
+    fi
+
+    case "$prev" in
+        "-c"|"--color")
+            COMPREPLY=( $(compgen -W "${colors}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+
+    case "$cur" in
+        "--"*)
+            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
+            return 0
+        ;;
+        "-"*)
+            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+
+    if [[ ${prev} == "bitbake-layers" ]]; then
+        COMPREPLY=( $(compgen -W "${subcommands}" -- ${cur}) )
+        return 0
+    elif [[ ! ${subcommands} =~ [[:space:]]${cur}[[:space:]] ]]; then
+        COMPREPLY=( $(compgen -W "${subcommands}" -- ${cur}) )
+        return 0
+    fi
+}
+complete -F _bitbake_layers bitbake-layers
\ No newline at end of file
contrib/completion/bash/bitbake_prserv_completion new file +12 -0
new file mode 100644
index 00000000..3bca1197
@@ -0,0 +1,76 @@
+#!bash
+# Bash completion support for bitbake-prserv tool,
+# compatible with Bitbake 1.39.1.
+#
+# Copyright (C) 2018 Lukasz Gardon <[email protected]>
+#
+# Distributed under the MIT License (MIT)
+#
+
+_bitbake_prserv()
+{
+    local cur prev opts_short opts_long subcommands file_default

log_default log_levels

contrib/completion/bash/bitbake_prserv_completion new file +45 -0
+
+    COMPREPLY=()
+
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+    opts_short="-h -f -l"
+
+    opts_long="--version --help --file= --log= --loglevel= --start \
+                  --stop --host= --port="
+
+    subcommands="layerindex-fetch layerindex-show-depends add-layer \
+                    remove-layer flatten show-layers show-overlayed \
+                        show-recipes show-appends show-cross-depends \
+                        create-layer"
+
+    file_default="prserv.sqlite3"
+    log_default="prserv.log"
+    log_levels="CRITICAL ERROR WARNING INFO DEBUG"
+
+    if [[ "$prev" == "=" ]]; then
+        prev="${COMP_WORDS[COMP_CWORD -2]}"
+    elif [[ "$cur" == "=" ]]; then
+        cur=""
+    fi
+
+    case "$prev" in
+        "-f"|"--file")
+            COMPREPLY=( $(compgen -W "${file_default}" -- ${cur}) )
+            return 0
+        ;;
+        "-l"|"--log")
+            COMPREPLY=( $(compgen -W "${log_default}" -- ${cur}) )
+            return 0
+        ;;
+        "--loglevel")
+            COMPREPLY=( $(compgen -W "${log_levels}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+
+    case "$cur" in
+        "--"*|"")
+            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
+            if [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} == "--"*"=" ]] ;

then

contrib/completion/bash/bitbake_prserv_completion new file +19 -0
+                compopt -o nospace
+            fi
+            return 0
+        ;;
+        "-"*)
+            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+
+    if [[ ${prev} == "bitbake-layers" ]]; then
+        COMPREPLY=( $(compgen -W "${subcommands}" -- ${cur}) )
+        return 0
+    elif [[ ! ${subcommands} =~ [[:space:]]${cur}[[:space:]] ]]; then
+        COMPREPLY=( $(compgen -W "${subcommands}" -- ${cur}) )
+        return 0
+    fi
+}
+complete -F _bitbake_prserv bitbake-prserv
\ No newline at end of file
contrib/completion/bash/bitbake_selftest_completion new file +34 -1
new file mode 100644
index 00000000..8b6bf641
@@ -0,0 +1,34 @@
+#!bash
+# Bash completion support for bitbake-selftest tool,
+# compatible with Bitbake version 1.39.1.
+#
+# Copyright (C) 2018 Lukasz Gardon <[email protected]>
+#
+# Distributed under the MIT License (MIT)
+#
+
+_bitbake_selftest()
+{
+    local cur prev opts_short opts_long
+
+    COMPREPLY=()
+
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+    opts_short="-h -v -q -f -c"
+
+    opts_long="--help --verbose --quiet --locals --failfast --catch"
+
+    case "$cur" in
+        "--"*)
+            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
+            return 0
+        ;;
+        "-"*)
+            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+}
+complete -F _bitbake_selftest bitbake-selftest
\ No newline at end of file
--

2.18.0

--
_______________________________________________
bitbake-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/bitbake-devel

#6 lore raw

Re: Add files supporting bash completion for bitbake tools

Richard, may I ask You kindly help here to decide if such files should be stored in bitbake repository ?

And I see that I used --subject-prefix="[bitbake-devel]” flag while uploading patch, that cause to add additional "[ ]" to topic:
[[bitbake-devel]] Add files supporting bash completion for bitbake tools
Generally I can’t see my patch in the patchwork, It means that I should try again upload this changes to be sure that will be in patchwork properly ?

Quoted 765 lines

Wiadomość napisana przez Łukasz Gardoń <[email protected]> w dniu 03.09.2018, o godz. 21:25:

Add missed [email protected] <mailto:[email protected]> mailing group to this thread.

Quoted 760 lines

Wiadomość napisana przez Łukasz Gardoń <[email protected] <mailto:[email protected]>> w dniu 03.09.2018, o godz. 21:22:

Hi Alex,

thank’s for Your suggestion but for in my opinion keeping this files in bitbake repository is the better place. I would not know to find/search such completion files in bash-completion or any other place. What about vim plugin which is stored in contrib/ dir[1] and which is also comes from dedicated repo[2] same thing.

Anyway, could someone from project architects could comment and help here ?

[1] vim bitbake plugin in bitbake: https://github.com/openembedded/bitbake/tree/master/contrib/vim <https://github.com/openembedded/bitbake/tree/master/contrib/vim>
[2] vim bitbake plugin repo: https://github.com/kergoth/vim-bitbake <https://github.com/kergoth/vim-bitbake>

Quoted 746 lines

Wiadomość napisana przez Alexander Kanavin <[email protected] <mailto:[email protected]>> w dniu 03.09.2018, o godz. 11:25:

Hello Lukasz,

nobody will find your contributions in bitbake/contrib, and so they will be unused and will bitrot. The proper place is the upstream bash-completion project, which will get picked up by all Linux distributions.

Alex

2018-09-02 12:27 GMT+02:00 Łukasz Gardoń <[email protected] <mailto:[email protected]>>:

Quoted 734 lines

Hi Alex,

With information comes file from bitbake repository - bitbake/contrib/README: "This directory is for additional contributed files which may be useful.”.
I think that this is proper place for such files.

Wiadomość napisana przez Alexander Kanavin <[email protected] <mailto:[email protected]>> w dniu 01.09.2018, o godz. 21:33:

The right upstream destination for this is almost certainly
https://github.com/scop/bash-completion <https://github.com/scop/bash-completion>

Alex

2018-09-01 15:36 GMT+02:00 Łukasz Gardoń <[email protected] <mailto:[email protected]>>:

Repository with more details:
https://github.com/lukaszgard/bitbake-completion <https://github.com/lukaszgard/bitbake-completion>

---

contrib/completion/bash/bitbake_completion    | 108 ++++++++++
.../bash/bitbake_diffsigs_completion          |  86 ++++++++
.../bash/bitbake_dumpsig_completion           |  89 +++++++++
.../completion/bash/bitbake_layers_completion | 188 ++++++++++++++++++
.../completion/bash/bitbake_prserv_completion |  76 +++++++
.../bash/bitbake_selftest_completion          |  34 ++++
6 files changed, 581 insertions(+)

create mode 100644 contrib/completion/bash/bitbake_completion create mode 100644 contrib/completion/bash/bitbake_diffsigs_completion create mode 100644 contrib/completion/bash/bitbake_dumpsig_completion create mode 100644 contrib/completion/bash/bitbake_layers_completion create mode 100644 contrib/completion/bash/bitbake_prserv_completion create mode 100644 contrib/completion/bash/bitbake_selftest_completion

contrib/completion/bash/bitbake_completion new file +24 -0
new file mode 100644
index 00000000..23cadf6e
@@ -0,0 +1,108 @@
+#!bash
+# Bash completion support for bitbake 1.39.1 release.
+#
+# Copyright (C) 2014 Sergio Prado <[email protected]>
+# Copyright (C) 2018 Lukasz Gardon <[email protected]>
+#
+# Distributed under the MIT License (MIT)
+#
+
+_bitbake()
+{
+    local cur prev opts_short opts_long tasks recipes ui
+    local bb_layers_conf bb_layers_md5 bb_recipes
+
+    COMPREPLY=()
+
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+    opts_short="-h -b -k -f -c -C -r -R -v -D -q -n -S -p -s -e -g -I \
+                -l -P -u -B -T -m -w"
+
+    opts_long="--version --help --buildfile= --continue --force --cmd= \
+               --clear-stamp= --read= --postread= --verbose --debug --quiet

\

contrib/completion/bash/bitbake_completion new file +8 -3
+               --dry-run --dump-signatures= --parse-only --show-versions \
+               --environment --graphviz --ignore-deps= --log-domains=
--profile \
+               --ui= --token= --revisions-changed --server-only --bind= \
+               --idle-timeout= --no-setscene --setscene-only
--remote-server= \
+               --kill-server --observe-only --status-only --write-log=
--runall= \
+               --runonly="
+
+    tasks="build compile compile_ptest_base configure configure_ptest_base

deploy \
+ distrodata fetch image image_complete install install_ptest_base
package \
+ package_qa package_write_deb package_write_ipk package_write_rpm
package_write_tar \
+ packagedata patch populate_lic populate_sdk populate_sysroot
prepare_recipe_sysroot \
+ rm_work rm_work_all unpack checkpkg checkuri clean cleanall
cleansstate devpyshell \
+ devshell listtasks package_index bootimg bundle_initramfs rootfs
testimage \
+ testimage_auto compile_kernelmodules diffconfig kernel_checkout
kernel_configcheck \
+ kernel_configme kernel_menuconfig kernel_metadata menuconfig
savedefconfig shared_workdir \

contrib/completion/bash/bitbake_completion new file +14 -0
+           sizecheck strip validate_branches spdx"
+
+    ui="knotty ncurses taskexp"
+
+    if [[ "$prev" == "=" ]]; then
+        prev="${COMP_WORDS[COMP_CWORD - 2]}"
+    elif [[ "$cur" == "=" ]]; then
+        cur=""
+    fi
+
+    conf_files=$(find . -maxdepth 1 -name "*.conf" -type f -printf '%P\n')
+
+    case "$prev" in
+

"-c"|"--cmd"|"-C"|"--clear-stamp"|"--ignore-deps"|"--runall"|"--runonly")

contrib/completion/bash/bitbake_completion new file +17 -0
+            COMPREPLY=( $(compgen -W "${tasks}" -- ${cur}) )
+            return 0
+        ;;
+        "-r"|"--read"|"-R"|"--postread")
+            COMPREPLY=( $(compgen -W "${conf_files}" -- ${cur}) )
+            return 0
+        ;;
+        "-u"|"--ui")
+            COMPREPLY=( $(compgen -W "${ui}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+
+    case "$cur" in
+        "--"*)
+            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
+            if [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} == "--"*"=" ]] ;

then

contrib/completion/bash/bitbake_completion new file +16 -0
+                compopt -o nospace
+            fi
+            return 0
+        ;;
+        "-"*)
+            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+
+    bb_layers_conf="conf/bblayers.conf"
+    bb_layers_md5=".bb_layers_conf.md5"
+    bb_recipes=".bb_recipes"
+
+    _parse_recipes () {
+        bitbake -s | sed -e '0,/^=.*/d' -e '/^\s*$/d' -e '/^Summary:/d' |

awk '{print $1}' > $bb_recipes

contrib/completion/bash/bitbake_completion new file +22 -0
+    }
+
+    if [ ! -e $bb_layers_conf ]; then
+        return 0
+    fi
+
+    if [ "$prev" = "bitbake" -a "$cur" = "" ]; then
+        _parse_recipes
+    fi
+
+    md5sum --quiet --status -c $bb_layers_md5 2>/dev/null
+    if [ $? != 0 -o ! -e $bb_recipes ]; then
+         md5sum $bb_layers_conf > $bb_layers_md5
+         _parse_recipes
+    fi
+
+    recipes=$(cat $bb_recipes)
+
+    COMPREPLY=( $(compgen -W "${recipes}" -- ${cur}) )
+    return 0
+}
+complete -F _bitbake bitbake
\ No newline at end of file
contrib/completion/bash/bitbake_diffsigs_completion new file +24 -0
new file mode 100644
index 00000000..cbf2c5f1
@@ -0,0 +1,86 @@
+#!bash
+# Bash completion support for bitbake-diffsigs tool,
+# compatible with Bitbake 1.39.1.
+#
+# Copyright (C) 2018 Lukasz Gardon <[email protected]>
+#
+# Distributed under the MIT License (MIT)
+#
+
+_bitbake_diffsigs()
+{
+    local cur prev opts_short opts_long tasks colors
+    local bb_layers_conf bb_layers_md5 bb_recipes
+
+    COMPREPLY=()
+
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+    opts_short="-h -d -t -s"
+
+    opts_long="--help --debug --color --task --signature"
+
+    tasks="build compile compile_ptest_base configure configure_ptest_base

deploy \
+ distrodata fetch image image_complete install install_ptest_base
package \
+ package_qa package_write_deb package_write_ipk package_write_rpm
package_write_tar \
+ packagedata patch populate_lic populate_sdk populate_sysroot
prepare_recipe_sysroot \
+ rm_work rm_work_all unpack checkpkg checkuri clean cleanall
cleansstate devpyshell \
+ devshell listtasks package_index bootimg bundle_initramfs rootfs
testimage \
+ testimage_auto compile_kernelmodules diffconfig kernel_checkout
kernel_configcheck \
+ kernel_configme kernel_menuconfig kernel_metadata menuconfig
savedefconfig shared_workdir \

contrib/completion/bash/bitbake_diffsigs_completion new file +21 -0
+           sizecheck strip validate_branches spdx"
+
+    colors="auto always never"
+
+    case "$cur" in
+        "--"*)
+            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
+            return 0
+        ;;
+        "-"*)
+            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+
+    bb_layers_conf="conf/bblayers.conf"
+    bb_layers_md5=".bb_layers_conf.md5"
+    bb_recipes=".bb_recipes"
+
+    _parse_recipes () {
+        bitbake -s | sed -e '0,/^=.*/d' -e '/^\s*$/d' -e '/^Summary:/d' |

awk '{print $1}' > $bb_recipes

contrib/completion/bash/bitbake_diffsigs_completion new file +29 -0
+    }
+
+    if [ ! -e $bb_layers_conf ]; then
+        return 0
+    fi
+
+    if [ "$prev" = "bitbake" -a "$cur" = "" ]; then
+           _parse_recipes
+    fi
+
+    md5sum --quiet --status -c $bb_layers_md5 2>/dev/null
+    if [ $? != 0 -o ! -e $bb_recipes ]; then
+        md5sum $bb_layers_conf > $bb_layers_md5
+        _parse_recipes
+    fi
+
+    recipes=$(cat $bb_recipes)
+
+    case "$prev" in
+        "-c"|"--color")
+            COMPREPLY=( $(compgen -W "${colors}" -- ${cur}) )
+            return 0
+        ;;
+        "-t"|"--task")
+          COMPREPLY=( $(compgen -W "${recipes}" -- ${cur}) )
+          return 0
+    esac
+
+    if [[ ${COMP_WORDS[COMP_CWORD -2]} == "-t" ]] || [[

${COMP_WORDS[COMP_CWORD -2]} == "--task" ]]; then

contrib/completion/bash/bitbake_diffsigs_completion new file +5 -0
+        COMPREPLY=( $(compgen -W "${tasks}" -- ${cur}) )
+           return 0
+    fi
+}
+complete -F _bitbake_diffsigs bitbake-diffsigs
\ No newline at end of file
contrib/completion/bash/bitbake_dumpsig_completion new file +24 -0
new file mode 100644
index 00000000..95eb2394
@@ -0,0 +1,89 @@
+#!bash
+# Bash completion support for bitbake-dumpsig tool,
+# compatible with Bitbake 1.39.1.
+#
+# Copyright (C) 2018 Lukasz Gardon <[email protected]>
+#
+# Distributed under the MIT License (MIT)
+#
+
+_bitbake_dumpsig()
+{
+    local cur prev opts_short opts_long tasks
+    local bb_layers_conf bb_layers_md5 bb_recipes
+
+    COMPREPLY=()
+
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+    opts_short="-h -d -t"
+
+    opts_long="--help --debug --task="
+
+    tasks="build compile compile_ptest_base configure configure_ptest_base

deploy \
+ distrodata fetch image image_complete install install_ptest_base
package \
+ package_qa package_write_deb package_write_ipk package_write_rpm
package_write_tar \
+ packagedata patch populate_lic populate_sdk populate_sysroot
prepare_recipe_sysroot \
+ rm_work rm_work_all unpack checkpkg checkuri clean cleanall
cleansstate devpyshell \
+ devshell listtasks package_index bootimg bundle_initramfs rootfs
testimage \
+ testimage_auto compile_kernelmodules diffconfig kernel_checkout
kernel_configcheck \
+ kernel_configme kernel_menuconfig kernel_metadata menuconfig
savedefconfig shared_workdir \

contrib/completion/bash/bitbake_dumpsig_completion new file +12 -0
+           sizecheck strip validate_branches spdx"
+
+    if [[ "$prev" == "=" ]]; then
+        prev="${COMP_WORDS[COMP_CWORD - 2]}"
+    elif [[ "$cur" == "=" ]]; then
+        cur=""
+    fi
+
+    case "$cur" in
+        "--"*)
+            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
+            if [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} == "--"*"=" ]] ;

then

contrib/completion/bash/bitbake_dumpsig_completion new file +16 -0
+                compopt -o nospace
+            fi
+            return 0
+        ;;
+        "-"*)
+            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+
+    bb_layers_conf="conf/bblayers.conf"
+    bb_layers_md5=".bb_layers_conf.md5"
+    bb_recipes=".bb_recipes"
+
+    _parse_recipes () {
+        bitbake -s | sed -e '0,/^=.*/d' -e '/^\s*$/d' -e '/^Summary:/d' |

awk '{print $1}' > $bb_recipes

contrib/completion/bash/bitbake_dumpsig_completion new file +25 -0
+    }
+
+    if [ ! -e $bb_layers_conf ]; then
+        return 0
+    fi
+
+    if [ "$prev" = "bitbake" -a "$cur" = "" ]; then
+           _parse_recipes
+    fi
+
+    md5sum --quiet --status -c $bb_layers_md5 2>/dev/null
+    if [ $? != 0 -o ! -e $bb_recipes ]; then
+        md5sum $bb_layers_conf > $bb_layers_md5
+        _parse_recipes
+    fi
+
+    recipes=$(cat $bb_recipes)
+
+    case "$prev" in
+        "-t"|"--task")
+           COMPREPLY=( $(compgen -W "${recipes}" -- ${cur}) )
+           return 0
+    esac
+
+    if [[ ${COMP_WORDS[COMP_CWORD -2]} =~ "-t" ]] || [[

${COMP_WORDS[COMP_CWORD -3]} == "--task" ]]; then

contrib/completion/bash/bitbake_dumpsig_completion new file +5 -0
+        COMPREPLY=( $(compgen -W "${tasks}" -- ${cur}) )
+           return 0
+    fi
+}
+complete -F _bitbake_dumpsig bitbake-dumpsig
\ No newline at end of file
contrib/completion/bash/bitbake_layers_completion new file +14 -0
new file mode 100644
index 00000000..37ca8afb
@@ -0,0 +1,188 @@
+#!bash
+# Bash completion support for bitbake-layers tool,
+# compatible with Bitbake 1.39.1.
+#
+# Copyright (C) 2018 Lukasz Gardon <[email protected]>
+#
+# Distributed under the MIT License (MIT)
+#
+
+_bitbake_layers()
+{
+    local cur prev opts_short opts_long subcommands colors
+    local opts_long_add_layer opts_short_add_layer opts_long_show_overlayed
+    local opts_short_show_overlayed opts_long_show_recipes

opts_short_show_recipes

contrib/completion/bash/bitbake_layers_completion new file +3 -0
+    local opts_long_show_cross_depends opts_short_show_cross_depends
+    local opts_long_show_layerindex_fetch opts_short_show_layerindex_fetch
+    local opts_long_show_layerindex_show_depends

opts_short_show_layerindex_show_depends
+ local opts_long_show_create_layer opts_short_show_create_layer
bb_class_files classes

contrib/completion/bash/bitbake_layers_completion new file +42 -2
+
+    COMPREPLY=()
+
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+    opts_short="-d -q -F -h"
+
+    opts_long="--debug --quiet --force --color --help"
+
+    subcommands="layerindex-fetch layerindex-show-depends add-layer \
+                    remove-layer flatten show-layers show-overlayed \
+                        show-recipes show-appends show-cross-depends \
+                        create-layer"
+
+    colors="auto always never"
+
+    opts_long_show_overlayed="--help --filenames --same-version"
+    opts_short_show_overlayed="-h -f -s"
+
+    opts_long_show_recipes="--help --filenames --multiple --inherits"
+    opts_short_show_recipes="-h -f -m -i"
+
+    opts_long_show_layerindex_fetch="--help --show-only --branch --ignore"
+    opts_short_show_layerindex_fetch="-h -n -b -i"
+
+    opts_long_add_layer="--help --priority --example-recipe-name
--example-recipe-version"
+    opts_short_add_layer="-h"
+
+    opts_long_show_cross_depends="--help --filenames --ignore"
+    opts_short_show_cross_depends="-h -f -i"
+
+    opts_long_show_layerindex_show_depends="--help --branch"
+    opts_short_show_layerindex_show_depends="-h -b"
+
+    opts_long_show_create_layer="--help --priority --example-recipe-name
--example-recipe-version"
+    opts_short_show_create_layer="-h -p -e -v"
+
+    bb_class_files=".bb_class_files"
+
+    _get_classes() {
+        find $BBPATH/../meta*/classes/ -name *.bbclass -exec basename {} \;

| sed 's/.bbclass//' > $bb_class_files

contrib/completion/bash/bitbake_layers_completion new file +12 -0
+    }
+
+    if [[ "${COMP_WORDS[@]}" =~ show-recipes ]] ; then
+        if [[ "$prev" == "--inherits" ]] || [[ "$prev" == "-i" ]]; then
+            _get_classes
+            classes=$(cat $bb_class_files)
+            COMPREPLY=( $(compgen -W "${classes}" -- ${cur}) )
+            return 0
+        fi
+    fi
+
+    if [[ "${COMP_WORDS[1]}" =~

show-layers|show-appends|remove-layer|flatten ]]; then

contrib/completion/bash/bitbake_layers_completion new file +14 -0
+        case "$cur" in
+            "--"*)
+                COMPREPLY=( $(compgen -W "--help" -- ${cur}) )
+                return 0
+            ;;
+            "-"*)
+                COMPREPLY=( $(compgen -W "-h" -- ${cur}) )
+                return 0
+            ;;
+        esac
+    elif [[ "${COMP_WORDS[1]}" == "add-layer" ]]; then
+        case "$cur" in
+            "--"*|"")
+                COMPREPLY=( $(compgen -W "${opts_long_add_layer}" --

${cur}) )

contrib/completion/bash/bitbake_layers_completion new file +4 -0
+                return 0
+            ;;
+            "-"*)
+                COMPREPLY=( $(compgen -W "${opts_short_add_layer}" --

${cur}) )

contrib/completion/bash/bitbake_layers_completion new file +7 -0
+                return 0
+            ;;
+        esac
+    elif [[ "${COMP_WORDS[1]}" == "show-overlayed" ]]; then
+        case "$cur" in
+            "--"*|"")
+                COMPREPLY=( $(compgen -W "${opts_long_show_overlayed}" --

${cur}) )

contrib/completion/bash/bitbake_layers_completion new file +4 -0
+                return 0
+            ;;
+            "-"*)
+                COMPREPLY=( $(compgen -W "${opts_short_show_overlayed}" --

${cur}) )

contrib/completion/bash/bitbake_layers_completion new file +7 -0
+                return 0
+            ;;
+        esac
+    elif [[ "${COMP_WORDS[1]}" == "show-recipes" ]]; then
+        case "$cur" in
+            "--"*|"")
+                COMPREPLY=( $(compgen -W "${opts_long_show_recipes}" --

${cur}) )

contrib/completion/bash/bitbake_layers_completion new file +4 -0
+                return 0
+            ;;
+            "-"*)
+                COMPREPLY=( $(compgen -W "${opts_short_show_recipes}" --

${cur}) )

contrib/completion/bash/bitbake_layers_completion new file +18 -2
+                return 0
+            ;;
+        esac
+    elif [[ "${COMP_WORDS[1]}" == "show-cross-depends" ]]; then
+        case "$cur" in
+            "--"*|"")
+                COMPREPLY=( $(compgen -W "${opts_long_show_cross_depends}"
-- ${cur}) )
+                return 0
+            ;;
+            "-"*)
+                COMPREPLY=( $(compgen -W "${opts_short_show_cross_depends}"
-- ${cur}) )
+                return 0
+            ;;
+        esac
+    elif [[ "${COMP_WORDS[1]}" == "layerindex-fetch" ]]; then
+        case "$cur" in
+            "--"*|"")
+                COMPREPLY=( $(compgen -W

"${opts_long_show_layerindex_fetch}" -- ${cur}) )

contrib/completion/bash/bitbake_layers_completion new file +4 -0
+                return 0
+            ;;
+            "-"*)
+                COMPREPLY=( $(compgen -W

"${opts_short_show_layerindex_fetch}" -- ${cur}) )

contrib/completion/bash/bitbake_layers_completion new file +7 -0
+                return 0
+            ;;
+        esac
+    elif [[ "${COMP_WORDS[1]}" == "layerindex-show-depends" ]]; then
+        case "$cur" in
+            "--"*|"")
+                COMPREPLY=( $(compgen -W

"${opts_long_show_layerindex_show_depends}" -- ${cur}) )

contrib/completion/bash/bitbake_layers_completion new file +4 -0
+                return 0
+            ;;
+            "-"*)
+                COMPREPLY=( $(compgen -W

"${opts_short_show_layerindex_show_depends}" -- ${cur}) )

contrib/completion/bash/bitbake_layers_completion new file +43 -2
+                return 0
+            ;;
+        esac
+    elif [[ "${COMP_WORDS[1]}" == "create-layer" ]]; then
+        case "$cur" in
+            "--"*|"")
+                COMPREPLY=( $(compgen -W "${opts_long_show_create_layer}"
-- ${cur}) )
+                return 0
+            ;;
+            "-"*)
+                COMPREPLY=( $(compgen -W "${opts_short_show_create_layer}"
-- ${cur}) )
+                return 0
+            ;;
+        esac
+    fi
+
+    case "$prev" in
+        "-c"|"--color")
+            COMPREPLY=( $(compgen -W "${colors}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+
+    case "$cur" in
+        "--"*)
+            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
+            return 0
+        ;;
+        "-"*)
+            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+
+    if [[ ${prev} == "bitbake-layers" ]]; then
+        COMPREPLY=( $(compgen -W "${subcommands}" -- ${cur}) )
+        return 0
+    elif [[ ! ${subcommands} =~ [[:space:]]${cur}[[:space:]] ]]; then
+        COMPREPLY=( $(compgen -W "${subcommands}" -- ${cur}) )
+        return 0
+    fi
+}
+complete -F _bitbake_layers bitbake-layers
\ No newline at end of file
contrib/completion/bash/bitbake_prserv_completion new file +12 -0
new file mode 100644
index 00000000..3bca1197
@@ -0,0 +1,76 @@
+#!bash
+# Bash completion support for bitbake-prserv tool,
+# compatible with Bitbake 1.39.1.
+#
+# Copyright (C) 2018 Lukasz Gardon <[email protected]>
+#
+# Distributed under the MIT License (MIT)
+#
+
+_bitbake_prserv()
+{
+    local cur prev opts_short opts_long subcommands file_default

log_default log_levels

contrib/completion/bash/bitbake_prserv_completion new file +45 -0
+
+    COMPREPLY=()
+
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+    opts_short="-h -f -l"
+
+    opts_long="--version --help --file= --log= --loglevel= --start \
+                  --stop --host= --port="
+
+    subcommands="layerindex-fetch layerindex-show-depends add-layer \
+                    remove-layer flatten show-layers show-overlayed \
+                        show-recipes show-appends show-cross-depends \
+                        create-layer"
+
+    file_default="prserv.sqlite3"
+    log_default="prserv.log"
+    log_levels="CRITICAL ERROR WARNING INFO DEBUG"
+
+    if [[ "$prev" == "=" ]]; then
+        prev="${COMP_WORDS[COMP_CWORD -2]}"
+    elif [[ "$cur" == "=" ]]; then
+        cur=""
+    fi
+
+    case "$prev" in
+        "-f"|"--file")
+            COMPREPLY=( $(compgen -W "${file_default}" -- ${cur}) )
+            return 0
+        ;;
+        "-l"|"--log")
+            COMPREPLY=( $(compgen -W "${log_default}" -- ${cur}) )
+            return 0
+        ;;
+        "--loglevel")
+            COMPREPLY=( $(compgen -W "${log_levels}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+
+    case "$cur" in
+        "--"*|"")
+            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
+            if [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} == "--"*"=" ]] ;

then

contrib/completion/bash/bitbake_prserv_completion new file +19 -0
+                compopt -o nospace
+            fi
+            return 0
+        ;;
+        "-"*)
+            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+
+    if [[ ${prev} == "bitbake-layers" ]]; then
+        COMPREPLY=( $(compgen -W "${subcommands}" -- ${cur}) )
+        return 0
+    elif [[ ! ${subcommands} =~ [[:space:]]${cur}[[:space:]] ]]; then
+        COMPREPLY=( $(compgen -W "${subcommands}" -- ${cur}) )
+        return 0
+    fi
+}
+complete -F _bitbake_prserv bitbake-prserv
\ No newline at end of file
contrib/completion/bash/bitbake_selftest_completion new file +34 -1
new file mode 100644
index 00000000..8b6bf641
@@ -0,0 +1,34 @@
+#!bash
+# Bash completion support for bitbake-selftest tool,
+# compatible with Bitbake version 1.39.1.
+#
+# Copyright (C) 2018 Lukasz Gardon <[email protected]>
+#
+# Distributed under the MIT License (MIT)
+#
+
+_bitbake_selftest()
+{
+    local cur prev opts_short opts_long
+
+    COMPREPLY=()
+
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+    opts_short="-h -v -q -f -c"
+
+    opts_long="--help --verbose --quiet --locals --failfast --catch"
+
+    case "$cur" in
+        "--"*)
+            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
+            return 0
+        ;;
+        "-"*)
+            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+}
+complete -F _bitbake_selftest bitbake-selftest
\ No newline at end of file
--

2.18.0

--
_______________________________________________
bitbake-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/bitbake-devel

#7 lore raw

Re: Add files supporting bash completion for bitbake tools

Quoted 2 lines · Łukasz Gardoń

Richard, may I ask You kindly help here to decide if such files should be stored in bitbake repository ?

My initial reaction is what the upstream policy for bash completions is?

We don't tend to install bitbake as a traditional programme so users will probably struggle to access these if they're in bitbake. If they were in upstream bash-completion, it would likely make for a better experience.

So I'd probably ask upstream as that is probably the preferred location. If they won't take them for some reason, bitbake would be a second choice.

Cheers,

Richard

#17 lore raw

Re: Add files supporting bash completion for bitbake tools

In reply to a message not in the archive
Quoted 11 lines · Łukasz Gardoń

Indeed, poky repository is combined with using combo layer tool, I forger about this fact.

So how fell can I prepare a change with adding completion files for BitBake into bitbake repository (just storing those files under contrib dir). And also prepare a change for oe-core also with adding complete files under contrib dir (e.g for devtool) and adapt env scripts.

I am volunteering my self for keeping update these files if this is possible.

I guess I'm ok in principle to do something like this and happy to have a maintainer. I did look at the patches and I don't think they're acceptable in their current form though.

The list of tasks is hardcoded whilst in reality different recipes have different tasks and the available tasks is metadata defined. I do not want to see a hardcoded list of tasks. The expression to obtain recipe data is also rather ugly.

Ultimately our plan is to have bitbake be memory resident so there is no real parsing overhead for queries. If that were the case we'd be able to get correct recipe/task information from bitbake.

So in principle, I'm open to the idea but we likely need memory resident bitbake and a helper to pull the info you need for correct completion data directly from bitbake rather than guessing.

Cheers,

Richard