File ethersync.spec of Package ethersync

#
# spec file for package ethersync
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#

%global home_dir /var/lib/ethersync

Name:           ethersync
Version:        0.8.0
Release:        0
Summary:        Peer-to-peer, editor-agnostic collaborative editing of local text files
License:        AGPL-3.0
URL:            https://ethersync.github.io/ethersync/
Source0:        %{name}-%{version}.tar.zst
Source1:        vendor.tar.zst
Source2:        ethersync.sysusers
BuildRequires:  cargo-packaging
BuildRequires:  zstd
BuildRequires:  neovim
BuildRequires:  sysuser-shadow
BuildRequires:  sysuser-tools
%{?systemd_ordering}
%{?sysusers_requires}

%description
Multiplayer mode for your text editor!

Ethersync enables real-time collaborative editing of local text files. You can
use it for pair programming or note-taking, for example. It's the missing
real-time complement to Git!

%package -n neovim-plugin-ethersync
Summary:        Neovim plugin for ethersync
Requires:       %{name} = %{version}
Requires:       neovim >= 0.7.0
Supplements:    (%{name} and neovim)
BuildArch:      noarch
%description -n neovim-plugin-ethersync
Multiplayer mode for your text editor!

Ethersync enables real-time collaborative editing of local text files. You can
use it for pair programming or note-taking, for example. It's the missing
real-time complement to Git!

This package holds the neovim plugin


%prep
%autosetup -p 1 -a 1


%build
pushd daemon
%cargo_build
popd
%sysusers_generate_pre %{SOURCE2} %{name} %{name}.conf

%install
pushd daemon
%cargo_install
popd

install -D -m 0644 -t %{buildroot}/usr/share/nvim/runtime/lua/ethersync nvim-plugin/lua/*.lua
install -D -m 0644 -t %{buildroot}/usr/share/nvim/runtime/plugin/       nvim-plugin/plugin/*.lua

install -D -m 644 %{SOURCE2}                  %{buildroot}%{_sysusersdir}/%{name}.conf
install -D -d -m 0750 %{buildroot}%{home_dir}

%pre -f %{name}.pre
%if 0
%service_add_pre %{services}

%preun
%service_del_preun %{services}

%post
%service_add_post %{services}

%postun
%if %{with apparmor}
%apparmor_reload %{_sysconfdir}/apparmor.d/%{pkg_name}
%endif
%service_del_postun %{services}
%endif

%files
%license LICENSE.md LICENSES/*
%doc README.md
%doc docs/*
%doc book/
%{_bindir}/ethersync
%{_sysusersdir}/%{name}.conf
%dir %attr(-,ethersync,ethersync) %{home_dir}

%files -n neovim-plugin-ethersync
%license LICENSE.md LICENSES/*
%doc nvim-plugin/README.md
/usr/share/nvim/runtime/lua/ethersync/
/usr/share/nvim/runtime/plugin/ethersync.lua

%changelog
openSUSE Build Service is sponsored by