All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bash-completion: Remove obsolete usage of 'have' function
@ 2014-12-06  3:22 Mike Gilbert
  2014-12-06  6:59 ` Andrei Borzenkov
  0 siblings, 1 reply; 6+ messages in thread
From: Mike Gilbert @ 2014-12-06  3:22 UTC (permalink / raw
  To: grub-devel

Recent versions of bash-completion do not provide the 'have' function.
To keep things simple, this patch just removes it completely.
---
 ChangeLog                                      |  4 ++
 util/bash-completion.d/grub-completion.bash.in | 66 +++++---------------------
 2 files changed, 17 insertions(+), 53 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a9ed5aa..3554467 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2014-12-05  Mike Gilbert  <floppym@gentoo.org>
+	* util/bash-completion.d/grub-completion.bash.in: Remove references to
+	'have' function.
+
 2014-12-05  Andrei Borzenkov  <arvidjaar@gmail.com>
 
 	* tests/util/grub-shell.in: Support --files also for netboot.
diff --git a/util/bash-completion.d/grub-completion.bash.in b/util/bash-completion.d/grub-completion.bash.in
index 44bf135..2b98004 100644
--- a/util/bash-completion.d/grub-completion.bash.in
+++ b/util/bash-completion.d/grub-completion.bash.in
@@ -165,15 +165,8 @@ _grub_set_entry () {
     fi
 }
 
-__grub_set_default_program="@grub_set_default@"
-have ${__grub_set_default_program} && \
-    complete -F _grub_set_entry -o filenames ${__grub_set_default_program}
-unset __grub_set_default_program
-
-__grub_reboot_program="@grub_reboot@"
-have ${__grub_reboot_program} && \
- complete -F _grub_set_entry -o filenames ${__grub_reboot_program}
-unset __grub_reboot_program
+complete -F _grub_set_entry -o filenames @grub_set_default@
+complete -F _grub_set_entry -o filenames @grub_reboot@
 
 
 #
@@ -197,10 +190,7 @@ _grub_editenv () {
                 create list set unset"
 }
 
-__grub_editenv_program="@grub_editenv@"
-have ${__grub_editenv_program} && \
- complete -F _grub_editenv -o filenames ${__grub_editenv_program}
-unset __grub_editenv_program
+complete -F _grub_editenv -o filenames @grub_editenv@
 
 
 #
@@ -218,10 +208,7 @@ _grub_mkconfig () {
         _filedir
     fi
 }
-__grub_mkconfig_program="@grub_mkconfig@"
-have ${__grub_mkconfig_program} && \
- complete -F _grub_mkconfig -o filenames ${__grub_mkconfig_program}
-unset __grub_mkconfig_program
+complete -F _grub_mkconfig -o filenames @grub_mkconfig@
 
 
 #
@@ -253,15 +240,8 @@ _grub_setup () {
     fi
 }
 
-__grub_bios_setup_program="@grub_bios_setup@"
-have ${__grub_bios_setup_program} && \
- complete -F _grub_setup -o filenames ${__grub_bios_setup_program}
-unset __grub_bios_setup_program
-
-__grub_sparc64_setup_program="@grub_sparc64_setup@"
-have ${__grub_sparc64_setup_program} && \
- complete -F _grub_setup -o filenames ${__grub_sparc64_setup_program}
-unset __grub_sparc64_setup_program
+complete -F _grub_setup -o filenames @grub_bios_setup@
+complete -F _grub_setup -o filenames @grub_sparc64_setup@
 
 
 #
@@ -304,10 +284,7 @@ _grub_install () {
         _filedir
     fi
 }
-__grub_install_program="@grub_install@"
-have ${__grub_install_program} && \
- complete -F _grub_install -o filenames ${__grub_install_program}
-unset __grub_install_program
+complete -F _grub_install -o filenames @grub_install@
 
 
 #
@@ -326,10 +303,7 @@ _grub_mkfont () {
         _filedir
     fi
 }
-__grub_mkfont_program="@grub_mkfont@"
-have ${__grub_mkfont_program} && \
- complete -F _grub_mkfont -o filenames ${__grub_mkfont_program}
-unset __grub_mkfont_program
+complete -F _grub_mkfont -o filenames @grub_mkfont@
 
 
 #
@@ -357,10 +331,7 @@ _grub_mkrescue () {
         _filedir
     fi
 }
-__grub_mkrescue_program="@grub_mkrescue@"
-have ${__grub_mkrescue_program} && \
- complete -F _grub_mkrescue -o filenames ${__grub_mkrescue_program}
-unset __grub_mkrescue_program
+complete -F _grub_mkrescue -o filenames @grub_mkrescue@
 
 
 #
@@ -399,10 +370,7 @@ _grub_mkimage () {
         _filedir
     fi
 }
-__grub_mkimage_program="@grub_mkimage@"
-have ${__grub_mkimage_program} && \
- complete -F _grub_mkimage -o filenames ${__grub_mkimage_program}
-unset __grub_mkimage_program
+complete -F _grub_mkimage -o filenames @grub_mkimage@
 
 
 #
@@ -421,10 +389,7 @@ _grub_mkpasswd_pbkdf2 () {
         _filedir
     fi
 }
-__grub_mkpasswd_pbkdf2_program="@grub_mkpasswd_pbkdf2@"
-have ${__grub_mkpasswd_pbkdf2_program} && \
- complete -F _grub_mkpasswd_pbkdf2 -o filenames ${__grub_mkpasswd_pbkdf2_program}
-unset __grub_mkpasswd_pbkdf2_program
+complete -F _grub_mkpasswd_pbkdf2 -o filenames @grub_mkpasswd_pbkdf2@
 
 
 #
@@ -459,10 +424,7 @@ _grub_probe () {
         _filedir
     fi
 }
-__grub_probe_program="@grub_probe@"
-have ${__grub_probe_program} && \
- complete -F _grub_probe -o filenames ${__grub_probe_program}
-unset __grub_probe_program
+complete -F _grub_probe -o filenames @grub_probe@
 
 
 #
@@ -481,9 +443,7 @@ _grub_script_check () {
         _filedir
     fi
 }
-__grub_script_check_program="@grub_script_check@"
-have ${__grub_script_check_program} && \
- complete -F _grub_script_check -o filenames ${__grub_script_check_program}
+complete -F _grub_script_check -o filenames @grub_script_check@
 
 
 # Local variables:
-- 
2.2.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] bash-completion: Remove obsolete usage of 'have' function
  2014-12-06  3:22 [PATCH] bash-completion: Remove obsolete usage of 'have' function Mike Gilbert
@ 2014-12-06  6:59 ` Andrei Borzenkov
  2014-12-07 17:06   ` Mike Gilbert
  2014-12-07 18:23   ` Justin
  0 siblings, 2 replies; 6+ messages in thread
