-
Notifications
You must be signed in to change notification settings - Fork 2
/
reproducible-faketools.spec
305 lines (273 loc) · 8.81 KB
/
reproducible-faketools.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
#
# spec file for package reproducible-faketools
#
# Copyright (c) 2024 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: reproducible-faketools
Version: set-by-service-from-git-tag
Release: 0
Summary: Fake system tools for reproducible builds
License: MIT
Group: Development/Tools/Other
URL: https://github.com/bmwiedemann/reproducible-faketools
Source0: %{name}-%{version}.tar
Requires: bash
Requires: coreutils
Requires: this-is-only-for-build-envs
BuildArch: noarch
%description
These tools are meant to help with reproducible builds.
This works by masking standard UNIX tools in build environments
with versions that give more predictable output when $SOURCE_DATE_EPOCH
is set but just redirect to the normal version otherwise.
%prep
%setup
%build
echo dummy file because an rpm cannot be empty > README.random
%install
%make_install
%check
make test
%package hostname
Summary: replacement hostname
Requires: hostname
Requires: reproducible-faketools
%description hostname
a script to enhance the reproducibility of the output of hostname
%files hostname
%defattr(-, root, root, 0755)
/usr/local/bin/hostname
/usr/local/bin/uname
%package date
Summary: replacement date
Requires: reproducible-faketools
%description date
a script to enhance the reproducibility of the output of date
%files date
%defattr(-, root, root, 0755)
/usr/local/bin/date
%package find
Summary: replacement find
Requires: reproducible-faketools
%description find
a script to enhance the reproducibility of the output of find
%files find
%defattr(-, root, root, 0755)
/usr/local/bin/find
%package ar
Summary: replacement ar
Requires: reproducible-faketools
%description ar
a script to enhance the reproducibility of the output of ar
%files ar
%defattr(-, root, root, 0755)
/usr/local/bin/ar
/usr/local/bin/strip
%package tar
Summary: replacement tar
Requires: reproducible-faketools
Requires: tar >= 1.28
%description tar
a script to enhance the reproducibility of the output of tar
by adding --sort and --mtime options
%files tar
%defattr(-, root, root, 0755)
/usr/local/bin/gzip
/usr/local/bin/tar
%package ant
Summary: replacement ant
Requires: reproducible-faketools
Requires: strip-nondeterminism
%description ant
a script to enhance the reproducibility of the output of ant
%files ant
%defattr(-, root, root, 0755)
/usr/local/bin/ant
%package strip-nondeterminism
Summary: Run strip-nondeterminism after build
Requires: reproducible-faketools
Requires: strip-nondeterminism
%description strip-nondeterminism
enhance the reproducibility of various file formats
with strip-nondeterminism
%files strip-nondeterminism
%defattr(-, root, root, 0644)
/usr/lib/rpm/brp-suse.d/brp-95-strip-nondeterminism
%package filesys
Summary: sorted filesystem
Requires: disorderfs
Requires: reproducible-faketools
%description filesys
a script to make sure readdir on filesystems is always sorted during build
WARNING: do not use outside OBS or osc build --vm-type=kvm
%files filesys
%defattr(-, root, root, 0755)
/etc/profile.d/disorderfs.sh
%post filesys
chmod 4755 /usr/bin/fusermount || :
mknod /dev/fuse c 10 229 || :
%package pid
Summary: use fixed pid
Requires: reproducible-faketools
%description pid
a script to wrap su to start a build with a fixed process id
to enhance the reproducibility of some packages
%files pid
%defattr(-, root, root, 0755)
/usr/local/bin/su
%package random
Summary: reduce sources of explicit randomness
Requires: reproducible-faketools
%description random
reduce sources of explicit randomness
by replacing /dev/random and urandom
%files random
%doc README.random
%post random
rm -f /dev/{,u}random
mknod /dev/random c 1 5
mknod /dev/urandom c 1 5
%postun random
rm -f /dev/{,u}random
mknod /dev/random c 1 8
mknod /dev/urandom c 1 9
%package zip
Summary: replacement zip
Requires: p7zip
Requires: perl
Requires: reproducible-faketools
%description zip
a script to enhance the reproducibility of the output of zip
by replacing it with a wrapper to 7z
%files zip
%defattr(-, root, root, 0755)
/usr/local/bin/zip
/usr/local/bin/reproducible-zip.pl
%package jar
Summary: replacement jar
Requires: java-devel
Requires: reproducible-faketools
%description jar
a script to enhance the reproducibility of the output of jar
by normalizing mtimes via the --date= option
%files jar
%defattr(-, root, root, 0755)
/usr/local/bin/jar
%package rpmbuild
Summary: wrapper to include various other faketools
Requires: reproducible-faketools
%description rpmbuild
This is a wrapper script that runs scripts from
/usr/local/lib/reproducible-faketools/rpmbuild.d/
%files rpmbuild
%defattr(-, root, root, 0755)
/usr/local/bin/rpmbuild
%dir /usr/local/lib/reproducible-faketools/rpmbuild.d
%package faketime
Summary: fake time via LD_PRELOAD
Requires: libfaketime
Requires: reproducible-faketools-rpmbuild
%description faketime
a script to enhance the reproducibility of the output
by replacing time(2) and fstat(2) library calls to return our notion of time
%files faketime
%defattr(-, root, root, 0755)
/usr/local/lib/reproducible-faketools/rpmbuild.d/60-faketime.sh
%package dettrace
Summary: use dettrace to normalize env
%if 0%{?withdettrace}
Requires: dettrace
%else
Recommends: dettrace
%endif
Requires: reproducible-faketools-rpmbuild
%description dettrace
a script to enhance the reproducibility of the output
by ptraceing in a container
%files dettrace
%defattr(-, root, root, 0755)
/usr/local/lib/reproducible-faketools/rpmbuild.d/50-dettrace.sh
%package strace
Summary: run build with strace
Requires: reproducible-faketools-rpmbuild
Requires: strace
%description strace
a script to facilitate the debugging of reproducibility issues
by running rpmbuild with strace to find how files are created
%files strace
%defattr(-, root, root, 0755)
/usr/local/lib/reproducible-faketools/rpmbuild.d/55-strace.sh
%package j1
Summary: run build with single-thread
Requires: reproducible-faketools-rpmbuild
Requires: util-linux
%description j1
a script to facilitate the debugging of reproducibility issues
by running rpmbuild with taskset 1 to reduce parallelism
%files j1
%defattr(-, root, root, 0755)
/usr/local/lib/reproducible-faketools/rpmbuild.d/60-j1.sh
%package aslr
Summary: run build without aslr
Requires: reproducible-faketools-rpmbuild
%description aslr
Run the build without aslr. Does not require root permissions.
%files aslr
%defattr(-, root, root, 0755)
/usr/local/lib/reproducible-faketools/rpmbuild.d/40-aslr.sh
%package verbose
Summary: run faketools in verbose mode
Requires: reproducible-faketools-rpmbuild
%description verbose
prints various notice messages from faketools - useful for debugging
warning: can confuse some test frameworks
%files verbose
%defattr(-, root, root, 0755)
/usr/local/lib/reproducible-faketools/rpmbuild.d/03-verbose.sh
%package future1y
Summary: Run build with the timestamp set to 1y in the future
Requires: reproducible-faketools-future
%description future1y
Run the build with the timestamp set to 1y in the future
%files future1y
%defattr(-, root, root, 0755)
/usr/local/lib/reproducible-faketools/rpmbuild.d/80-future1y.sh
%package future
Summary: Run build with the timestamp set to 16y in the future
Requires: reproducible-faketools-rpmbuild
%description future
Run the build with the timestamp set to 16y in the future
(overridable default)
%files future
%defattr(-, root, root, 0755)
/usr/local/lib/reproducible-faketools/rpmbuild.d/81-future.sh
%package futurepost
Summary: Run build in the future
Requires: reproducible-faketools
%description futurepost
Uses post script to modify the build system date,
so that it works when rpmbuild runs as non-root (default).
Needs osc build --clean
Warning: Only install in scratch-VMs as it will change the system clock.
%post futurepost
now=$(date +%%s)
date --set @$((now + 34694220))
%files futurepost
%ghost /var/log/futurepost
%files
%defattr(-, root, root, 0755)
%license LICENSE.md
%doc README.md
%dir /usr/local/lib/%{name}
/usr/local/lib/%{name}/lib
%changelog