[meta-arago] [RFC][PATCH] opkg-bash-completions: add enhancements to completions

2020-02-06 Thread Jacob Stiffler
* Use helpers (e.g. _init_completion, _count_args) to enhance usability
* Add support for search and flag verbs

Signed-off-by: Jacob Stiffler 
---
 .../recipes-devtools/opkg/opkg-bash-completion.bb  |  2 +
 .../opkg/opkg-bash-completion/opkg-bash-completion | 43 ++
 2 files changed, 37 insertions(+), 8 deletions(-)

diff --git a/meta-arago-extras/recipes-devtools/opkg/opkg-bash-completion.bb 
b/meta-arago-extras/recipes-devtools/opkg/opkg-bash-completion.bb
index 74e4964..6055507 100644
--- a/meta-arago-extras/recipes-devtools/opkg/opkg-bash-completion.bb
+++ b/meta-arago-extras/recipes-devtools/opkg/opkg-bash-completion.bb
@@ -1,6 +1,8 @@
 SUMMARY = "bash-completions for opkg"
 LICENSE = "MIT"
 
+PR = "r1"
+
 LIC_FILES_CHKSUM = 
"file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
 
 SRC_URI = "file://opkg-bash-completion"
diff --git 
a/meta-arago-extras/recipes-devtools/opkg/opkg-bash-completion/opkg-bash-completion
 
b/meta-arago-extras/recipes-devtools/opkg/opkg-bash-completion/opkg-bash-completion
index 5b0b4e1..82b6c6f 100644
--- 
a/meta-arago-extras/recipes-devtools/opkg/opkg-bash-completion/opkg-bash-completion
+++ 
b/meta-arago-extras/recipes-devtools/opkg/opkg-bash-completion/opkg-bash-completion
@@ -2,24 +2,51 @@
 
 # TBD: parse "opkg --help" to get this list
 OPKG_COMMANDS="update upgrade install configure remove clean flag list 
list-installed list-upgradable list-changed-conffiles files search find info 
status download compare-versions print-architecture depends whatdepends 
whatdependsrec whatrecommends whatsuggests whatprovides whatconflicts 
whatreplaces"
+OPKG_FLAGS="hold noprune user ok installed unpacked"
+OPKG_LONGOPTS="--help --verbosity --conf --dest --offline-root --add-arch 
--add-dest --add-exclude --add-ignore-recommends --prefer-arch-to-version 
--combine --force-depends --force-maintainer --force-reinstall 
--force-overwrite --force-downgrade --force-space --force-postinstall 
--force-remove --force-checksum --noaction --size --download-only --nodeps 
--no-install-recommends --force-removal-of-dependent-packages --autoremove 
--tmp-dir --lists-dir --cache-dir --host-cache-dir --volatile-cache"
 
 _opkg_completions() {
-if [ ${#COMP_WORDS[@]} -eq 2 ]
+# Use this helpful helper to beautify things and catch vars and redirects
+local cur prev words cword
+_init_completion -s || return 0
+
+# Catch options first
+if [[ "$cur" == -* ]]
 then
-COMPREPLY=($(compgen -W "${OPKG_COMMANDS}" "${COMP_WORDS[1]}"))
+COMPREPLY=($(compgen -W "${OPKG_LONGOPTS}" -- "$cur"))
 return
 fi
 
-# TBD: add more cases, support options
-case "${COMP_WORDS[1]}" in
+# Now catch args
+# opkg supports a single verb, so that will be the first arg,
+local arg args
+_get_first_arg
+_count_args
+
+case "$arg" in
 install|files|info|status|download)
-COMPREPLY=($(compgen -W "$(opkg list | sed -e 's| .*$||')" -- 
"${COMP_WORDS[$COMP_CWORD]}"));;
+COMPREPLY=($(compgen -W "$(opkg list | sed -e 's| .*$||')" -- 
"$cur"));;
 
depends|whatdepends|whatdependsrec|whatrecommends|whatsuggests|whatprovides|whatconflicts|whatreplaces)
-COMPREPLY=($(compgen -W "-A $(opkg list | sed -e 's| .*$||')" -- 
"${COMP_WORDS[$COMP_CWORD]}"));;
+COMPREPLY=($(compgen -W "-A $(opkg list | sed -e 's| .*$||')" -- 
"$cur"));;
 remove)