From: Andrei Borzenkov @ 2014-12-06  6:59 UTC (permalink / raw
  To: Mike Gilbert; +Cc: grub-devel

В Fri,  5 Dec 2014 22:22:23 -0500
Mike Gilbert <floppym@gentoo.org> пишет:

> Recent versions of bash-completion do not provide the 'have' function.

It still does as of today GIT.

> To keep things simple, this patch just removes it completely.

No, that is not what was intended when 'have' was deprecated. You should
put completion for each command in separate function which is then
autoloaded on demand.

> ---
>  ChangeLog                                      |  4 ++
>  util/bash-completion.d/grub-completion.bash.in | 66 +++++---------------------
>  2 files changed, 17 insertions(+), 53 deletions(-)
> 
> diff --git a/ChangeLog b/ChangeLog
> index a9ed5aa..3554467 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,7 @@
> +2014-12-05  Mike Gilbert  <floppym@gentoo.org>
> +	* util/bash-completion.d/grub-completion.bash.in: Remove references to
> +	'have' function.
> +
>  2014-12-05  Andrei Borzenkov  <arvidjaar@gmail.com>
>  
>  	* tests/util/grub-shell.in: Support --files also for netboot.
> diff --git a/util/bash-completion.d/grub-completion.bash.in b/util/bash-completion.d/grub-completion.bash.in
> index 44bf135..2b98004 100644
> --- a/util/bash-completion.d/grub-completion.bash.in
> +++ b/util/bash-completion.d/grub-completion.bash.in
> @@ -165,15 +165,8 @@ _grub_set_entry () {
>      fi
>  }
>  
> -__grub_set_default_program="@grub_set_default@"
> -have ${__grub_set_default_program} && \
> -    complete -F _grub_set_entry -o filenames ${__grub_set_default_program}
> -unset __grub_set_default_program
> -
> -__grub_reboot_program="@grub_reboot@"
> -have ${__grub_reboot_program} && \
> - complete -F _grub_set_entry -o filenames ${__grub_reboot_program}
> -unset __grub_reboot_program
> +complete -F _grub_set_entry -o filenames @grub_set_default@
> +complete -F _grub_set_entry -o filenames @grub_reboot@
>  
>  
>  #
> @@ -197,10 +190,7 @@ _grub_editenv () {
>                  create list set unset"
>  }
>  
> -__grub_editenv_program="@grub_editenv@"
> -have ${__grub_editenv_program} && \
> - complete -F _grub_editenv -o filenames ${__grub_editenv_program}
> -unset __grub_editenv_program
> +complete -F _grub_editenv -o filenames @grub_editenv@
>  
>  
>  #
> @@ -218,10 +208,7 @@ _grub_mkconfig () {
>          _filedir
>      fi
>  }
> -__grub_mkconfig_program="@grub_mkconfig@"
> -have ${__grub_mkconfig_program} && \
> - complete -F _grub_mkconfig -o filenames ${__grub_mkconfig_program}
> -unset __grub_mkconfig_program
> +complete -F _grub_mkconfig -o filenames @grub_mkconfig@
>  
>  
>  #
> @@ -253,15 +240,8 @@ _grub_setup () {
>      fi
>  }
>  
> -__grub_bios_setup_program="@grub_bios_setup@"
> -have ${__grub_bios_setup_program} && \
> - complete -F _grub_setup -o filenames ${__grub_bios_setup_program}
> -unset __grub_bios_setup_program
> -
> -__grub_sparc64_setup_program="@grub_sparc64_setup@"
> -have ${__grub_sparc64_setup_program} && \
> - complete -F _grub_setup -o filenames ${__grub_sparc64_setup_program}
> -unset __grub_sparc64_setup_program
> +complete -F _grub_setup -o filenames @grub_bios_setup@
> +complete -F _grub_setup -o filenames @grub_sparc64_setup@
>  
>  
>  #
> @@ -304,10 +284,7 @@ _grub_install () {
>          _filedir
>      fi
>  }
> -__grub_install_program="@grub_install@"
> -have ${__grub_install_program} && \
> - complete -F _grub_install -o filenames ${__grub_install_program}
> -unset __grub_install_program
> +complete -F _grub_install -o filenames @grub_install@
>  
>  
>  #
> @@ -326,10 +303,7 @@ _grub_mkfont () {
>          _filedir
>      fi
>  }
> -__grub_mkfont_program="@grub_mkfont@"
> -have ${__grub_mkfont_program} && \
> - complete -F _grub_mkfont -o filenames ${__grub_mkfont_program}
> -unset __grub_mkfont_program
> +complete -F _grub_mkfont -o filenames @grub_mkfont@
>  
>  
>  #
> @@ -357,10 +331,7 @@ _grub_mkrescue () {
>          _filedir
>      fi
>  }
> -__grub_mkrescue_program="@grub_mkrescue@"
> -have ${__grub_mkrescue_program} && \
> - complete -F _grub_mkrescue -o filenames ${__grub_mkrescue_program}
> -unset __grub_mkrescue_program
> +complete -F _grub_mkrescue -o filenames @grub_mkrescue@
>  
>  
>  #
> @@ -399,10 +370,7 @@ _grub_mkimage () {
>          _filedir
>      fi
>  }
> -__grub_mkimage_program="@grub_mkimage@"
> -have ${__grub_mkimage_program} && \
> - complete -F _grub_mkimage -o filenames ${__grub_mkimage_program}
> -unset __grub_mkimage_program
> +complete -F _grub_mkimage -o filenames @grub_mkimage@
>  
>  
>  #
> @@ -421,10 +389,7 @@ _grub_mkpasswd_pbkdf2 () {
>          _filedir
>      fi
>  }
> -__grub_mkpasswd_pbkdf2_program="@grub_mkpasswd_pbkdf2@"
> -have ${__grub_mkpasswd_pbkdf2_program} && \
> - complete -F _grub_mkpasswd_pbkdf2 -o filenames ${__grub_mkpasswd_pbkdf2_program}
> -unset __grub_mkpasswd_pbkdf2_program
> +complete -F _grub_mkpasswd_pbkdf2 -o filenames @grub_mkpasswd_pbkdf2@
>  
>  
>  #
> @@ -459,10 +424,7 @@ _grub_probe () {
>          _filedir
>      fi
>  }
> -__grub_probe_program="@grub_probe@"
> -have ${__grub_probe_program} && \
> - complete -F _grub_probe -o filenames ${__grub_probe_program}
> -unset __grub_probe_program
> +complete -F _grub_probe -o filenames @grub_probe@
>  
>  
>  #
> @@ -481,9 +443,7 @@ _grub_script_check () {
>          _filedir
>      fi
>  }
> -__grub_script_check_program="@grub_script_check@"
> -have ${__grub_script_check_program} && \
> - complete -F _grub_script_check -o filenames ${__grub_script_check_program}
> +complete -F _grub_script_check -o filenames @grub_script_check@
>  
>  
>  # Local variables:



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] bash-completion: Remove obsolete usage of 'have' function
  2014-12-06  6:59 ` Andrei Borzenkov
@ 2014-12-07 17:06   ` Mike Gilbert
  2014-12-07 18:23   ` Justin
  1 sibling, 0 replies; 6+ messages in thread
From: Mike Gilbert @ 2014-12-07 17:06 UTC (permalink / raw
  To: Andrei Borzenkov; +Cc: The development of GNU GRUB

On Sat, Dec 6, 2014 at 1:59 AM, Andrei Borzenkov <arvidjaar@gmail.com> wrote:
> В Fri,  5 Dec 2014 22:22:23 -0500
> Mike Gilbert <floppym@gentoo.org> пишет:
>
>> Recent versions of bash-completion do not provide the 'have' function.
>
> It still does as of today GIT.

Right, sorry. I should have said it is marked as deprecated.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] bash-completion: Remove obsolete usage of 'have' function
  2014-12-06  6:59 ` Andrei Borzenkov
  2014-12-07 17:06   ` Mike Gilbert
@ 2014-12-07 18:23   ` Justin
  2014-12-07 18:37     ` Andrei Borzenkov
  1 sibling, 1 reply; 6+ messages in thread
From: Justin @ 2014-12-07 18:23 UTC (permalink / raw
  To: grub-devel

Andrei Borzenkov <arvidjaar <at> gmail.com> writes:

>
> В Fri,  5 Dec 2014 22:22:23 -0500
> Mike Gilbert <floppym <at> gentoo.org> пишет:
>
> > Recent versions of bash-completion do not provide the 'have' function.
>
> It still does as of today GIT.
>


# Backwards compatibility for compat completions that use have().
# @deprecated should no longer be used; generally not needed with dynamically
#             loaded completions, and _have is suitable for runtime use.
have()
{
    unset -v have
    _have  && have=yes
}

All major Linux distributions are using bash-completion version which support
dynamically loaded completions. Therefor we should cleanup shipped
bash-completions.

> > To keep things simple, this patch just removes it completely.
>
> No, that is not what was intended when 'have' was deprecated. You should
> put completion for each command in separate function which is then
> autoloaded on demand.

It was intended that you have one file (or a symlink) with the name of the
command which will be completed. That means dropping all have and pointing
symlinks with all support completions will fix it.

Or how would you update to recent bash-completion?


Justin



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] bash-completion: Remove obsolete usage of 'have' function
  2014-12-07 18:23   ` Justin
