File obs_chat_bot.spec of Package obs_chat_bot

#
# spec file for package obs_chat_bot
#
# Copyright (c) 2020 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/
#


Name:           obs_chat_bot
Version:        0.5
Release:        0
Summary:        OBS-Matrix Chat Bot
License:        MIT
URL:            https://github.com/msirringhaus/obs_chat_bot
Source0:        https://github.com/msirringhaus/obs_chat_bot/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1:        vendor.tar.xz
Source2:        %{name}.changes
BuildRequires:  pkgconfig
BuildRequires:  rust >= 1.40
BuildRequires:  rust-packaging
BuildRequires:  pkgconfig(glib-2.0) >= 2.42
BuildRequires:  pkgconfig(openssl)

%description
Matrix bot that sends chat notifications for
Open Build Service events (build finished, failed, SR accepted, declined, ..)

%prep
%setup -qa 1
%define cargo_registry $(pwd)/vendor
%{cargo_prep}
# For ppc64, aarch64 and riscv64, there is a hook running, that touches this file, which is checksummed
%ifarch aarch64 ppc64 ppc64le riscv64
cp $(pwd)/vendor/backtrace-sys/src/libbacktrace/config.sub $(pwd)/vendor/backtrace-sys/src/libbacktrace/config.sub.save
cp $(pwd)/vendor/backtrace-sys/src/libbacktrace/config.guess $(pwd)/vendor/backtrace-sys/src/libbacktrace/config.guess.save
%endif

%build
%ifarch aarch64 ppc64 ppc64le riscv64
mv $(pwd)/vendor/backtrace-sys/src/libbacktrace/config.sub.save $(pwd)/vendor/backtrace-sys/src/libbacktrace/config.sub
mv $(pwd)/vendor/backtrace-sys/src/libbacktrace/config.guess.save $(pwd)/vendor/backtrace-sys/src/libbacktrace/config.guess
%endif

%cargo_build

%check
%cargo_test

%install
%cargo_install

# remove spurious files
rm -f %{buildroot}%{_prefix}/.crates2.json
rm -f %{buildroot}%{_prefix}/.crates.toml

%files
%{_bindir}/%{name}
%license LICENSE
%doc README.md example_config.toml

%changelog
openSUSE Build Service is sponsored by