Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Enable changing the completion paths & drop install_completions #1123

Merged

Conversation

debarshiray
Copy link
Member

@debarshiray debarshiray commented Sep 12, 2022

The bash-completion and fish dependencies were already optional - the shell completions for Bash and fish won't be generated and installed if they are absent; and there's no dependency required for Z shell. So the install_completions build option wasn't reducing the dependency burden.

The build option was a way to disable the generation and installation of the shell completions, regardless of whether the necessary dependencies are present or not. The only use-case for this is when installing to a non-system-wide prefix while hacking on Toolbox as a non-root user, because the locations for the completions advertised by the shells' APIs might not be accessible. Being able to disable the completions prevents the installation from failing.

A different way of ensuring a smooth developer experience for a Toolbx hacker is to offer a way to change the locations where the shell completions are installed, which is necessary and beneficial for other use-cases.

Z shell, unlike Bash's bash-completion.pc and fish's fish.pc, doesn't offer an API to detect the location for the shell completions. This means that Debian and Fedora use different locations [1, 2]. Namely, /usr/share/zsh/vendor-completions and /usr/share/zsh/site-functions.

An option to specify the locations for the shell completions can optimize the build, if there's an alternate API for the location that
doesn't involve using bash-completion.pc and fish.pc as build dependencies. eg., Fedora provides the _tmpfilesdir RPM macro to specify the location for vendor-supplied tmpfiles.d(5) files, which makes it possible to avoid having systemd.pc as a build dependency [3].

Fallout from bafbbe8

[1] Debian zsh commit bf0a44a8744469b5
https://salsa.debian.org/debian/zsh/-/commit/bf0a44a8744469b5
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=620452

[2] https://src.fedoraproject.org/rpms/zsh/blob/f37/f/zsh.spec

[3] Fedora toolbox commit 9bebde5bb60f36e3
https://src.fedoraproject.org/rpms/toolbox/c/9bebde5bb60f36e3

#840

debarshiray added a commit to debarshiray/toolbox that referenced this pull request Sep 12, 2022
There's no well-defined use-case for having a build option for
generating and installing the shell completions.

The bash-completion and fish dependencies are already optional, and
there's no dependency required for Z shell.  The shell completions for
Bash and fish won't be generated and installed if they are absent.  So
the build option isn't reducing the dependency burden.

The build option is a way to disable the generation and installation of
the shell completions, regardless of whether the necessary dependencies
are present or not.  There's no well-defined use-case for that.

Fallout from bafbbe8

containers#1123
containers#840
debarshiray added a commit to debarshiray/toolbox that referenced this pull request Sep 12, 2022
Names like bash_comp_dir and fish_comp_dir get missed when grepping for
'completion'.

Note that the name of the directory is a plural, because it contains
lots of completions for many different programs, just like the name of
the pkgconfig variable.

containers#1123
debarshiray added a commit to debarshiray/toolbox that referenced this pull request Sep 12, 2022
debarshiray added a commit to debarshiray/toolbox that referenced this pull request Sep 12, 2022
debarshiray added a commit to debarshiray/toolbox that referenced this pull request Sep 12, 2022
This is particularly relevant for Z shell, because, unlike Bash's
bash-completion.pc and fish's fish.pc, it doesn't have an API to detect
the location for the shell completions and Debian and Fedora use
different locations [1, 2].  Namely, /usr/share/zsh/vendor-completions
and /usr/share/zsh/site-functions.

An option to specify the locations for the shell completions can
optimize the build if there's an alternate API for the location that
doesn't involve using bash-completion.pc and fish.pc as build
dependencies.  eg., Fedora provides the _tmpfilesdir RPM macro to
specify the location for vendor-supplied tmpfiles.d(5) files, which
makes it possible to avoid having systemd as a build dependency [3].

Finally, when installing to a non-system-wide prefix while hacking on
Toolbox as a non-root user, the locations for the completions in the
shells' APIs might not be accessible.  Being able to override the
locations prevents the installation from failing.

