# Generated by rust2rpm 27
%bcond check 1

%global crate sequoia-keystore-server

Name:           rust-sequoia-keystore-server
Version:        0.2.0
Release:        %autorelease
Summary:        Sequoia keystore daemon

License:        LGPL-2.0-or-later
URL:            https://crates.io/crates/sequoia-keystore-server
Source:         %{crates_source}
# * https://gitlab.com/sequoia-pgp/sequoia-keystore/-/merge_requests/109
Source2:        https://gitlab.com/sequoia-pgp/sequoia-keystore/-/raw/server/v0.2.0/LICENSE.txt
# Manually created patch for downstream crate metadata changes
# * switch crypto backend from Nettle to OpenSSL
# * drop features for unsupported crypto backends
Patch:          sequoia-keystore-server-fix-metadata.diff

BuildRequires:  cargo-rpm-macros >= 24

%global _description %{expand:
Sequoia keystore daemon.}

%description %{_description}

%package     -n %{crate}
Summary:        %{summary}
# (MIT OR Apache-2.0) AND Unicode-DFS-2016
# Apache-2.0
# Apache-2.0 OR MIT
# Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT
# BSD-2-Clause OR Apache-2.0 OR MIT
# BSD-3-Clause
# BSL-1.0
# LGPL-2.0-or-later
# MIT
# MIT OR Apache-2.0
# MIT OR Apache-2.0 OR Zlib
# MPL-2.0
# Unlicense OR MIT
# Zlib OR Apache-2.0 OR MIT
License:        %{shrink:
    LGPL-2.0-or-later AND
    Apache-2.0 AND
    BSD-3-Clause AND
    BSL-1.0 AND
    MIT AND
    MPL-2.0 AND
    Unicode-DFS-2016 AND
    (Apache-2.0 OR MIT) AND
    (Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT) AND
    (BSD-2-Clause OR Apache-2.0 OR MIT) AND
    (MIT OR Apache-2.0 OR Zlib) AND
    (Unlicense OR MIT)
}
# LICENSE.dependencies contains a full license breakdown

%description -n %{crate} %{_description}

%files       -n %{crate}
%license LICENSE.txt
%license LICENSE.dependencies
%doc README.md
%{_libexecdir}/sequoia-keystore

%prep
%autosetup -n %{crate}-%{version} -p1
%cargo_prep
cp -pav %{SOURCE2} .

%generate_buildrequires
%cargo_generate_buildrequires

%build
%cargo_build
%{cargo_license_summary}
%{cargo_license} > LICENSE.dependencies

%install
%cargo_install
# move executable from /usr/bin into /usr/libexec
mkdir -p %{buildroot}/%{_libexecdir}
mv %{buildroot}/%{_bindir}/sequoia-keystore %{buildroot}/%{_libexecdir}/

%if %{with check}
%check
%cargo_test
%endif

%changelog
%autochangelog