Skip to content

Commit c927924

Browse files
ci: update spec files for packit COPR build
Signed-off-by: Sergio Correia <[email protected]>
1 parent e5e343f commit c927924

File tree

2 files changed

+179
-35
lines changed

2 files changed

+179
-35
lines changed

rpm/centos/keylime-agent-rust.spec

Lines changed: 101 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,11 @@ Source0: rust-keylime-v%{version}.tar.gz
4545
# --exclude-crate-path "libloading#tests"
4646
# tar jcf rust-keylime-%%{version}-vendor.tar.xz vendor
4747
Source1: rust-keylime-vendor.tar.xz
48+
## (0-99) General patches
4849
# Drop deprecated features and workaround unavailable components
4950
Patch0: rust-keylime-metadata.patch
51+
## (100-199) Patches for building from system Rust libraries (Fedora)
52+
## (200+) Patches for building from vendored Rust libraries (RHEL)
5053

5154
ExclusiveArch: %{rust_arches}
5255

@@ -65,43 +68,107 @@ BuildRequires: tpm2-tss-devel
6568
BuildRequires: clang
6669
BuildRequires: rust-toolset
6770

68-
# Virtual Provides to support swapping between different agent implementations
69-
Provides: keylime-agent
70-
Conflicts: keylime-agent
71+
# Requires common files from exact same release
72+
Requires: keylime-agent-rust-common = %{version}-%{release}
73+
# Require the IMA emulator
74+
Requires: keylime-agent-rust-ima-emulator%{?_isa} = %{version}-%{release}
75+
76+
# Virtual Provides to support swapping between pull and push model agents
77+
Provides: keylime-agent = %{version}-%{release}
7178

7279
%description
73-
Rust agent for Keylime
80+
The Keylime agent
81+
82+
#===============================================================================
83+
84+
%package common
85+
Summary: Common files for Keylime agent
86+
License: (Apache-2.0 OR MIT) AND BSD-3-Clause AND (MIT OR Apache-2.0) AND Unicode-DFS-2016 AND (Apache-2.0 OR Apache-2.0 WITH LLVM-exception OR MIT) AND (Apache-2.0 OR BSL-1.0) AND (Apache-2.0 OR MIT) AND (Apache-2.0 OR MIT OR Zlib) AND Apache-2.0 WITH LLVM-exception AND ISC AND MIT AND (MIT OR Unlicense)
87+
BuildArch: noarch
88+
89+
# This is necessary to provide a clean upgrade path from the previous
90+
# keylime-agent-rust which shipped the IMA emulator
91+
Obsoletes: keylime-agent-rust-pull < %{version}-%{release}
92+
Obsoletes: keylime-agent-rust < %{version}-%{release}
93+
94+
%description common
95+
Common files for the Keylime agent in both push and pull models
96+
97+
#===============================================================================
7498

7599
%package push
76-
Summary: Rust push-model agent for Keylime
100+
Summary: The Keylime agent for push model deployment
101+
License: (Apache-2.0 OR MIT) AND BSD-3-Clause AND (MIT OR Apache-2.0) AND Unicode-DFS-2016 AND (Apache-2.0 OR Apache-2.0 WITH LLVM-exception OR MIT) AND (Apache-2.0 OR BSL-1.0) AND (Apache-2.0 OR MIT) AND (Apache-2.0 OR MIT OR Zlib) AND Apache-2.0 WITH LLVM-exception AND ISC AND MIT AND (MIT OR Unlicense)
77102
Requires: tpm2-tss
78103
Requires: util-linux-core
79104

105+
# Requires common files from exact same release
106+
Requires: keylime-agent-rust-common = %{version}-%{release}
107+
# Require the IMA emulator
108+
Requires: keylime-agent-rust-ima-emulator%{?_isa} = %{version}-%{release}
109+
80110
# The keylime-base package provides the keylime user creation. It is available
81111
# from Fedora 36
82112
%if 0%{?fedora} >= 36 || 0%{?rhel} >= 9
83113
Requires: keylime-base
84114
%endif
85115

86116
# Virtual Provides to support swapping between pull and push model agents
87-
Provides: keylime-agent
88-
Conflicts: keylime-agent
117+
Provides: keylime-agent = %{version}-%{release}
89118