[1] Debian zsh commit bf0a44a8744469b5
    https://salsa.debian.org/debian/zsh/-/commit/bf0a44a8744469b5
    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=620452

[2] https://src.fedoraproject.org/rpms/zsh/blob/f37/f/zsh.spec

[3] Fedora toolbox commit 9bebde5bb60f36e3
    https://src.fedoraproject.org/rpms/toolbox/c/9bebde5bb60f36e3

containers#1123
containers#840
@debarshiray debarshiray force-pushed the wip/rishi/remove-install_completions branch from a3f93ea to 459acab Compare September 12, 2022 08:50
@debarshiray debarshiray changed the title build: Remove the install_completions build option and add options to override the locations for the shell completions build: Remove the install_completions option and fallback locations, and add options to override the locations for the shell completions Sep 12, 2022
@debarshiray debarshiray marked this pull request as draft September 12, 2022 08:59
@debarshiray debarshiray changed the title build: Remove the install_completions option and fallback locations, and add options to override the locations for the shell completions [WIP] build: Remove the install_completions option and fallback locations, and add options to override the locations for the shell completions Sep 12, 2022
@softwarefactory-project-zuul
Copy link

Build succeeded.

✔️ unit-test SUCCESS in 7m 16s
✔️ unit-test-migration-path-for-coreos-toolbox SUCCESS in 7m 33s
✔️ system-test-fedora-rawhide SUCCESS in 17m 38s
✔️ system-test-fedora-36 SUCCESS in 11m 01s
✔️ system-test-fedora-35 SUCCESS in 11m 37s

debarshiray added a commit to debarshiray/toolbox that referenced this pull request Sep 12, 2022
Names like bash_comp_dir and fish_comp_dir get missed when grepping for
'completion'.

Note that the name of the directory is a plural, because it contains
lots of completions for many different programs, just like the name of
the pkgconfig variable.

containers#1123
debarshiray added a commit to debarshiray/toolbox that referenced this pull request Sep 12, 2022
debarshiray added a commit to debarshiray/toolbox that referenced this pull request Sep 12, 2022
debarshiray added a commit to debarshiray/toolbox that referenced this pull request Sep 12, 2022
The bash-completion and fish dependencies are already optional, and
there's no dependency required for Z shell.  The shell completions for
Bash and fish won't be generated and installed if they are absent.  So
the build option isn't reducing the dependency burden.

The build option is a way to disable the generation and installation of
the shell completions, regardless of whether the necessary dependencies
are present or not.  The only use-case for this is when installing to a
non-system-wide prefix while hacking on Toolbox as a non-root user,
because the locations for the completions in the shells' APIs might not
be accessible.  Being able to disable the completions prevents the
installation from failing.

Fallout from bafbbe8

containers#1123
containers#840

build: Add options to override the locations for the shell completions

This is particularly relevant for Z shell, because, unlike Bash's
bash-completion.pc and fish's fish.pc, it doesn't have an API to detect
the location for the shell completions and Debian and Fedora use
different locations [1, 2].  Namely, /usr/share/zsh/vendor-completions
and /usr/share/zsh/site-functions.

An option to specify the locations for the shell completions can
optimize the build if there's an alternate API for the location that
doesn't involve using bash-completion.pc and fish.pc as build
dependencies.  eg., Fedora provides the _tmpfilesdir RPM macro to
specify the location for vendor-supplied tmpfiles.d(5) files, which
makes it possible to avoid having systemd as a build dependency [3].

Finally, when installing to a non-system-wide prefix while hacking on
Toolbox as a non-root user, the locations for the completions in the
shells' APIs might not be accessible.  Being able to override the
locations prevents the installation from failing.

[1] Debian zsh commit bf0a44a8744469b5
    https://salsa.debian.org/debian/zsh/-/commit/bf0a44a8744469b5
    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=620452

[2] https://src.fedoraproject.org/rpms/zsh/blob/f37/f/zsh.spec

