From 6c353489f3e9515b4ff2d71ee4361d4999e382e74ebc2f3e3401d54d62d9fc4a Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Wed, 24 Apr 2024 10:26:11 +0000 Subject: [PATCH 1/3] - Rearranging and renaming shell-related subpackages (reaction to the discussion gh#akinomyoga/ble.sh$441 and https://github.com/junegunn/fzf?tab=readme-ov-file#setting-up-shell-integration). OBS-URL: https://build.opensuse.org/package/show/utilities/fzf?expand=0&rev=110 --- fzf.changes | 7 +++++++ fzf.spec | 54 +++++++++++++++++++++++++++++------------------------ 2 files changed, 37 insertions(+), 24 deletions(-) diff --git a/fzf.changes b/fzf.changes index be075d0..1f497ed 100644 --- a/fzf.changes +++ b/fzf.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Wed Apr 24 10:21:09 UTC 2024 - Matej Cepl + +- Rearranging and renaming shell-related subpackages (reaction to + the discussion gh#akinomyoga/ble.sh$441 and + https://github.com/junegunn/fzf?tab=readme-ov-file#setting-up-shell-integration). + ------------------------------------------------------------------- Sun Apr 14 17:27:27 UTC 2024 - Matej Cepl diff --git a/fzf.spec b/fzf.spec index e4b529b..cf851bc 100644 --- a/fzf.spec +++ b/fzf.spec @@ -43,26 +43,30 @@ BuildArch: noarch Tmux integration for fzf. Includes a wrapper script, fzf-tmux, that opens your list in a separate tmux pane. -%package bash-completion +%package bash-integration Summary: Bash completion for fzf Group: Productivity/File utilities Requires: bash-completion Requires: fzf Supplements: (fzf and bash-completion) +Provides: fzf-bash-completion = %{version}-%{release} +Obsoletes: fzf-bash-completion < %{version}-%{release} BuildArch: noarch -%description bash-completion +%description bash-integration Bash shell completions for fzf -%package fish-completion +%package fish-integration Summary: Fish completion for fzf Group: Productivity/File utilities Requires: fish Requires: fzf Supplements: (fzf and fish) +Provides: fzf-fish-completion = %{version}-%{release} +Obsoletes: fzf-fish-completion < %{version}-%{release} BuildArch: noarch -%description fish-completion +%description fish-integration fish shell completions for fzf To enable it, ensure you have a file ~/.config/fish/functions/fish_user_key_bindings.fish @@ -73,15 +77,17 @@ end (or append fzf_key_bindings to the fish_user_key_bindings function if the file already exists) -%package zsh-completion +%package zsh-integration Summary: ZSH completion for fzf Group: Productivity/File utilities Requires: fzf Requires: zsh Supplements: (fzf and zsh) +Provides: fzf-zsh-completion = %{version}-%{release} +Obsoletes: fzf-zsh-completion < %{version}-%{release} BuildArch: noarch -%description zsh-completion +%description zsh-integration zsh shell completions for fzf %define vimplugin_dir %{_datadir}/vim/site @@ -119,21 +125,20 @@ install -Dm644 man/man1/fzf.1 %{buildroot}%{_mandir}/man1/fzf.1 install -Dm644 man/man1/fzf-tmux.1 %{buildroot}%{_mandir}/man1/fzf-tmux.1 # shell completions -# csplit splits on end tags inside of the completions to allow for easy -# splitting of the files for installation. -./fzf --bash | csplit - '/.*end\:.*/+1' -f bash -./fzf --zsh | csplit - '/.*end\:.*/+1' -f zsh -./fzf --fish > fish00 +# Since 0.48 fzf can generate shell integration scripts, but the +# upstream still promotes "for finer control" availability of the +# real scripts +mkdir -p %{buildroot}%{_datadir}/fzf +cp -p -r shell/ %{buildroot}%{_datadir}/fzf -install -Dm0644 bash00 \ - %{buildroot}%{_datadir}/bash-completion/completions/fzf-key-bindings -install -Dm0644 bash01 \ - %{buildroot}%{_datadir}/bash-completion/completions/fzf -install -Dm0644 zsh00 \ +mkdir -p %{buildroot}%{_sysconfdir}/profile.d +echo 'if [[ ${BASH_VERSION-} ]]; then eval "$(fzf --bash)"; fi' > \ + %{buildroot}%{_sysconfdir}/profile.d/fzf-bash.sh +install -Dm0644 shell/completion.zsh \ %{buildroot}%{_sysconfdir}/zsh_completion.d/fzf-key-bindings -install -Dm0644 zsh01 \ +install -Dm0644 shell/key-bindings.zsh \ %{buildroot}%{_datadir}/zsh/site-functions/_fzf -install -Dm0644 fish00 \ +install -Dm0644 shell/key-bindings.fish \ %{buildroot}%{_datadir}/fish/vendor_functions.d/fzf_key_bindings.fish # vim plugin @@ -159,25 +164,26 @@ go test -v -x -mod=vendor ${BUILDMOD} -a \ github.com/junegunn/fzf/src/util %files +%license LICENSE %doc README.md %{_bindir}/fzf %{_mandir}/man1/fzf.1%{?ext_man} -%license LICENSE +%dir %{_datadir}/fzf +%{_datadir}/fzf/shell %files tmux %{_bindir}/fzf-tmux %{_mandir}/man1/fzf-tmux.1%{?ext_man} -%files bash-completion -%{_datadir}/bash-completion/completions/fzf -%{_datadir}/bash-completion/completions/fzf-key-bindings +%files bash-integration +%config %{_sysconfdir}/profile.d/fzf-bash.sh -%files fish-completion +%files fish-integration %dir %{_datadir}/fish %dir %{_datadir}/fish/vendor_functions.d %{_datadir}/fish/vendor_functions.d/fzf_key_bindings.fish -%files zsh-completion +%files zsh-integration %{_datadir}/zsh %dir %{_sysconfdir}/zsh_completion.d %config %{_sysconfdir}/zsh_completion.d/fzf-key-bindings From 5c1b1ece730be700c5f61fcd333cbb20cdec49429698561c1d4a5d1e86e85e7b Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Wed, 24 Apr 2024 12:01:19 +0000 Subject: [PATCH 2/3] - Shell subpackages should be Enahncing (not Supplementing) fzf. OBS-URL: https://build.opensuse.org/package/show/utilities/fzf?expand=0&rev=111 --- fzf.changes | 1 + fzf.spec | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/fzf.changes b/fzf.changes index 1f497ed..1abe759 100644 --- a/fzf.changes +++ b/fzf.changes @@ -4,6 +4,7 @@ Wed Apr 24 10:21:09 UTC 2024 - Matej Cepl - Rearranging and renaming shell-related subpackages (reaction to the discussion gh#akinomyoga/ble.sh$441 and https://github.com/junegunn/fzf?tab=readme-ov-file#setting-up-shell-integration). +- Shell subpackages should be Enahncing (not Supplementing) fzf. ------------------------------------------------------------------- Sun Apr 14 17:27:27 UTC 2024 - Matej Cepl diff --git a/fzf.spec b/fzf.spec index cf851bc..a085e30 100644 --- a/fzf.spec +++ b/fzf.spec @@ -48,7 +48,7 @@ Summary: Bash completion for fzf Group: Productivity/File utilities Requires: bash-completion Requires: fzf -Supplements: (fzf and bash-completion) +Enhances: (fzf and bash-completion) Provides: fzf-bash-completion = %{version}-%{release} Obsoletes: fzf-bash-completion < %{version}-%{release} BuildArch: noarch @@ -61,7 +61,7 @@ Summary: Fish completion for fzf Group: Productivity/File utilities Requires: fish Requires: fzf -Supplements: (fzf and fish) +Enhances: (fzf and fish) Provides: fzf-fish-completion = %{version}-%{release} Obsoletes: fzf-fish-completion < %{version}-%{release} BuildArch: noarch @@ -82,7 +82,7 @@ Summary: ZSH completion for fzf Group: Productivity/File utilities Requires: fzf Requires: zsh -Supplements: (fzf and zsh) +Enhances: (fzf and zsh) Provides: fzf-zsh-completion = %{version}-%{release} Obsoletes: fzf-zsh-completion < %{version}-%{release} BuildArch: noarch @@ -96,6 +96,7 @@ zsh shell completions for fzf Summary: Vim plugin for fzf Group: Productivity/File utilities Requires: (vim or neovim) +Enhances: (fzf and zsh) BuildArch: noarch %description -n vim-fzf From 5f9a9adaddb6b4f3a71917f295f78a0f4c3aef765b3c9899b73b7d1673ea79f9 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Wed, 24 Apr 2024 13:59:40 +0000 Subject: [PATCH 3/3] Fix the generation of /etc/profile.d/fzf-bash.sh OBS-URL: https://build.opensuse.org/package/show/utilities/fzf?expand=0&rev=112 --- fzf.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fzf.spec b/fzf.spec index a085e30..0c29805 100644 --- a/fzf.spec +++ b/fzf.spec @@ -133,7 +133,7 @@ mkdir -p %{buildroot}%{_datadir}/fzf cp -p -r shell/ %{buildroot}%{_datadir}/fzf mkdir -p %{buildroot}%{_sysconfdir}/profile.d -echo 'if [[ ${BASH_VERSION-} ]]; then eval "$(fzf --bash)"; fi' > \ +echo 'if [ "${BASH_VERSION-}" ] && [[ $- == *i* ]]; then eval "$(fzf --bash 2>/dev/null)"; fi' > \ %{buildroot}%{_sysconfdir}/profile.d/fzf-bash.sh install -Dm0644 shell/completion.zsh \ %{buildroot}%{_sysconfdir}/zsh_completion.d/fzf-key-bindings