git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* meson: Installing completions
@ 2025-04-01  6:46 Akshay Hegde
  2025-04-01  9:58 ` Patrick Steinhardt
  0 siblings, 1 reply; 7+ messages in thread
From: Akshay Hegde @ 2025-04-01  6:46 UTC (permalink / raw)
  To: git

Hi there,

I found some extra time today so I thought I'd try moving my git
install over to using the new meson build system. Everything went
surprisingly smoothly, which I really appreciated, so thank you!

However, one thing that confused me was that the completions were never
installed automatically as part of `meson install`, even though
I specified them under the '-Dcontrib' option.

I just wanted to double check if I'm supposed to install them manually,
or if I missed enabling some options (I looked through the top-level
meson_options.txt and meson.build files and I don't think I did.)

I'm calling meson setup like so:

    meson setup meson-git-build --prefix=/opt/personal/git/versions/2.49.0 \
        --libdir=/opt/personal/git/versions/2.49.0/lib --buildtype=release \
        --wrap-mode=nofallback --backend=ninja \
        -Dmacos_use_homebrew_gettext=false -Dcontrib=completion,subtree

And I do see both subtree and completion modules being built in the
'meson compile' logs and indeed, I see that git-subtree was
automatically installed, as expected:

    Installing contrib/subtree/git-subtree to /opt/personal/git/versions/2.49.0/libexec/git-core

...So I would have expected the completion module to be automatically
installed as well, but this didn't happen. Rather, it merely got copied
to the internal build folder:

    [669/669] /opt/personal/meson/bin/meson --internal copy ../contrib/completion/git-completion.tcsh contrib/completion/git-completion.tcsh

Of course, I can manually install these to the appropriate locations,
but just checking to make sure I didn't miss anything.

Cheers,
-- 
	Akshay


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

* Re: meson: Installing completions
  2025-04-01  6:46 meson: Installing completions Akshay Hegde
@ 2025-04-01  9:58 ` Patrick Steinhardt
  2025-04-01 17:43   ` Akshay Hegde
  0 siblings, 1 reply; 7+ messages in thread
From: Patrick Steinhardt @ 2025-04-01  9:58 UTC (permalink / raw)
  To: git; +Cc: Akshay Hegde

Hi,

On Mon, Mar 31, 2025 at 11:46:01PM -0700, Akshay Hegde wrote:
> Hi there,
> 
> I found some extra time today so I thought I'd try moving my git
> install over to using the new meson build system. Everything went
> surprisingly smoothly, which I really appreciated, so thank you!

great, thanks for testing!

> However, one thing that confused me was that the completions were never
> installed automatically as part of `meson install`, even though
> I specified them under the '-Dcontrib' option.
> 
> I just wanted to double check if I'm supposed to install them manually,
> or if I missed enabling some options (I looked through the top-level
> meson_options.txt and meson.build files and I don't think I did.)

For now the status quo is that you have to install them manually, which
indeed isn't optimal. It matches our Makefile, which never installed
those completions, either. But that by itself isn't a good enough
argument from my perspective that it needs to be the same with Meson.

The biggest question though is whether distros are aligned enough for us
to provide standard installation paths. That is, do all distros end up
installing bash completion into "/usr/share/bash-completion"? What are
the desired directories for tcsh and zsh completion?

If there is enough standardization then yes, I totally think we should
start installing completion scripts automatically.

Patrick

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

* Re: meson: Installing completions
  2025-04-01  9:58 ` Patrick Steinhardt
@ 2025-04-01 17:43   ` Akshay Hegde
  2025-04-02  0:58     ` Todd Zullinger
  0 siblings, 1 reply; 7+ messages in thread
From: Akshay Hegde @ 2025-04-01 17:43 UTC (permalink / raw)
  To: git; +Cc: Patrick Steinhardt