90119
%description push
91-
Rust push-model agent for Keylime
120+
The Keylime agent for push model deployment
121+
122+
#===============================================================================
123+
124+
%package ima-emulator
125+
Summary: The Keylime IMA emulator
126+
License: (Apache-2.0 OR MIT) AND BSD-3-Clause AND (MIT OR Apache-2.0) AND Unicode-DFS-2016 AND (Apache-2.0 OR Apache-2.0 WITH LLVM-exception OR MIT) AND (Apache-2.0 OR BSL-1.0) AND (Apache-2.0 OR MIT) AND (Apache-2.0 OR MIT OR Zlib) AND Apache-2.0 WITH LLVM-exception AND ISC AND MIT AND (MIT OR Unlicense)
127+
Requires: tpm2-tss
128+
129+
# Requires common files from exact same release
130+
Requires: keylime-agent-rust-common = %{version}-%{release}
131+
132+
# The keylime-base package provides the keylime user creation. It is available
133+
# from Fedora 36
134+
%if 0%{?fedora} >= 36 || 0%{?rhel} >= 9
135+
Requires: keylime-base
136+
%endif
137+
138+
Provides: keylime-ima-emulator = %{version}-%{release}
139+
140+
%description ima-emulator
141+
The Keylime IMA emulator for testing with emulated TPM
142+
143+
#===============================================================================
92144

93145
%prep
94-
%autosetup -n rust-keylime-%{version} -N
95-
%autopatch -p1
146+
%autosetup -n rust-keylime-%{version} -N %{?bundled_rust_deps:-a1}
147+
%autopatch -M 99 -p1
148+
%if 0%{?bundled_rust_deps}
96149
# Source1 is vendored dependencies
97-
%cargo_prep -V 1
150+
%cargo_prep -v vendor
151+
# Add back if any patch added to the range, do not forget the %
152+
# autopatch -m 200 -p1
153+
%else
154+
# Add back if any patch added to the range, do not forget the %
155+
# autopatch -m 100 -M 199 -p1
156+
%cargo_prep
157+
%generate_buildrequires
158+
%cargo_generate_buildrequires
159+
%endif
98160

99161
%build
100162
%if 0%{?rhel} >= 10
101163
%cargo_build -ftesting
102164
%else
103165
%cargo_build --features=testing
104166
%endif
167+
%cargo_license_summary
168+
%{cargo_license} > LICENSE.dependencies
169+
%if 0%{?bundled_rust_deps}
170+
%cargo_vendor_manifest
171+
%endif
105172

106173
%install
107174

@@ -146,33 +213,49 @@ chmod 500 %{_sysconfdir}/keylime
146213
chown -R keylime:keylime %{_sysconfdir}/keylime
147214

148215
%preun
216+
%systemd_preun keylime_push_model_agent.service
149217
%systemd_preun keylime_agent.service
150218
%systemd_preun var-lib-keylime-secure.mount
151219

152220
%postun
221+
%systemd_postun_with_restart keylime_push_model_agent.service
153222
%systemd_postun_with_restart keylime_agent.service
154223
%systemd_postun_with_restart var-lib-keylime-secure.mount
155224

156-
%files
225+
%files common
157226
%license LICENSE
158227
%doc README.md
159228
%attr(500,keylime,keylime) %dir %{_sysconfdir}/keylime
160229
%attr(500,keylime,keylime) %dir %{_sysconfdir}/keylime/agent.conf.d
161230
%config(noreplace) %attr(400,keylime,keylime) %{_sysconfdir}/keylime/agent.conf.d/001-run_as.conf
162231
%config(noreplace) %attr(400,keylime,keylime) %{_sysconfdir}/keylime/agent.conf
163-
%{_unitdir}/keylime_agent.service
164-
%{_unitdir}/var-lib-keylime-secure.mount
165232
%attr(700,keylime,keylime) %dir %{_rundir}/keylime
166233
%attr(700,keylime,keylime) %{_sharedstatedir}/keylime
167234
%attr(700,keylime,keylime) %{_libexecdir}/keylime
235+
236+
%files
237+
%license LICENSE.dependencies
238+
%if 0%{?bundled_rust_deps}
239+
%license cargo-vendor.txt
240+
%endif
241+
%{_unitdir}/keylime_agent.service
242+
%{_unitdir}/var-lib-keylime-secure.mount
168243
%{_bindir}/keylime_agent
169-
%{_bindir}/keylime_ima_emulator
170244