[3] Fedora toolbox commit 9bebde5bb60f36e3
    https://src.fedoraproject.org/rpms/toolbox/c/9bebde5bb60f36e3

containers#1123
containers#840
@debarshiray debarshiray force-pushed the wip/rishi/remove-install_completions branch from 459acab to 837bea4 Compare September 12, 2022 09:14
@debarshiray
Copy link
Member Author

The code here is ready, but I still need to clean-up the commit message for the main commit and ensure that each commit builds and passes the tests.

@softwarefactory-project-zuul
Copy link

Build succeeded.

✔️ unit-test SUCCESS in 7m 40s
✔️ unit-test-migration-path-for-coreos-toolbox SUCCESS in 7m 39s
✔️ system-test-fedora-rawhide SUCCESS in 17m 49s
✔️ system-test-fedora-36 SUCCESS in 11m 02s
✔️ system-test-fedora-35 SUCCESS in 11m 23s

debarshiray added a commit to debarshiray/toolbox that referenced this pull request Oct 17, 2022
Names like bash_comp_dir and fish_comp_dir get missed when grepping for
'completion'.

Note that the name of the directory is a plural, because it contains
lots of completions for many different programs, just like the name of
the pkgconfig variable.

containers#1123
debarshiray added a commit to debarshiray/toolbox that referenced this pull request Oct 17, 2022
debarshiray added a commit to debarshiray/toolbox that referenced this pull request Oct 17, 2022
debarshiray added a commit to debarshiray/toolbox that referenced this pull request Oct 17, 2022
Names like bash_comp_dir and fish_comp_dir get missed when grepping for
'completion'.

Note that the name of the directory is a plural, because it contains
lots of completions for many different programs, just like the name of
the pkgconfig variable.

containers#1123
containers#1138
debarshiray added a commit to debarshiray/toolbox that referenced this pull request Oct 17, 2022
debarshiray added a commit to debarshiray/toolbox that referenced this pull request Oct 17, 2022
@debarshiray debarshiray changed the title [WIP] build: Remove the install_completions option and fallback locations, and add options to override the locations for the shell completions build: Enable changing the completion paths & drop install_completions Oct 21, 2022
debarshiray added a commit to debarshiray/toolbox that referenced this pull request Oct 21, 2022
The bash-completion and fish dependencies were already optional - the
shell completions for Bash and fish won't be generated and installed if
they are absent; and there's no dependency required for Z shell.  So the
install_completions build option wasn't reducing the dependency burden.

The build option was a way to disable the generation and installation of
the shell completions, regardless of whether the necessary dependencies
are present or not.  The only use-case for this is when installing to a
non-system-wide prefix while hacking on Toolbox as a non-root user,
because the locations for the completions advertised by the shells' APIs
might not be accessible.  Being able to disable the completions prevents
the installation from failing.

A different way of ensuring a smooth developer experience for a Toolbx
hacker is to offer a way to change the locations where the shell
completions are installed, which is necessary and beneficial for other
use-cases.

Z shell, unlike Bash's bash-completion.pc and fish's fish.pc, doesn't
offer an API to detect the location for the shell completions.  This
means that Debian and Fedora use different locations [1, 2].  Namely,
/usr/share/zsh/vendor-completions and /usr/share/zsh/site-functions.

An option to specify the locations for the shell completions can
optimize the build, if there's an alternate API for the location that
doesn't involve using bash-completion.pc and fish.pc as build
dependencies.  eg., Fedora provides the _tmpfilesdir RPM macro to
specify the location for vendor-supplied tmpfiles.d(5) files, which
makes it possible to avoid having systemd.pc as a build dependency [3].

Fallout from bafbbe8

[1] Debian zsh commit bf0a44a8744469b5
    https://salsa.debian.org/debian/zsh/-/commit/bf0a44a8744469b5
    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=620452

[2] https://src.fedoraproject.org/rpms/zsh/blob/f37/f/zsh.spec

