keylime-agent-rust/keylime-agent-rust.spec
Daiki Ueno aa69e4762d Work around type mismatches on 32-bit platforms
Signed-off-by: Daiki Ueno <dueno@redhat.com>
2022-01-25 07:30:43 +01:00

116 lines
2.8 KiB
RPMSpec

# keylime-agent-rust.spec
# Generated by rust2rpm 20
# missing dev-dependencies: wiremock
%bcond_with check
%global crate keylime_agent
%global crate_version 0.1.0
# As the latest git version uses an unreleased tss-esapi crate, we
# stick to an older version. FIXME: once the new tss-esapi crate is
# available on crates.io, update the revision to the latest
%global commit d5a31912eb9f69ea1c8fed59811089ff7c4ccebf
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global commitdate 20211110
%if 0%{?rhel}
# RHEL: Use bundled deps as it doesn't ship Rust libraries
%global bundled_rust_deps 1
%else
# Fedora: Use only system Rust libraries
%global bundled_rust_deps 0
%endif
Name: keylime-agent-rust
Version: %{crate_version}~%{commitdate}git%{shortcommit}
Release: 1%{?dist}
Summary: Rust agent for Keylime
# Upstream license specification: Apache-2.0
#
# The build dependencies have the following licenses:
#
# 0BSD or MIT or ASL 2.0
# ASL 2.0
# ASL 2.0 or Boost
# ASL 2.0 or MIT
# ASL 2.0 with exceptions
# BSD
# MIT
# MIT or ASL 2.0
# MIT or ASL 2.0 or zlib
# MIT or zlib or ASL 2.0
# Unlicense or MIT
# zlib or ASL 2.0 or MIT
#
License: ASL 2.0 and BSD and MIT
URL: https://github.com/keylime/rust-keylime/
# The source tarball is downloaded using the following commands:
# spectool -g keylime-agent-rust.spec
Source0: %{url}/archive/%{commit}/rust-keylime-%{version}.tar.gz
# The vendor tarball is created using cargo vendor:
# tar xf rust-keylime-%%{version}.tar.gz
# cd rust-keylime-%%{version}
# cargo vendor
# tar jcf rust-keylime-%%{version}-vendor.tar.xz vendor
Source1: rust-keylime-%{version}-vendor.tar.xz
Patch1: keylime-agent-rust-types.patch
ExclusiveArch: %{rust_arches}
%if 0%{?bundled_rust_deps}
BuildRequires: rust-toolset
BuildRequires: openssl-devel
BuildRequires: libarchive-devel
BuildRequires: tpm2-tss-devel
%else
BuildRequires: rust-packaging
%endif
# Virtual Provides to support swapping between Python and Rust implementation
Provides: keylime-agent
Conflicts: keylime-agent
%description
Rust agent for Keylime
%files
%license LICENSE
%doc README.md
%{_bindir}/keylime_agent
%{_bindir}/keylime_ima_emulator
%prep
%autosetup -n rust-keylime-%{commit} -p1
%if 0%{?bundled_rust_deps}
# Source1 is vendored dependencies
%cargo_prep -V 1
%else
%cargo_prep
%endif
%ifarch armv7hl
# drop debuginfo generation for armv7hl OOM problems
sed -i "s/debuginfo=2/debuginfo=0/" .cargo/config
%endif
%if !0%{?bundled_rust_deps}
%generate_buildrequires
%cargo_generate_buildrequires
%endif
%build
%cargo_build
%install
%cargo_install
%if %{with check}
%check
%cargo_test
%endif
%changelog
* Mon Jan 24 2022 Daiki Ueno <dueno@redhat.com> - 0.1.0~20211110gitd5a3191-1
- Initial package