On 2025-04-01 11:58 +0200, Patrick Steinhardt wrote:
>> I just wanted to double check if I'm supposed to install them manually,
>> or if I missed enabling some options (I looked through the top-level
>> meson_options.txt and meson.build files and I don't think I did.)
>
>For now the status quo is that you have to install them manually, which
>indeed isn't optimal. It matches our Makefile, which never installed
>those completions, either. But that by itself isn't a good enough
>argument from my perspective that it needs to be the same with Meson.

Yup that seems entirely reasonable to me, and this was my initial
thought. I don't have much of an issue installing them manually.

>
>The biggest question though is whether distros are aligned enough for us
>to provide standard installation paths. That is, do all distros end up
>installing bash completion into "/usr/share/bash-completion"? What are
>the desired directories for tcsh and zsh completion?
>
>If there is enough standardization then yes, I totally think we should
>start installing completion scripts automatically.

Well I can't speak from any sort of authoritativeness here, but for zsh,
they are usually installed underneath the datadir (usually /usr/share),
then under zsh/site-functions. Of course, I don't know if that's true
for all distros.

Could we extend meson_options to allow specification of bash/tcsh/zsh
completion directories? If they are not empty, I think it would be
reasonable to have meson install it automatically.

Either way, I personally don't think it's too big a deal but would be
a good 'quality-of-life' improvement.

Cheers,
-- 
	Akshay


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

* Re: meson: Installing completions
  2025-04-01 17:43   ` Akshay Hegde
@ 2025-04-02  0:58     ` Todd Zullinger
  2025-04-02 11:33       ` Patrick Steinhardt
  0 siblings, 1 reply; 7+ messages in thread
From: Todd Zullinger @ 2025-04-02  0:58 UTC (permalink / raw)
  To: Akshay Hegde; +Cc: git, Patrick Steinhardt

Akshay Hegde wrote:
> On 2025-04-01 11:58 +0200, Patrick Steinhardt wrote:
>>The biggest question though is whether distros are aligned enough for us
>>to provide standard installation paths. That is, do all distros end up
>>installing bash completion into "/usr/share/bash-completion"? What are
>>the desired directories for tcsh and zsh completion?
>>
>>If there is enough standardization then yes, I totally think we should
>>start installing completion scripts automatically.
> 
> Well I can't speak from any sort of authoritativeness here, but for zsh,
> they are usually installed underneath the datadir (usually /usr/share),
> then under zsh/site-functions. Of course, I don't know if that's true
> for all distros.
> 
> Could we extend meson_options to allow specification of bash/tcsh/zsh
> completion directories? If they are not empty, I think it would be
> reasonable to have meson install it automatically.

Having the ability to specify the install path seems like
the way to go, even if the default is used by most systems.
For Fedora, only the bash and tcsh completions are
installed.  The latter is simply placed in:

    /usr/share/git-core/contrib/completion/git-completion.tcsh

and users need to make some adjustments to their startup
scripts to use it, as documented in the file.  This was
added to the Fedora packages in:

    commit dae8588
    Author: Todd Zullinger <tmz@pobox.com>
    Date:   Thu Jan 3 14:59:27 2013 -0500

        For now, this just gets the file from contrib installed.  If there are
        enough tcsh users that want it to be more automated, that can come
        later.  For now, the directions in the file must be followed to enable
        tcsh completion.

In the years I maintained git in Fedora, no one asked for
any changes for tcsh.  Apparently, either no one uses that
or they don't mind the manual work to configure it. :)

IIRC, there are git completions installed by upstream zsh
and installing git-completion.zsh site-wide is not generally
agreed that everyone wants?  I'm not a zsh user, but I think
that's why I never installed it in the Fedora git packaging.
(It does seem like an oversight that they aren't at least
installed similarly to the tcsh completion.)

For reference, here are the locations for bash, fish, and
zsh which Fedora uses.  This might be helpful in determining
reasonable defaults (after comparing to other distributions,
of course):

    bash /usr/share/bash-completion/completions
    fish /usr/share/fish/vendor_completions.d
    zsh  /usr/share/zsh/site-functions

-- 
Todd

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

* Re: meson: Installing completions
  2025-04-02  0:58     ` Todd Zullinger
@ 2025-04-02 11:33       ` Patrick Steinhardt
  2025-04-02 14:05         ` Todd Zullinger
  0 siblings, 1 reply; 7+ messages in thread
From: Patrick Steinhardt @ 2025-04-02 11:33 UTC (permalink / raw)
  To: Todd Zullinger; +Cc: Akshay Hegde, git

On Tue, Apr 01, 2025 at 08:58:38PM -0400, Todd Zullinger wrote:
> Akshay Hegde wrote:
> > On 2025-04-01 11:58 +0200, Patrick Steinhardt wrote:
> >>The biggest question though is whether distros are aligned enough for us
> >>to provide standard installation paths. That is, do all distros end up
> >>installing bash completion into "/usr/share/bash-completion"? What are
> >>the desired directories for tcsh and zsh completion?
> >>
> >>If there is enough standardization then yes, I totally think we should
> >>start installing completion scripts automatically.
> > 
> > Well I can't speak from any sort of authoritativeness here, but for zsh,
> > they are usually installed underneath the datadir (usually /usr/share),
> > then under zsh/site-functions. Of course, I don't know if that's true
> > for all distros.
> > 
> > Could we extend meson_options to allow specification of bash/tcsh/zsh
> > completion directories? If they are not empty, I think it would be
> > reasonable to have meson install it automatically.
> 
> Having the ability to specify the install path seems like
> the way to go, even if the default is used by most systems.
> For Fedora, only the bash and tcsh completions are
> installed.  The latter is simply placed in:
> 
>     /usr/share/git-core/contrib/completion/git-completion.tcsh
> 
> and users need to make some adjustments to their startup
> scripts to use it, as documented in the file.  This was
> added to the Fedora packages in:
> 
>     commit dae8588
>     Author: Todd Zullinger <tmz@pobox.com>
>     Date:   Thu Jan 3 14:59:27 2013 -0500
> 
>         For now, this just gets the file from contrib installed.  If there are
>         enough tcsh users that want it to be more automated, that can come
>         later.  For now, the directions in the file must be followed to enable
>         tcsh completion.
> 
> In the years I maintained git in Fedora, no one asked for
> any changes for tcsh.  Apparently, either no one uses that
> or they don't mind the manual work to configure it. :)

One of the questions is whether we gain a lot by making this an option.
If packagers have to manually adapt the location they could just as well
copy the file by hand as there is no build step involved in the first
place. I also think that for Bash and zsh the locations are somewhat
stable across distros these days, so ideally we could just build on that
and not even provide an option in the first place?

I'm mostly trying to avoid to eventually end up with tons of build
options. Ideally, we should just do the right thing and install the
completion scripts into the correct location in the specified prefix.

At least if we can get away with it. It seems like the default location
would work alright for you on Fedora, and I assume that it would work
alright for most of the other distros. So I'd refrain from introducing
an option now, but if we eventually figure out that this is problematic
on some distro then we can still introduce the option at a later point
in time.

> IIRC, there are git completions installed by upstream zsh
> and installing git-completion.zsh site-wide is not generally
> agreed that everyone wants?  I'm not a zsh user, but I think
> that's why I never installed it in the Fedora git packaging.
> (It does seem like an oversight that they aren't at least
> installed similarly to the tcsh completion.)
> 
> For reference, here are the locations for bash, fish, and
> zsh which Fedora uses.  This might be helpful in determining
> reasonable defaults (after comparing to other distributions,
> of course):
> 
>     bash /usr/share/bash-completion/completions
>     fish /usr/share/fish/vendor_completions.d
>     zsh  /usr/share/zsh/site-functions

We don't have completions for the Fish shell, right? Just making sure
that I don't miss the obvious.

Patrick

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

* Re: meson: Installing completions
  2025-04-02 11:33       ` Patrick Steinhardt
@ 2025-04-02 14:05         ` Todd Zullinger
  2025-04-07  8:01           ` Patrick Steinhardt
  0 siblings, 1 reply; 7+ messages in thread
From: Todd Zullinger @ 2025-04-02 14:05 UTC (permalink / raw)
  To: Patrick Steinhardt; +Cc: Akshay Hegde, git

Patrick Steinhardt wrote:
> On Tue, Apr 01, 2025 at 08:58:38PM -0400, Todd Zullinger wrote:
[...]
> One of the questions is whether we gain a lot by making this an option.
> If packagers have to manually adapt the location they could just as well
> copy the file by hand as there is no build step involved in the first
> place. I also think that for Bash and zsh the locations are somewhat
> stable across distros these days, so ideally we could just build on that
> and not even provide an option in the first place?
> 
> I'm mostly trying to avoid to eventually end up with tons of build
> options. Ideally, we should just do the right thing and install the
> completion scripts into the correct location in the specified prefix.
> 
> At least if we can get away with it. It seems like the default location
> would work alright for you on Fedora, and I assume that it would work
> alright for most of the other distros. So I'd refrain from introducing
> an option now, but if we eventually figure out that this is problematic
> on some distro then we can still introduce the option at a later point
> in time.

Yeah, if the locations are the same across all of the
systems we aim to support are consistent, then I agree
there's not a lot of point making it configurable.

Whether that turns out to be the case or not will be
interesting.  It seems like there are almost always a few
systems that do things differently for one reason or
another.  With luck, this is an exception.

>> For reference, here are the locations for bash, fish, and
>> zsh which Fedora uses.  This might be helpful in determining
>> reasonable defaults (after comparing to other distributions,
>> of course):
>> 
>>     bash /usr/share/bash-completion/completions
>>     fish /usr/share/fish/vendor_completions.d
>>     zsh  /usr/share/zsh/site-functions
> 
> We don't have completions for the Fish shell, right? Just making sure
> that I don't miss the obvious.

Heh, we don't -- as far as I know either. :)

Those three just happen to be the shells which have a
packaging macro for the path in Fedora.

Cheers,

-- 
Todd

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

* Re: meson: Installing completions
  2025-04-02 14:05         ` Todd Zullinger
@ 2025-04-07  8:01           ` Patrick Steinhardt
  0 siblings, 0 replies; 7+ messages in thread
From: Patrick Steinhardt @ 2025-04-07  8:01 UTC (permalink / raw)
  To: Todd Zullinger; +Cc: Akshay Hegde, git

On Wed, Apr 02, 2025 at 10:05:26AM -0400, Todd Zullinger wrote:
> Patrick Steinhardt wrote:
> > On Tue, Apr 01, 2025 at 08:58:38PM -0400, Todd Zullinger wrote:
> [...]
> > One of the questions is whether we gain a lot by making this an option.
> > If packagers have to manually adapt the location they could just as well
> > copy the file by hand as there is no build step involved in the first
> > place. I also think that for Bash and zsh the locations are somewhat
> > stable across distros these days, so ideally we could just build on that
> > and not even provide an option in the first place?
> > 
> > I'm mostly trying to avoid to eventually end up with tons of build
> > options. Ideally, we should just do the right thing and install the
> > completion scripts into the correct location in the specified prefix.
> > 
> > At least if we can get away with it. It seems like the default location
> > would work alright for you on Fedora, and I assume that it would work
> > alright for most of the other distros. So I'd refrain from introducing
> > an option now, but if we eventually figure out that this is problematic
> > on some distro then we can still introduce the option at a later point
> > in time.
> 
> Yeah, if the locations are the same across all of the
> systems we aim to support are consistent, then I agree
> there's not a lot of point making it configurable.
> 
> Whether that turns out to be the case or not will be
> interesting.  It seems like there are almost always a few
> systems that do things differently for one reason or
> another.  With luck, this is an exception.
> 
> >> For reference, here are the locations for bash, fish, and
> >> zsh which Fedora uses.  This might be helpful in determining
> >> reasonable defaults (after comparing to other distributions,
> >> of course):
> >> 
> >>     bash /usr/share/bash-completion/completions
> >>     fish /usr/share/fish/vendor_completions.d
> >>     zsh  /usr/share/zsh/site-functions
> > 
> > We don't have completions for the Fish shell, right? Just making sure
> > that I don't miss the obvious.
> 
> Heh, we don't -- as far as I know either. :)
> 
> Those three just happen to be the shells which have a
> packaging macro for the path in Fedora.
> 
> Cheers,

I've sent a patch via [1] now. Thanks!

Patrick

[1]: <20250407-b4-pks-meson-install-completions-v1-1-8a7eb8b9284b@pks.im>

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

end of thread, other threads:[~2025-04-07  8:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-01  6:46 meson: Installing completions Akshay Hegde
2025-04-01  9:58 ` Patrick Steinhardt
2025-04-01 17:43   ` Akshay Hegde
2025-04-02  0:58     ` Todd Zullinger
2025-04-02 11:33       ` Patrick Steinhardt
2025-04-02 14:05         ` Todd Zullinger
2025-04-07  8:01           ` Patrick Steinhardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).