From 8858a2e08ddb2ca285cecfca8f6ae2b7addc6612 Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Mon, 24 Jan 2022 18:27:35 +0100 Subject: [PATCH] Initial import --- .gitignore | 2 + keylime-agent-rust.spec | 114 ++++++++++++++++++++++++++++++++++++++++ sources | 2 + 3 files changed, 118 insertions(+) create mode 100644 .gitignore create mode 100644 keylime-agent-rust.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d731336 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/rust-keylime-0.1.0~20211110gitd5a3191-vendor.tar.xz +/rust-keylime-0.1.0~20211110gitd5a3191.tar.gz diff --git a/keylime-agent-rust.spec b/keylime-agent-rust.spec new file mode 100644 index 0000000..e720b74 --- /dev/null +++ b/keylime-agent-rust.spec @@ -0,0 +1,114 @@ +# 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 + +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 - 0.1.0~20211110gitd5a3191-1 +- Initial package diff --git a/sources b/sources new file mode 100644 index 0000000..4bdfea0 --- /dev/null +++ b/sources @@ -0,0 +1,2 @@ +SHA512 (rust-keylime-0.1.0~20211110gitd5a3191-vendor.tar.xz) = d3f3013c9875707fb109560828ff4fb0553a7170608ef7d7fcb672de2b09ea6c1e6b937dc9a76f7cac6f63c0d339ac30bdf68bcc46d4560e98da2e8c4ef9a551 +SHA512 (rust-keylime-0.1.0~20211110gitd5a3191.tar.gz) = 32759c7ffbc4a6d482c729544384c051b87a481de6edb98381822208c29c8a7bc25e7c8786bce0e984ccf4ceab8b166db33b48e4f94e7ec827308d924acd0548