nano.spec: Introduce default-editor package

The package is needed for the smooth upgrade process if you don't have
nano as a default editor.

Currently 'dnf upgrade' to newer Fedoras ends with error because
'nano-default-editor' is in DNF group 'Standard', which DNF wants to
install/upgrade during upgrade process. This ends in conflict between
'nano-default-editor' and any other 'system-default-editor' providers,
such as 'vim-default-editor' and manuall intervention is needed.

To fix the behavior we introduce 'default-editor' subpackage, which will
have a weak dependency on 'nano-default-editor', so fresh installations
will have 'nano' as default, and non-nano users will have an upgrade
process without this error.

Requiring system-default-editor was added based on pkratoch's review.
Now default-editor is removed if nano-default-editor is removed and if
nano-default-editor is excluded from a DNF transaction which installs
default-editor, DNF will satisfy the dependency with another package
which provides system-default-editor.
This commit is contained in:
Zdenek Dohnal 2021-06-23 07:39:45 +02:00
parent f36d0b830e
commit e53ee57baa

View File

@ -8,7 +8,7 @@
Summary: A small text editor
Name: nano
Version: 5.8
Release: 1%{?dist}
Release: 2%{?dist}
License: GPLv3+
URL: https://www.nano-editor.org
Source: https://www.nano-editor.org/dist/latest/%{name}-%{version}.tar.xz
@ -45,6 +45,17 @@ BuildArch: noarch
%description default-editor
This package ensures the EDITOR shell variable
is set in common shells to GNU nano.
%package -n default-editor
Summary: Metapackage for DNF group
Recommends: nano-default-editor
Requires: system-default-editor
BuildArch: noarch
%description -n default-editor
The package acts as a placeholder in DNF group 'Standard', which will
install nano-default-editor on fresh installs and it will not block users
who don't have nano as a default editor during upgrade.
%endif
%prep
@ -105,10 +116,15 @@ install -Dpm 0644 %{SOURCE13} %{buildroot}%{_datadir}/fish/vendor_conf.d/%{basen
%config(noreplace) %{_sysconfdir}/profile.d/nano-default-editor.*
%dir %{_datadir}/fish/vendor_conf.d
%{_datadir}/fish/vendor_conf.d/nano-default-editor.fish
%files -n default-editor
%endif
%changelog
* Wed Jun 16 2021 Zdenek Dohnal <zdohnal@redhat.com> - 5.8-2
- introduce 'default-editor' subpackage to support smooth non-nano upgrades (#1955884)
* Tue Jun 15 2021 Kamil Dudka <kdudka@redhat.com> - 5.8-1
- new upstream release