-COMPREPLY=($(compgen -W "$(opkg list-installed | sed -e 's| 
.*$||')" -- "${COMP_WORDS[$COMP_CWORD]}"));;
+COMPREPLY=($(compgen -W "$(opkg list-installed | sed -e 's| 
.*$||')" -- "$cur"));;
 upgrade)
-COMPREPLY=($(compgen -W "$(opkg list-upgradable | sed -e 's| 
.*$||')" -- "${COMP_WORDS[$COMP_CWORD]}"));;
+COMPREPLY=($(compgen -W "$(opkg list-upgradable | sed -e 's| 
.*$||')" -- "$cur"));;
+flag)
+if [ $args -eq 2 ]
+then
+COMPREPLY=($(compgen -W "${OPKG_FLAGS}" "$cur"))
+else
+COMPREPLY=($(compgen -W "-A $(opkg list | sed -e 's| .*$||')" 
-- "$cur"))
+fi
+;;
+search)
+# Only search for a single file
+[ $args -gt 2 ] || _longopt;;
+"")
+COMPREPLY=($(compgen -W "${OPKG_COMMANDS}" -- "$cur"));;
+*)
+COMPREPLY=( "*" "I DONT KNOW WHAT TO DO!!!" )
 esac
 }
 
-- 
1.9.1

___
meta-arago mailing list
meta-arago@arago-project.org
http://arago-project.org/cgi-bin/mailman/listinfo/meta-arago


Re: [meta-arago] [zeus/master][PATCH] Revert "HACK: weston: revert EGL_KHR_partial_update changes that require EGL 1.5"

2020-02-06 Thread Andrew F. Davis
On 2/5/20 6:09 PM, Denys Dmytriyenko wrote:
> From: Denys Dmytriyenko 
> 
> Now, that our SGX DDK UM libs support EGL 1.5, these can be dropped.
> 
> This reverts commit 5ab873a1b06648286711ec2b9acb849b07a5443c.
> 
> Signed-off-by: Denys Dmytriyenko 
> Reported-by: Scott Murray 
> Cc: Andrew F. Davis 


Acked-by: Andrew F. Davis 

You can also drop this other weston patch for the same reason:
"Allow visual_id to be 0"

Andrew


> ---
>  ...renderer-Add-EGL_EXT_partial_update-query.patch | 47 
>  ...l-renderer-Support-EGL_KHR_partial_update.patch | 51 
> --
>  .../recipes-graphics/wayland/weston_7.0.0.bbappend |  7 +--
>  3 files changed, 2 insertions(+), 103 deletions(-)
>  delete mode 100644 
> meta-arago-distro/recipes-graphics/wayland/weston/0001-Revert-gl-renderer-Add-EGL_EXT_partial_update-query.patch
>  delete mode 100644 
> meta-arago-distro/recipes-graphics/wayland/weston/0001-Revert-gl-renderer-Support-EGL_KHR_partial_update.patch
> 
> diff --git 
> a/meta-arago-distro/recipes-graphics/wayland/weston/0001-Revert-gl-renderer-Add-EGL_EXT_partial_update-query.patch
>  
> b/meta-arago-distro/recipes-graphics/wayland/weston/0001-Revert-gl-renderer-Add-EGL_EXT_partial_update-query.patch
> deleted file mode 100644
> index 556440e..000
> --- 
> a/meta-arago-distro/recipes-graphics/wayland/weston/0001-Revert-gl-renderer-Add-EGL_EXT_partial_update-query.patch
> +++ /dev/null
> @@ -1,47 +0,0 @@
> -From e9ce4695a1ea78434b7244705ef3fd2af7b360f7 Mon Sep 17 00:00:00 2001
> -From: Denys Dmytriyenko 
> -Date: Thu, 12 Sep 2019 21:03:18 -0400
> -Subject: [PATCH] Revert "gl-renderer: Add EGL_EXT_partial_update query"
> -
> -This reverts commit 0a86a81cc251330b15e213fde8434f291e35bf88.
> -
> -Signed-off-by: Denys Dmytriyenko 
> 
> - libweston/renderer-gl/gl-renderer.c | 7 ---
> - 1 file changed, 7 deletions(-)
> -
> -diff --git a/libweston/renderer-gl/gl-renderer.c 
> b/libweston/renderer-gl/gl-renderer.c
> -index 6c2a56d..590ef09 100644
>  a/libweston/renderer-gl/gl-renderer.c
> -+++ b/libweston/renderer-gl/gl-renderer.c
> -@@ -233,8 +233,6 @@ struct gl_renderer {
> - bool has_egl_image_external;
> - 
> - bool has_egl_buffer_age;
> --bool has_egl_partial_update;
> --PFNEGLSETDAMAGEREGIONKHRPROC set_damage_region;
> - 
> - bool has_configless_context;
> - 
> -@@ -3515,8 +3513,6 @@ gl_renderer_setup_egl_extensions(struct 
> weston_compositor *ec)
> - (void *) eglGetProcAddress("eglUnbindWaylandDisplayWL");
> - gr->query_buffer =
> - (void *) eglGetProcAddress("eglQueryWaylandBufferWL");
> --gr->set_damage_region =
> --(void *) eglGetProcAddress("eglSetDamageRegionKHR");
> - 
> - extensions =
> - (const char *) eglQueryString(gr->egl_display, EGL_EXTENSIONS);
> -@@ -3539,9 +3535,6 @@ gl_renderer_setup_egl_extensions(struct 
> weston_compositor *ec)
> - if (weston_check_egl_extension(extensions, "EGL_EXT_buffer_age"))
> - gr->has_egl_buffer_age = true;
> - 
> --if (weston_check_egl_extension(extensions, "EGL_KHR_partial_update"))
> --gr->has_egl_partial_update = true;
> --
> - for (i = 0; i < ARRAY_LENGTH(swap_damage_ext_to_entrypoint); i++) {
> - if (weston_check_egl_extension(extensions,
> - swap_damage_ext_to_entrypoint[i].extension)) {
> --- 
> -2.7.4
> -
> diff --git 
> a/meta-arago-distro/recipes-graphics/wayland/weston/0001-Revert-gl-renderer-Support-EGL_KHR_partial_update.patch
>  
> b/meta-arago-distro/recipes-graphics/wayland/weston/0001-Revert-gl-renderer-Support-EGL_KHR_partial_update.patch
> deleted file mode 100644
> index f6fd845..000
> --- 
> a/meta-arago-distro/recipes-graphics/wayland/weston/0001-Revert-gl-renderer-Support-EGL_KHR_partial_update.patch
> +++ /dev/null
> @@ -1,51 +0,0 @@
> -From c4e7764e9062729a320d2a81f4b4f1a2392454cb Mon Sep 17 00:00:00 2001
> -From: Denys Dmytriyenko 
> -Date: Thu, 12 Sep 2019 21:20:01 -0400
> -Subject: [PATCH] Revert "gl-renderer: Support EGL_KHR_partial_update"
> -
> -This reverts commit df2095fa35fe84e4ebc30754dd9f25e50bd1aa47.
> -
> -Signed-off-by: Denys Dmytriyenko 
> 
> - libweston/renderer-gl/gl-renderer.c | 18 ++
> - 1 file changed, 2 insertions(+), 16 deletions(-)
> -
> -diff --git a/libweston/renderer-gl/gl-renderer.c 
> b/libweston/renderer-gl/gl-renderer.c
> -index 590ef09..a95e873 100644
>  a/libweston/renderer-gl/gl-renderer.c
> -+++ b/libweston/renderer-gl/gl-renderer.c
> -@@ -1531,8 +1531,8 @@ gl_renderer_repaint_output(struct weston_output 
> *output,
> - 
> - /* In fan debug mode, redraw everything to make sure that we clear any
> -  * fans left over from previous draws on this buffer.
> -- * This precludes the use of EGL_EXT_swap_buffers_with_damage and
> -- * EGL_KHR_partial_update, since we damage the whole area. */
> -+ * This precludes the use of EGL_EXT_swap_buffers_with_damage, since
> -+