File nextcloud-notify-push.spec of Package nextcloud-notify-push

#
# spec file for package nextcloud-notify-push
#
# Copyright (c) 2021 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 rustflags '-Clink-arg=-Wl,-z,relro,-z,now'
%define services nextcloud-notify-push.service

Name:           nextcloud-notify-push
Version:        0.5.0
Release:        0
Summary:        Update notifications for nextcloud clients
License:        AGPL-3.0-only
URL:            https://github.com/nextcloud/notify_push/releases
Source:         https://github.com/nextcloud/notify_push/archive/v%{version}.tar.gz#/notify_push-%{version}.tar.gz
Source1:        vendor.tar.xz
Source2:        cargo_config
Source3:        nextcloud-notify-push.service
Source4:        series
Patch0:         fix_binary_path.patch
BuildRequires:  cargo
BuildRequires:  nextcloud
BuildRequires:  nextcloud-packaging
BuildRequires:  rust >= 1.46.0
BuildRequires:  systemd-rpm-macros
BuildRequires:  zstd
Requires:       nextcloud
%{systemd_ordering}

%description
This app attempts to solve the issue where Nextcloud clients have to periodically check the server if any files have
been changed. In order to keep sync snappy, clients wants to check for updates often, which increases the load on the
server.

With many clients all checking for updates a large portion of the server load can consist of just these update checks.

By providing a way for the server to send update notifications to the clients, the need for the clients to make these
checks can be greatly reduced.

Update notifications are provided on a "best effort" basis, updates might happen without a notification being send and a
notification can be send even if no update has actually happened. Clients are advised to still perform periodic checks
for updates on their own, although these can be run on a much lower frequency.

%package     -n nextcloud-apps-notify_push
Summary:        Nextcloud Apps Part of the new notify daemon
Recommends:     nextcloud-notify-push = %{version}

%description -n nextcloud-apps-notify_push
This app attempts to solve the issue where Nextcloud clients have to periodically check the server if any files have
been changed. In order to keep sync snappy, clients wants to check for updates often, which increases the load on the
server.

With many clients all checking for updates a large portion of the server load can consist of just these update checks.

By providing a way for the server to send update notifications to the clients, the need for the clients to make these
checks can be greatly reduced.

Update notifications are provided on a "best effort" basis, updates might happen without a notification being send and a
notification can be send even if no update has actually happened. Clients are advised to still perform periodic checks
for updates on their own, although these can be run on a much lower frequency.


%prep
%autosetup -p1 -n notify_push-%{version} -a 1
install -D -m 0644 %{SOURCE2} .cargo/config

%build
RUSTFLAGS=%{rustflags} cargo --offline build --release

%install
install -D -m 0755 target/release/notify_push %{buildroot}%{_sbindir}/nextcloud-notify-push
install -D -m 0644 %{SOURCE3} %{buildroot}%{_unitdir}/nextcloud-notify-push.service

%{_prefix}/lib/rpm/nextcloud_apps_deps.rb --check $(rpm -q --qf '%%{version}' nextcloud)
install -D -d -m 0755 %{buildroot}%{nextcloud_basedir}
install -D -d -m 0770 %{buildroot}%{nextcloud_docroot} %{buildroot}%{nextcloud_appsdir}/notify_push

rsync -av appinfo lib %{buildroot}%{nextcloud_appsdir}/notify_push/

%nextcloud_apps_post notify_push
%nextcloud_apps_files notify_push

%pre
%service_add_pre %{services}

%post
%service_add_post %{services}

%preun
%service_del_preun %{services}

%postun
%service_del_postun %{services}

%files
%doc README.md
%license LICENSE
%{_sbindir}/nextcloud-notify-push
%{_unitdir}/nextcloud-notify-push.service

%changelog
openSUSE Build Service is sponsored by