2011-10-05 07:01:45 +02:00
|
|
|
# This file is included by all the kernel-*.spec files
|
|
|
|
|
|
|
|
# Build with bash instead of sh as the shell: this turns on bash
|
|
|
|
# extensions like <(...).
|
|
|
|
%define _buildshell /bin/bash
|
|
|
|
|
|
|
|
%define using_buildservice 0%{?opensuse_bs}
|
2011-02-08 07:05:08 +01:00
|
|
|
|
2018-03-03 08:03:49 +01:00
|
|
|
%if ! 0%{?using_buildservice}
|
|
|
|
%define using_buildservice 0%(echo %disturl | grep -q '^obs://build\.[^.]*suse\.' && echo 1)
|
|
|
|
%endif
|
|
|
|
|
2021-10-08 06:38:15 +02:00
|
|
|
# TW is usrmerged
|
2024-03-13 09:29:45 +01:00
|
|
|
%if 0%{?suse_version} >= 1550
|
2021-10-08 06:38:15 +02:00
|
|
|
%define usrmerged 1
|
2024-03-13 09:29:45 +01:00
|
|
|
%else
|
|
|
|
%define usrmerged 0
|
2021-10-08 06:38:15 +02:00
|
|
|
%endif
|
|
|
|
|
2011-02-08 07:05:08 +01:00
|
|
|
# source_rel is the package release string, without the rebuild counter
|
2013-05-09 08:08:40 +02:00
|
|
|
# generated by the build service. If the release string has a non-digit
|
|
|
|
# suffix, we keep that suffix and strip the rightmost digit component.
|
|
|
|
# This is used in KOTD builds: 2.1.g1234567 -> 2.g1234567
|
2016-02-11 09:59:36 +01:00
|
|
|
# In PTF projects, there is no rebuild counter, so we leave the release
|
|
|
|
# string intact.
|
2019-03-19 09:08:50 +01:00
|
|
|
%define source_rel %release
|
2015-09-14 08:02:55 +02:00
|
|
|
%define obsolete_rebuilds() %nil
|
2021-11-16 09:04:47 +01:00
|
|
|
%define obsolete_rebuilds_subpackage() %nil
|
2016-02-11 09:59:36 +01:00
|
|
|
%if %using_buildservice && ! 0%{?is_ptf}
|
2019-03-19 09:08:50 +01:00
|
|
|
%define source_rel %(echo %release | sed -r 's/\\.[0-9]+($|\\.[^.]*[^.0-9][^.]*$)/\\1/')
|
2015-09-14 08:02:55 +02:00
|
|
|
# If the rebuild counter is > 1, obsolete all previous rebuilds (boo#867595)
|
2021-10-28 10:05:40 +02:00
|
|
|
%define obsolete_rebuilds() %( \
|
2019-03-19 09:08:50 +01:00
|
|
|
set -- $(echo %release | sed -rn 's/(.*\\.)([0-9]+)($|\\.[^.]*[^.0-9][^.]*$)/\\1 \\2 \\3/p') \
|
|
|
|
if test -n "$2" && test "$2" -gt 99; then echo "warning: Rebuild counter too high in %release" >&2; exit 0; fi \
|
2023-05-09 12:39:37 +02:00
|
|
|
for i in $(seq 1 $(($2-1))) ; do echo "Obsoletes: %1 = %version-$1$i$3" ; done \
|
2015-09-14 08:02:55 +02:00
|
|
|
)
|
2023-05-09 12:39:37 +02:00
|
|
|
%define obsolete_rebuilds_subpackage() %( \
|
2021-11-16 09:04:47 +01:00
|
|
|
set -- $(echo %release | sed -rn 's/(.*\\.)([0-9]+)($|\\.[^.]*[^.0-9][^.]*$)/\\1 \\2 \\3/p') \
|
|
|
|
if test -n "$2" && test "$2" -gt 99; then echo "warning: Rebuild counter too high in %release" >&2; exit 0; fi \
|
2023-05-09 12:39:37 +02:00
|
|
|
cnt=$2
|
2021-11-16 09:04:47 +01:00
|
|
|
set -- $(echo %source_rel | sed -rn 's/(.*\\.)([0-9]+)($|\\.[^.]*[^.0-9][^.]*$)/\\1 \\2 \\3/p') \
|
2023-05-09 12:39:37 +02:00
|
|
|
if test -n "$2" && test "$2" -gt 99; then echo "warning: Upload counter too high in %source_rel" >&2; exit 0; fi \
|
|
|
|
for i in $(seq 1 $2) ; do for j in $(seq 1 $cnt) ; do [ $i = $2 ] && [ $j = $cnt ] && break \
|
|
|
|
echo "Obsoletes: %1 = %version-$1$i.$j$3" \
|
|
|
|
done ; done \
|
2021-11-16 09:04:47 +01:00
|
|
|
)
|
2011-10-05 07:01:45 +02:00
|
|
|
%endif
|
|
|
|
|
2011-02-08 07:05:08 +01:00
|
|
|
# how the kernel release string (uname -r) should look like
|
2013-05-09 08:08:40 +02:00
|
|
|
%define kernelrelease %patchversion-%source_rel
|
2011-01-23 20:47:15 +01:00
|
|
|
|
2016-08-02 08:03:59 +02:00
|
|
|
# Compare the kernel version to the given argument, return value semantics
|
|
|
|
# same as strcmp(3). Example: %%if %%{kver_cmp 4.8} > 0 ... %%endif
|
|
|
|
%define kver_cmp() %{lua: print(rpm.vercmp(rpm.expand("%patchversion"), rpm.expand("%1")))}
|
|
|
|
|
2011-10-05 07:01:45 +02:00
|
|
|
%define my_builddir %_builddir/%{name}-%{version}
|
|
|
|
|
|
|
|
# macro to add the source timestamp to package descriptions
|
|
|
|
%define source_timestamp %(sed '1s/^/Source Timestamp: /' %_sourcedir/source-timestamp || :)
|
|
|
|
|
2021-09-13 10:04:04 +02:00
|
|
|
# function used in developent package scriptlets
|
|
|
|
%define relink_function relink() { \
|
|
|
|
if [ -h "$2" ]; then \
|
|
|
|
local old=$(readlink "$2") \
|
|
|
|
[ "$old" = "$1" ] && return 0 \
|
|
|
|
echo "Changing symlink $2 from $old to $1" \
|
|
|
|
elif [ -e "$2" ]; then \
|
|
|
|
echo "Replacing file $2 with symlink to $1" \
|
|
|
|
fi \
|
|
|
|
rm -f "$2" && ln -s "$1" "$2" \
|
|
|
|
}
|
|
|
|
|
2024-03-13 09:29:45 +01:00
|
|
|
%if %{usrmerged}
|
2021-10-08 06:38:15 +02:00
|
|
|
%define kernel_module_directory /usr/lib/modules
|
|
|
|
%else
|
|
|
|
%define kernel_module_directory /lib/modules
|
|
|
|
%endif
|
|
|
|
|
2022-03-23 09:14:44 +01:00
|
|
|
# Very basic macro for conditional execution.
|
|
|
|
%define run_if_exists run_if_exists() { \
|
|
|
|
if [ -x "$1" ] ; then \
|
|
|
|
"$@" \
|
|
|
|
else \
|
|
|
|
echo Cannot execute "$1" >&2 \
|
|
|
|
fi \
|
|
|
|
} \
|
|
|
|
run_if_exists
|