@ 2014-12-07 18:37     ` Andrei Borzenkov
  2014-12-07 18:39       ` Justin Lecher (jlec)
  0 siblings, 1 reply; 6+ messages in thread
From: Andrei Borzenkov @ 2014-12-07 18:37 UTC (permalink / raw
  To: Justin; +Cc: grub-devel

В Sun, 7 Dec 2014 18:23:13 +0000 (UTC)
Justin <jlec@gentoo.org> пишет:

> Andrei Borzenkov <arvidjaar <at> gmail.com> writes:
> 
> >
> > В Fri,  5 Dec 2014 22:22:23 -0500
> > Mike Gilbert <floppym <at> gentoo.org> пишет:
> >
> > > Recent versions of bash-completion do not provide the 'have' function.
> >
> > It still does as of today GIT.
> >
> 
> 
> # Backwards compatibility for compat completions that use have().
> # @deprecated should no longer be used; generally not needed with dynamically
> #             loaded completions, and _have is suitable for runtime use.
> have()
> {
>     unset -v have
>     _have  && have=yes
> }
> 
> All major Linux distributions are using bash-completion version which support
> dynamically loaded completions. Therefor we should cleanup shipped
> bash-completions.
> 
> > > To keep things simple, this patch just removes it completely.
> >
> > No, that is not what was intended when 'have' was deprecated. You should
> > put completion for each command in separate function which is then
> > autoloaded on demand.
> 
> It was intended that you have one file (or a symlink) with the name of the
> command which will be completed. That means dropping all have and pointing
> symlinks with all support completions will fix it.
> 

That was what I meant. Sorry, had to say "file" not "function".

> Or how would you update to recent bash-completion?
>

bash-completion will process /etc/bash_completion.d and will source
current grub completion just fine. But if you want to really adapt
it, just removing calls to have() is not enough; you also need to fix
install target and probably split it in separate files for each command.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] bash-completion: Remove obsolete usage of 'have' function
  2014-12-07 18:37     ` Andrei Borzenkov
@ 2014-12-07 18:39       ` Justin Lecher (jlec)
  0 siblings, 0 replies; 6+ messages in thread
