-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkernel-source.spec
More file actions
341 lines (294 loc) · 10.9 KB
/
Copy pathkernel-source.spec
File metadata and controls
341 lines (294 loc) · 10.9 KB
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
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
#
# spec file for package kernel-source
#
# Copyright (c) 2022 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/
#
%define srcversion 6.0
%define patchversion 6.0.12-Xmd
%define variant %{nil}
%define vanilla_only 0
%include %_sourcedir/kernel-spec-macros
%define src_install_dir usr/src/linux-%kernelrelease%variant
# if undefined use legacy location of before SLE15
%if %{undefined _rpmmacrodir}
%define _rpmmacrodir /etc/rpm
%endif
Name: kernel-source
Version: 6.0.12.Xmd
%if 0%{?is_kotd}
Release: <RELEASE>.g7fa4ee5
%else
Release: 0
%endif
Summary: The Linux Kernel Sources
License: GPL-2.0-only
Group: Development/Sources
URL: https://www.kernel.org/
AutoReqProv: off
%if 0%{?suse_version} > 1500 || 0%{?sle_version} > 150300
BuildRequires: bash-sh
%endif
BuildRequires: coreutils
BuildRequires: fdupes
BuildRequires: sed
Requires(post): coreutils sed
Provides: %name = %version-%source_rel
Provides: %name-srchash-7fa4ee5a244f011d2a9212e66074f4f763803ed6
Provides: linux
Provides: multiversion(kernel)
Source0: https://www.kernel.org/pub/linux/kernel/v6.x/linux-%srcversion.tar.xz
%if "https://www.kernel.org/pub/linux/kernel/v6.x/" != ""
Source1: https://www.kernel.org/pub/linux/kernel/v6.x/linux-%srcversion.tar.sign
Source2: linux.keyring
%endif
Source3: kernel-source.rpmlintrc
Source14: series.conf
Source16: guards
Source17: apply-patches
Source21: config.conf
Source23: supported.conf
Source33: check-for-config-changes
Source35: group-source-files.pl
Source36: README.PATCH-POLICY.SUSE
Source37: README.SUSE
Source38: README.KSYMS
Source39: config-options.changes.txt
Source40: source-timestamp
Source46: split-modules
Source47: modversions
Source48: macros.kernel-source
Source49: kernel-module-subpackage
Source50: kabi.pl
Source51: mkspec
Source52: kernel-source%variant.changes
Source53: kernel-source.spec.in
Source54: kernel-binary.spec.in
Source55: kernel-syms.spec.in
Source56: kernel-docs.spec.in
Source57: kernel-cert-subpackage
Source58: constraints.in
Source60: config.sh
Source61: compute-PATCHVERSION.sh
Source62: old-flavors
Source63: arch-symbols
Source64: package-descriptions
Source65: kernel-spec-macros
Source67: log.sh
Source68: host-memcpy-hack.h
Source69: try-disable-staging-driver
Source70: kernel-obs-build.spec.in
Source71: kernel-obs-qa.spec.in
Source72: compress-vmlinux.sh
Source73: dtb.spec.in.in
Source74: mkspec-dtb
Source75: release-projects
Source76: check-module-license
Source77: klp-symbols
Source78: modules.fips
Source79: splitflist
Source80: mergedep
Source81: moddep
Source82: modflist
Source83: kernel-subpackage-build
Source84: kernel-subpackage-spec
Source85: kernel-default-base.spec.txt
Source100: config.tar.bz2
Source101: config.addon.tar.bz2
Source102: patches.arch.tar.bz2
Source103: patches.drivers.tar.bz2
Source104: patches.fixes.tar.bz2
Source105: patches.rpmify.tar.bz2
Source106: patches.suse.tar.bz2
Source108: patches.addon.tar.bz2
Source109: patches.kernel.org.tar.bz2
Source110: patches.apparmor.tar.bz2
Source111: patches.rt.tar.bz2
Source113: patches.kabi.tar.bz2
Source120: kabi.tar.bz2
Source121: sysctl.tar.bz2
BuildArch: noarch
Prefix: /usr/src
# Source is only complete with devel files.
Requires: kernel-devel%variant = %version-%source_rel
# extra packages needed for building a kernel from scratch
Recommends: bc
Recommends: bison
Recommends: flex
Recommends: libelf-devel
Recommends: openssl-devel
# pahole needed for BTF
%if 0%{?suse_version} > 1500 || 0%{?sle_version} > 150300
Recommends: dwarves >= 1.22
%endif
# dracut no longer carries installkernel
%if 0%{?suse_version} > 1500 || 0%{?sle_version} > 150300
Recommends: kernel-install-tools
%endif
%obsolete_rebuilds %name
%(chmod +x %_sourcedir/{guards,apply-patches,check-for-config-changes,group-source-files.pl,split-modules,modversions,kabi.pl,mkspec,compute-PATCHVERSION.sh,arch-symbols,log.sh,try-disable-staging-driver,compress-vmlinux.sh,mkspec-dtb,check-module-license,klp-symbols,splitflist,mergedep,moddep,modflist,kernel-subpackage-build})
# Force bzip2 instead of lzma compression to
# 1) allow install on older dist versions, and
# 2) decrease build times (bsc#962356 boo#1175882)
%define _binary_payload w9.bzdio
%define symbols %(set -- $([ -e %_sourcedir/extra-symbols ] && cat %_sourcedir/extra-symbols) ; echo $*)
%define variant_symbols %(case %name in (*-rt) echo "RT" ;; esac)
%define do_vanilla "%variant" == ""
%description
Linux kernel sources with many fixes and improvements.
%source_timestamp
%package -n kernel-devel%variant
%obsolete_rebuilds kernel-devel%variant
Summary: Development files needed for building kernel modules
Group: Development/Sources
AutoReqProv: off
Provides: kernel-devel%variant = %version-%source_rel
Provides: multiversion(kernel)
Requires: kernel-macros
Requires(post): coreutils
%description -n kernel-devel%variant
Kernel-level headers and Makefiles required for development of
external kernel modules.
%source_timestamp
# Note: The kernel-macros package intentionally does not provide
# multiversion(kernel) nor is its name decorated with the variant (-rt)
%package -n kernel-macros
Summary: RPM macros for building Kernel Module Packages
Group: Development/Sources
Provides: kernel-subpackage-macros
%description -n kernel-macros
This package provides the rpm macros and templates for Kernel Module Pakcages
%source_timestamp
%package vanilla
%obsolete_rebuilds %name-vanilla
Summary: Vanilla Linux kernel sources with minor build fixes
Group: Development/Sources
AutoReqProv: off
Provides: %name-vanilla = %version-%source_rel
Provides: multiversion(kernel)
Requires: kernel-macros
# dracut no longer carries installkernel
%if 0%{?suse_version} > 1500 || 0%{?sle_version} > 150300
Recommends: kernel-install-tools
%endif
%description vanilla
Vanilla Linux kernel sources with minor build fixes.
%source_timestamp
%prep
echo "Symbol(s): %symbols"
# Unpack all sources and patches
%setup -q -c -T -a 100 -a 101 -a 102 -a 103 -a 104 -a 105 -a 106 -a 108 -a 109 -a 110 -a 111 -a 113 -a 120 -a 121
%build
%install
mkdir -p %{buildroot}/usr/src
pushd %{buildroot}/usr/src
# Unpack the vanilla kernel sources
tar -xf %{S:0}
find . -xtype l -delete -printf "deleted '%f'\n"
if test "%srcversion" != "%kernelrelease%variant"; then
mv linux-%srcversion linux-%kernelrelease%variant
fi
%if 0%{?usrmerged}
# fix MODLIB so kmps install to /usr
sed -ie 's,/lib/modules/,%{kernel_module_directory}/,' linux-%kernelrelease%variant/Makefile
%endif
%if %do_vanilla
%if %vanilla_only
mv \
%else
cp -al \
%endif
linux-%kernelrelease%variant linux-%kernelrelease-vanilla
cd linux-%kernelrelease-vanilla
%_sourcedir/apply-patches --vanilla %_sourcedir/series.conf %my_builddir %symbols
rm -f $(find . -name ".gitignore")
# Hardlink duplicate files automatically (from package fdupes).
%fdupes $PWD
cd ..
%endif
%if ! %vanilla_only
cd linux-%kernelrelease%variant
%_sourcedir/apply-patches %_sourcedir/series.conf %my_builddir %symbols
rm -f $(find . -name ".gitignore")
if [ -f %_sourcedir/localversion ] ; then
cat %_sourcedir/localversion > localversion
fi
# Hardlink duplicate files automatically (from package fdupes).
%fdupes $PWD
cd ..
%endif
popd
%if ! %vanilla_only
# Install the documentation and example Kernel Module Package.
DOC=/usr/share/doc/packages/%name-%kernelrelease
mkdir -p %buildroot/$DOC
cp %_sourcedir/README.SUSE %_sourcedir/config-options.changes.txt %buildroot/$DOC
ln -s $DOC/README.SUSE %buildroot/%src_install_dir/
%if "%variant" == ""
install -m 755 -d %{buildroot}%{_rpmmacrodir}
install -m 644 %_sourcedir/macros.kernel-source %{buildroot}%{_rpmmacrodir}
echo "%%kernel_module_directory %{kernel_module_directory}" >> %{buildroot}%{_rpmmacrodir}/macros.kernel-source
install -m 755 -d %{buildroot}/usr/lib/rpm
install -m 644 %_sourcedir/kernel-{module,cert}-subpackage \
%{buildroot}/usr/lib/rpm/
install -m 755 -d %{buildroot}/usr/lib/rpm/kernel
install -m 755 %_sourcedir/{splitflist,mergedep,moddep,modflist,kernel-subpackage-build} %{buildroot}/usr/lib/rpm/kernel
install -m 644 %_sourcedir/kernel-subpackage-spec %{buildroot}/usr/lib/rpm/kernel
install -m 644 %_sourcedir/kernel-spec-macros %{buildroot}/usr/lib/rpm/kernel
install -m 644 -T %_sourcedir/kernel-default-base.spec.txt %{buildroot}/usr/lib/rpm/kernel/kernel-default-base.spec
%endif
pushd "%buildroot"
perl "%_sourcedir/group-source-files.pl" \
-D "$OLDPWD/devel.files" -N "$OLDPWD/nondevel.files" \
-L "%src_install_dir"
popd
%endif
find %{buildroot}/usr/src/linux* -type f -name '*.[ch]' -perm /0111 -exec chmod -v a-x {} +
# OBS checks don't like /usr/bin/env in script interpreter lines
grep -Elr '^#! */usr/bin/env ' %{buildroot}/usr/src/linux* | while read f; do
sed -re '1 { s_^#! */usr/bin/env +/_#!/_ ; s_^#! */usr/bin/env +([^/])_#!/usr/bin/\1_ }' -i "$f"
done
# kernel-source and kernel-$flavor-devel are built independently, but the
# shipped sources (/usr/src/linux/) need to be older than generated files
# (/usr/src/linux-obj). We rely on the git commit timestamp to not point into
# the future and be thus lower than the timestamps of files built from the
# source (bnc#669669).
ts="$(head -n1 %_sourcedir/source-timestamp)"
find %buildroot/usr/src/linux* ! -type l | xargs touch -d "$ts"
%if ! %vanilla_only
%post
%relink_function
relink linux-%kernelrelease%variant /usr/src/linux%variant
%post -n kernel-devel%variant
%relink_function
relink linux-%kernelrelease%variant /usr/src/linux%variant
%files -f nondevel.files
%defattr(-, root, root)
%files -n kernel-devel%variant -f devel.files
%defattr(-,root,root)
%ghost /usr/src/linux%variant
%doc /usr/share/doc/packages/*
%if "%variant" == ""
%files -n kernel-macros
%defattr(-,root,root)
%{_rpmmacrodir}/macros.kernel-source
/usr/lib/rpm/kernel-*-subpackage
%dir /usr/lib/rpm/kernel
/usr/lib/rpm/kernel/*
%endif
%endif
%if %do_vanilla
%files vanilla
%defattr(-, root, root)
/usr/src/linux-%kernelrelease-vanilla
%endif
%changelog