remove vim-wrappers, vim is a binary again, vi and view stay as wrappers

removed vim -> vi functionality, because it cannot be optional and work
  for all cases at the same time
This commit is contained in:
Zdenek Dohnal 2021-02-09 10:39:28 +01:00
parent c538905e16
commit 6b04c32679
4 changed files with 43 additions and 38 deletions

23
vi_wrapper Normal file
View File

@ -0,0 +1,23 @@
#!/usr/bin/sh
# run vim if:
# - 'vi' command is used and 'vim' binary is available
# - 'vim' command is used
# NOTE: Set up a local alias if you want vim -> vi functionality. We will not
# do it globally, because it messes up with available startup options (see
# ':help starting', 'vi' is not capable of '-d'). The introducing an environment
# variable, which an user must set to get the feature, will do the same trick
# as setting an alias (needs user input, does not work with sudo), so it is left
# on user whether he decides to use an alias:
#
# alias vim=vi
#
# in bashrc file.
if test -f /usr/bin/vim
then
exec /usr/bin/vim "$@"
fi
# run vi otherwise
exec /usr/libexec/vi "$@"

View File

@ -1,9 +1,9 @@
#!/usr/bin/sh
# run vim -R if available
if test -f /usr/libexec/vim
if test -f /usr/bin/vim
then
exec /usr/libexec/vim -R "$@"
exec /usr/bin/vim -R "$@"
fi
# run vi otherwise

View File