From: Justin Lecher (jlec) @ 2014-12-07 18:39 UTC (permalink / raw
  To: Andrei Borzenkov, Justin; +Cc: grub-devel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On 07/12/14 19:37, Andrei Borzenkov wrote:
> bash-completion will process /etc/bash_completion.d and will
> source current grub completion just fine. But if you want to really
> adapt it, just removing calls to have() is not enough; you also
> need to fix install target and probably split it in separate files
> for each command.
> 

So you would accept a patch splitting the monolithic file into
separate completion definition along with the necessary fixes in the
buildsystem? If so, I will send the patch.

Justin
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0

iQJ8BAEBCgBmBQJUhJ74XxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQyQ0JDQjFGMzBDQ0UxMjFGNENDNDgxMDdC
OUQ0RjIzMUJEMTU1OEFCAAoJELnU8jG9FVirYeoP/AiuCQvtpZkPGGbc1pDQMQsM
OndstG1iS8clMYTkeD+GAbi+eBfBMIYpocJsYcXOekfklMtCdOxIrxrJrhXQuhjI
PndHIO8rEDODy2tNynHieNomOpfDgcOZ3cX615k/qa7WWCtKdEsg9xADwIvZPKHD
KSREENfztA+ymm6asfIWMrXZVxrfrPsctcRwHwmr32WetSNdmQwx8kNa+P+xW5Vp
7Z+XlAgG+9mS6eWP7t30fmRBRMKZauJawPbnpUD7BUZ4Zd9ynsHIZ5SX47ewI4AM
heHRg6Ik5xddnvdG2cjGSDwTtVREj7xkvtaL48o27UpgSCOemkOTHXnIVeCN5+G7
pomLWQIqvLic4vR/17o0z2JHjoeDJpSYp5sTeUHj9g7CUnZ/qaGN1DffEgh/DsLy
GhmEaaeecNLuvk2J95a75t1GXv9a8qzgxSdqmcgock7kjoyR4GSjymI680GrtR1x
4ge01M5/J5CUd8UIrm7z6Wonb8CX6DJbf1FU9qygu43MZZbTV19a/Q/TH/RPDsRk
9Ovnsw2tQZaXWHpaR8XDd5XYsQCaYXegZaWJSSs0WBLmygDqbAKBYyj6pXLIhyKR
oUjqz/cHEujWjOepLhnUeibDk+09ROULo22kNVGmmRt7FNBkUvNysasF+nrHc/7N
VyECfb7DBPoI1efMSVtd
=Jl7m
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-12-07 21:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-06  3:22 [PATCH] bash-completion: Remove obsolete usage of 'have' function Mike Gilbert
2014-12-06  6:59 ` Andrei Borzenkov
2014-12-07 17:06   ` Mike Gilbert
2014-12-07 18:23   ` Justin
2014-12-07 18:37     ` Andrei Borzenkov
2014-12-07 18:39       ` Justin Lecher (jlec)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.