File cargo-crev.spec of Package cargo-crev

#
# spec file for package cargo-crev
#
# Copyright (c) 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 crate cargo-crev

%global rustflags '-Clink-arg=-Wl,-z,relro,-z,now --cap-lints warn'

Name:           %{crate}
Version:        0.23.2~git2.e768630
Release:        0
Summary:        Distibuted Code REView system for verifying security and quality of Cargo deps
Group:          Development/Tools/Other

# Upstream license specification: MPL-2.0 OR MIT OR Apache-2.0
License:        MPL-2.0 OR MIT OR Apache-2.0
URL:            https://crates.io/crates/cargo-crev
Source:         cargo-crev-%{version}.tar.xz
Source1:        vendor.tar.xz
Source2:        cargo_config

ExclusiveArch:  %{rust_arches}

BuildRequires:  rust-packaging

%global _description %{expand:
Distibuted Code REView system for verifying security and quality of Cargo
dependencies.}

%description %{_description}

%files
%doc README.md
%{_bindir}/cargo-crev

%prep
%setup -qa1
mkdir .cargo
#TODO make vendor work with cargo_prep macro
#TODO add option so cargo_prep does not delete Cargo.lock
cp %{SOURCE2} .cargo/config

%build
#TODO add --offline --locked to cargo_install macro
#TODO with -Z avoid-dev-deps error: the `-Z` flag is only accepted on the nightly channel of Cargo, but this is the `stable` channel
RUSTFLAGS=%{rustflags} cargo build --offline --locked --release

%install
#TODO cargo_install macro might not work with the workspaces thingie, as --path . will fail with:
#  error: found a virtual manifest at `/Cargo.toml` instead of a package manifest
#maybe cd cargo-crev before everything, then the same for crevsum
RUSTFLAGS=%{rustflags} cargo install --no-track --root=%{buildroot}%{_prefix} --path cargo-crev

%check
#TODO would cargo_... macros  pick up RUSTFLAGS?
RUSTFLAGS=%{rustflags} cargo test --release --no-fail-fast
openSUSE Build Service is sponsored by