@ -21,7 +21,7 @@ Summary: The VIM editor
URL: http://www.vim.org/
Name: vim
Version: %{baseversion}.%{patchlevel}
Release: 2%{?dist}
Release: 3%{?dist}
License: Vim and MIT
Source0: ftp://ftp.vim.org/pub/vim/unix/vim-%{baseversion}-%{patchlevel}.tar.bz2
Source1: virc
@ -36,7 +36,7 @@ Source9: vim-default-editor.sh
Source10: vim-default-editor.csh
Source11: vim-default-editor.fish
Source12: view_wrapper
Source13: vim_wrapper
Source13: vi_wrapper
%if %{withvimspell}
Source100: vim-spell-files.tar.bz2
@ -126,9 +126,10 @@ Summary: A minimal version of the VIM editor
# conflicts in package because of manpage move (bug #1599663)
# remove when a new RHEL is released (current 8)
Conflicts: %{name}-common < %{epoch}:8.1.1-1
Conflicts: vim-wrappers < 2:8.2.2465-3
Obsoletes: vim-wrappers < 2:8.2.2465-3
Provides: vi
Provides: %{_bindir}/vi
Requires: vim-wrappers
%description minimal
VIM (VIsual editor iMproved) is an updated and improved version of the
@ -141,6 +142,8 @@ only available when the vim-common package is installed.
%package enhanced
Summary: A version of the VIM editor which includes recent enhancements
Conflicts: vim-wrappers < 2:8.2.2465-3
Obsoletes: vim-wrappers < 2:8.2.2465-3
# vim bundles libvterm, which is used during build - so we need to provide
# bundled libvterm for catching possible libvterm CVEs
Provides: bundled(libvterm)
@ -148,7 +151,6 @@ Provides: vim
Provides: %{_bindir}/mergetool
Provides: %{_bindir}/vim
Requires: vim-common = %{epoch}:%{version}-%{release} which
Requires: vim-wrappers
# suggest python3, python2, lua, ruby and perl packages because of their
# embedded functionality in Vim/GVim
Suggests: python3 python3-libs
@ -235,17 +237,6 @@ Requires: vim-enhanced
%description default-editor
This subpackage contains files needed to set Vim as the default editor.
%package wrappers
Summary: Ships shell wrappers defining vi/view/vim
BuildArch: noarch
Conflicts: vim-enhanced < 2:8.2.2465-1
Conflicts: vim-minimal < 2:8.2.2465-1
%description wrappers
The subpackage contains shell scripts, which are shipped as vi/view/vim.
The scripts provide the same functionality as aliases, but they work for sudo too.
They are shipped as a separate package because both vim-minimal and vim-enhanced need
them.
%prep
%setup -q -b 0 -n %{vimdir}
@ -429,10 +420,10 @@ make installgtutorbin DESTDIR=%{buildroot} BINDIR=%{_bindir} VIMRCLOC=/etc VIMR
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/{16x16,32x32,48x48,64x64}/apps
mkdir -p %{buildroot}%{_libexecdir}
install -m755 minimal-vim %{buildroot}%{_libexecdir}/vi
install -m755 enhanced-vim %{buildroot}%{_libexecdir}/vim
install -m755 enhanced-vim %{buildroot}%{_bindir}/vim
install -m755 gvim %{buildroot}%{_bindir}/gvim
install -m755 %{SOURCE12} %{buildroot}%{_bindir}/view
install -m755 %{SOURCE13} %{buildroot}%{_bindir}/vim
install -m755 %{SOURCE13} %{buildroot}%{_bindir}/vi
install -p -m644 %{SOURCE3} \
%{buildroot}%{_datadir}/icons/hicolor/16x16/apps/gvim.png
install -p -m644 %{SOURCE4} \
@ -486,12 +477,11 @@ SentUpstream: 2014-05-22
EOF
( cd %{buildroot}
ln -sf %{_bindir}/vim .%{_bindir}/vi
ln -sf %{_libexecdir}/vi .%{_bindir}/rvi
ln -sf %{_libexecdir}/vi .%{_bindir}/rview
ln -sf %{_libexecdir}/vi .%{_bindir}/ex
ln -sf %{_libexecdir}/vim .%{_bindir}/rvim
ln -sf %{_libexecdir}/vim .%{_bindir}/vimdiff
ln -sf %{_bindir}/vim .%{_bindir}/rvim
ln -sf %{_bindir}/vim .%{_bindir}/vimdiff
perl -pi -e "s,%{buildroot},," .%{_mandir}/man1/vim.1 .%{_mandir}/man1/vimtutor.1
rm -f .%{_mandir}/man1/rvim.1
cp -p .%{_mandir}/man1/vim.1 .%{_mandir}/man1/vi.1
@ -755,16 +745,13 @@ touch %{buildroot}/%{_datadir}/%{name}/vimfiles/doc/tags
%lang(zu) %{_datadir}/%{name}/%{vimdir}/spell/zu.*
%endif
%files wrappers
%{_bindir}/vi
%{_bindir}/view
%{_bindir}/vim
%files minimal
%config(noreplace) %{_sysconfdir}/virc
%{_bindir}/ex
%{_bindir}/rvi
%{_bindir}/rview
%{_bindir}/vi
%{_bindir}/view
%{_libexecdir}/vi
%{_mandir}/man1/vi.*
%{_mandir}/man1/ex.*
@ -775,9 +762,9 @@ touch %{buildroot}/%{_datadir}/%{name}/vimfiles/doc/tags
%files enhanced
%{_bindir}/rvim
%{_bindir}/vim
%{_bindir}/vimdiff
%{_bindir}/vimtutor
%{_libexecdir}/vim
%files filesystem
%{_rpmconfigdir}/macros.d/macros.vim
@ -833,6 +820,11 @@ touch %{buildroot}/%{_datadir}/%{name}/vimfiles/doc/tags
%config(noreplace) %{_sysconfdir}/profile.d/vim-default-editor.*
%changelog
* Tue Feb 09 2021 Zdenek Dohnal <zdohnal@redhat.com> - 2:8.2.2465-2
- remove vim-wrappers, vim is a binary again, vi and view stay as wrappers
- removed vim -> vi functionality, because it cannot be optional and work
for all cases at the same time
* Mon Feb 08 2021 Zdenek Dohnal <zdohnal@redhat.com> - 2:8.2.2465-2
- view is not readonly right now, fix it by -R

View File

@ -1,10 +0,0 @@
#!/usr/bin/sh
# run vim if available
if test -f /usr/libexec/vim
then
exec /usr/libexec/vim "$@"
fi
# run vi otherwise
exec /usr/libexec/vi "$@"