[3] Fedora toolbox commit 9bebde5bb60f36e3
    https://src.fedoraproject.org/rpms/toolbox/c/9bebde5bb60f36e3

containers#1123
containers#840
@debarshiray debarshiray force-pushed the wip/rishi/remove-install_completions branch from 837bea4 to 5b0a54d Compare October 21, 2022 13:28
debarshiray added a commit to debarshiray/toolbox that referenced this pull request Oct 21, 2022
The bash-completion and fish dependencies were already optional - the
shell completions for Bash and fish won't be generated and installed if
they are absent; and there's no dependency required for Z shell.  So the
install_completions build option wasn't reducing the dependency burden.

The build option was a way to disable the generation and installation of
the shell completions, regardless of whether the necessary dependencies
are present or not.  The only use-case for this is when installing to a
non-system-wide prefix while hacking on Toolbox as a non-root user,
because the locations for the completions advertised by the shells' APIs
might not be accessible.  Being able to disable the completions prevents
the installation from failing.

A different way of ensuring a smooth developer experience for a Toolbx
hacker is to offer a way to change the locations where the shell
completions are installed, which is necessary and beneficial for other
use-cases.

Z shell, unlike Bash's bash-completion.pc and fish's fish.pc, doesn't
offer an API to detect the location for the shell completions.  This
means that Debian and Fedora use different locations [1, 2].  Namely,
/usr/share/zsh/vendor-completions and /usr/share/zsh/site-functions.

An option to specify the locations for the shell completions can
optimize the build, if there's an alternate API for the location that
doesn't involve using bash-completion.pc and fish.pc as build
dependencies.  eg., Fedora provides the _tmpfilesdir RPM macro to
specify the location for vendor-supplied tmpfiles.d(5) files, which
makes it possible to avoid having systemd.pc as a build dependency [3].

Fallout from bafbbe8

[1] Debian zsh commit bf0a44a8744469b5
    https://salsa.debian.org/debian/zsh/-/commit/bf0a44a8744469b5
    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=620452

[2] https://src.fedoraproject.org/rpms/zsh/blob/f37/f/zsh.spec

[3] Fedora toolbox commit 9bebde5bb60f36e3
    https://src.fedoraproject.org/rpms/toolbox/c/9bebde5bb60f36e3

containers#1123
containers#840
@debarshiray debarshiray force-pushed the wip/rishi/remove-install_completions branch from 5b0a54d to bcb2954 Compare October 21, 2022 13:33
debarshiray added a commit to debarshiray/toolbox that referenced this pull request Oct 21, 2022
debarshiray added a commit to debarshiray/toolbox that referenced this pull request Oct 21, 2022
The bash-completion and fish dependencies were already optional - the
shell completions for Bash and fish won't be generated and installed if
they are absent; and there's no dependency required for Z shell.  So the
install_completions build option wasn't reducing the dependency burden.

The build option was a way to disable the generation and installation of
the shell completions, regardless of whether the necessary dependencies
are present or not.  The only use-case for this is when installing to a
non-system-wide prefix while hacking on Toolbox as a non-root user,
because the locations for the completions advertised by the shells' APIs
might not be accessible.  Being able to disable the completions prevents
the installation from failing.

A different way of ensuring a smooth developer experience for a Toolbx
hacker is to offer a way to change the locations where the shell
completions are installed, which is necessary and beneficial for other
use-cases.

Z shell, unlike Bash's bash-completion.pc and fish's fish.pc, doesn't
offer an API to detect the location for the shell completions.  This
means that Debian and Fedora use different locations [1, 2].  Namely,
/usr/share/zsh/vendor-completions and /usr/share/zsh/site-functions.

An option to specify the locations for the shell completions can
optimize the build, if there's an alternate API for the location that
doesn't involve using bash-completion.pc and fish.pc as build
dependencies.  eg., Fedora provides the _tmpfilesdir RPM macro to
specify the location for vendor-supplied tmpfiles.d(5) files, which
makes it possible to avoid having systemd.pc as a build dependency [3].