171245
%files push
172-
%license LICENSE
173-
%doc README.md
174-
%{_bindir}/keylime_push_model_agent
246+
%license LICENSE.dependencies
247+
%if 0%{?bundled_rust_deps}
248+
%license cargo-vendor.txt
249+
%endif
175250
%{_unitdir}/keylime_push_model_agent.service
251+
%{_bindir}/keylime_push_model_agent
252+
253+
%files ima-emulator
254+
%license LICENSE.dependencies
255+
%if 0%{?bundled_rust_deps}
256+
%license cargo-vendor.txt
257+
%endif
258+
%{_bindir}/keylime_ima_emulator
176259

177260
%if %{with check}
178261
%check

rpm/fedora/keylime-agent-rust.spec

Lines changed: 78 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -69,30 +69,79 @@ BuildRequires: tpm2-tss-devel
6969
BuildRequires: clang
7070
BuildRequires: rust-packaging >= 21-2
7171

72-
# Virtual Provides to support swapping between different agent implementations
73-
Provides: keylime-agent
74-
Conflicts: keylime-agent
72+
# Requires common files from exact same release
73+
Requires: keylime-agent-rust-common = %{version}-%{release}
74+
# Require the IMA emulator
75+
Requires: keylime-agent-rust-ima-emulator%{?_isa} = %{version}-%{release}
76+
77+
# Virtual Provides to support swapping between pull and push model agents
78+
Provides: keylime-agent = %{version}-%{release}
7579

7680
%description
77-
Rust agent for Keylime
81+
The Keylime agent
82+
83+
#===============================================================================
84+
85+
%package common
86+
Summary: Common files for Keylime agent
87+
License: (Apache-2.0 OR MIT) AND BSD-3-Clause AND (MIT OR Apache-2.0) AND Unicode-DFS-2016 AND (Apache-2.0 OR Apache-2.0 WITH LLVM-exception OR MIT) AND (Apache-2.0 OR BSL-1.0) AND (Apache-2.0 OR MIT) AND (Apache-2.0 OR MIT OR Zlib) AND Apache-2.0 WITH LLVM-exception AND ISC AND MIT AND (MIT OR Unlicense)
88+
BuildArch: noarch
89+
90+
# This is necessary to provide a clean upgrade path from the previous
91+
# keylime-agent-rust which shipped the IMA emulator
92+
Obsoletes: keylime-agent-rust-pull < %{version}-%{release}
93+
Obsoletes: keylime-agent-rust < %{version}-%{release}
94+
95+
%description common
96+
Common files for the Keylime agent in both push and pull models
97+
98+
#===============================================================================
7899

79100
%package push
80-
Summary: Rust push-model agent for Keylime
101+
Summary: The Keylime agent for push model deployment
102+
License: (Apache-2.0 OR MIT) AND BSD-3-Clause AND (MIT OR Apache-2.0) AND Unicode-DFS-2016 AND (Apache-2.0 OR Apache-2.0 WITH LLVM-exception OR MIT) AND (Apache-2.0 OR BSL-1.0) AND (Apache-2.0 OR MIT) AND (Apache-2.0 OR MIT OR Zlib) AND Apache-2.0 WITH LLVM-exception AND ISC AND MIT AND (MIT OR Unlicense)
81103
Requires: tpm2-tss
82104
Requires: util-linux-core
83105

106+
# Requires common files from exact same release
107+
Requires: keylime-agent-rust-common = %{version}-%{release}
108+
# Require the IMA emulator
109+
Requires: keylime-agent-rust-ima-emulator%{?_isa} = %{version}-%{release}
110+
84111
# The keylime-base package provides the keylime user creation. It is available
85112
# from Fedora 36
86113
%if 0%{?fedora} >= 36 || 0%{?rhel} >= 9
87114
Requires: keylime-base
88115
%endif
89116

90117
# Virtual Provides to support swapping between pull and push model agents
91-
Provides: keylime-agent
92-
Conflicts: keylime-agent
118+
Provides: keylime-agent = %{version}-%{release}
93119

94120
%description push
95-
Rust push-model agent for Keylime
121+
The Keylime agent for push model deployment
122+
123+
#===============================================================================
124+
125+
%package ima-emulator
126+
Summary: The Keylime IMA emulator
127+
License: (Apache-2.0 OR MIT) AND BSD-3-Clause AND (MIT OR Apache-2.0) AND Unicode-DFS-2016 AND (Apache-2.0 OR Apache-2.0 WITH LLVM-exception OR MIT) AND (Apache-2.0 OR BSL-1.0) AND (Apache-2.0 OR MIT) AND (Apache-2.0 OR MIT OR Zlib) AND Apache-2.0 WITH LLVM-exception AND ISC AND MIT AND (MIT OR Unlicense)
128+
Requires: tpm2-tss
129+
130+
# Requires common files from exact same release
131+
Requires: keylime-agent-rust-common = %{version}-%{release}
132+
133+
# The keylime-base package provides the keylime user creation. It is available
134+
# from Fedora 36
135+
%if 0%{?fedora} >= 36 || 0%{?rhel} >= 9
136+
Requires: keylime-base
137+
%endif
138+
139+
Provides: keylime-ima-emulator = %{version}-%{release}
140+
141+
%description ima-emulator
142+
The Keylime IMA emulator for testing with emulated TPM
143+
144+
#===============================================================================
96145

97146
%prep
98147
%autosetup -n rust-keylime-%{version} -N %{?bundled_rust_deps:-a1}
@@ -161,37 +210,49 @@ chmod 500 %{_sysconfdir}/keylime
161210
chown -R keylime:keylime %{_sysconfdir}/keylime
162211

163212
%preun
213+
%systemd_preun keylime_push_model_agent.service
164214
%systemd_preun keylime_agent.service
165215
%systemd_preun var-lib-keylime-secure.mount
166216

167217
%postun
218+
%systemd_postun_with_restart keylime_push_model_agent.service
168219
%systemd_postun_with_restart keylime_agent.service
169220
%systemd_postun_with_restart var-lib-keylime-secure.mount
170221

171-
%files
222+
%files common
172223
%license LICENSE
173-
%license LICENSE.dependencies
174-
%license cargo-vendor.txt
175224
%doc README.md
176225
%attr(500,keylime,keylime) %dir %{_sysconfdir}/keylime
177226
%attr(500,keylime,keylime) %dir %{_sysconfdir}/keylime/agent.conf.d
178227
%config(noreplace) %attr(400,keylime,keylime) %{_sysconfdir}/keylime/agent.conf.d/001-run_as.conf
179228
%config(noreplace) %attr(400,keylime,keylime) %{_sysconfdir}/keylime/agent.conf
180-
%{_unitdir}/keylime_agent.service
181-
%{_unitdir}/var-lib-keylime-secure.mount
182229
%attr(700,keylime,keylime) %dir %{_rundir}/keylime
183230
%attr(700,keylime,keylime) %{_sharedstatedir}/keylime
184231
%attr(700,keylime,keylime) %{_libexecdir}/keylime
232+
233+
%files
234+
%license LICENSE.dependencies
235+
%if 0%{?bundled_rust_deps}
236+
%license cargo-vendor.txt
237+
%endif
238+
%{_unitdir}/keylime_agent.service
239+
%{_unitdir}/var-lib-keylime-secure.mount
185240
%{_bindir}/keylime_agent
186-
%{_bindir}/keylime_ima_emulator
187241

188242
%files push
189-
%license LICENSE
190243
%license LICENSE.dependencies
244+
%if 0%{?bundled_rust_deps}
191245
%license cargo-vendor.txt
192-
%doc README.md
193-
%{_bindir}/keylime_push_model_agent
246+
%endif
194247
%{_unitdir}/keylime_push_model_agent.service
248+
%{_bindir}/keylime_push_model_agent
249+
250+
%files ima-emulator
251+
%license LICENSE.dependencies
252+
%if 0%{?bundled_rust_deps}
253+
%license cargo-vendor.txt
254+
%endif
255+
%{_bindir}/keylime_ima_emulator
195256

196257
%if %{with check}
197258
%check

0 commit comments

Comments
 (0)