Fallout from bafbbe8

[1] Debian zsh commit bf0a44a8744469b5
    https://salsa.debian.org/debian/zsh/-/commit/bf0a44a8744469b5
    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=620452

[2] https://src.fedoraproject.org/rpms/zsh/blob/f37/f/zsh.spec

[3] Fedora toolbox commit 9bebde5bb60f36e3
    https://src.fedoraproject.org/rpms/toolbox/c/9bebde5bb60f36e3

containers#1123
containers#840
@debarshiray debarshiray force-pushed the wip/rishi/remove-install_completions branch from bcb2954 to f4dd862 Compare October 21, 2022 14:00
@softwarefactory-project-zuul
Copy link

Build succeeded.

✔️ unit-test SUCCESS in 7m 15s
✔️ unit-test-migration-path-for-coreos-toolbox SUCCESS in 7m 15s
✔️ system-test-fedora-rawhide SUCCESS in 25m 34s
✔️ system-test-fedora-36 SUCCESS in 10m 14s
✔️ system-test-fedora-35 SUCCESS in 10m 36s

The bash-completion and fish dependencies were already optional - the
shell completions for Bash and fish won't be generated and installed if
they are absent; and there's no dependency required for Z shell.  So the
install_completions build option wasn't reducing the dependency burden.

The build option was a way to disable the generation and installation of
the shell completions, regardless of whether the necessary dependencies
are present or not.  The only use-case for this is when installing to a
non-system-wide prefix while hacking on Toolbox as a non-root user,
because the locations for the completions advertised by the shells' APIs
might not be accessible.  Being able to disable the completions prevents
the installation from failing.

A different way of ensuring a smooth developer experience for a Toolbx
hacker is to offer a way to change the locations where the shell
completions are installed, which is necessary and beneficial for other
use-cases.

Z shell, unlike Bash's bash-completion.pc and fish's fish.pc, doesn't
offer an API to detect the location for the shell completions.  This
means that Debian and Fedora use different locations [1, 2].  Namely,
/usr/share/zsh/vendor-completions and /usr/share/zsh/site-functions.

An option to specify the locations for the shell completions can
optimize the build, if there's an alternate API for the location that
doesn't involve using bash-completion.pc and fish.pc as build
dependencies.  eg., Fedora provides the _tmpfilesdir RPM macro to
specify the location for vendor-supplied tmpfiles.d(5) files, which
makes it possible to avoid having systemd.pc as a build dependency [3].

Fallout from bafbbe8

[1] Debian zsh commit bf0a44a8744469b5
    https://salsa.debian.org/debian/zsh/-/commit/bf0a44a8744469b5
    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=620452

[2] https://src.fedoraproject.org/rpms/zsh/blob/f37/f/zsh.spec

[3] Fedora toolbox commit 9bebde5bb60f36e3
    https://src.fedoraproject.org/rpms/toolbox/c/9bebde5bb60f36e3

containers#1123
containers#840
@debarshiray debarshiray force-pushed the wip/rishi/remove-install_completions branch from f4dd862 to 5d26b9d Compare October 21, 2022 14:42
@debarshiray debarshiray marked this pull request as ready for review October 21, 2022 14:46
@softwarefactory-project-zuul
Copy link

Build succeeded.

✔️ unit-test SUCCESS in 7m 18s
✔️ unit-test-migration-path-for-coreos-toolbox SUCCESS in 7m 21s
✔️ system-test-fedora-rawhide SUCCESS in 27m 00s
✔️ system-test-fedora-36 SUCCESS in 10m 10s
✔️ system-test-fedora-35 SUCCESS in 10m 36s

@debarshiray debarshiray merged commit 5d26b9d into containers:main Oct 21, 2022
@debarshiray debarshiray deleted the wip/rishi/remove-install_completions branch October 21, 2022 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants