# 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} # source_rel is the package release string, without the rebuild counter # 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 # In PTF projects, there is no rebuild counter, so we leave the release # string intact. %define source_rel %release %define obsolete_rebuilds() %nil %if %using_buildservice && ! 0%{?is_ptf} %define source_rel %(echo %release | sed -r 's/\\.[0-9]+($|\\.[^.]*[^.0-9][^.]*$)/\\1/') # If the rebuild counter is > 1, obsolete all previous rebuilds (boo#867595) %define obsolete_rebuilds() %( %{verbose:set -x} \ set -- $(echo %release | sed -rn 's/(.*\\.)([0-9]+)($|\\.[^.]*[^.0-9][^.]*$)/\\1 \\2 \\3/p') \ seq 1 $(($2-1)) | sed "s/.*/Obsoletes: %1 = %version-$1&$3/" \ ) %endif # how the kernel release string (uname -r) should look like %define kernelrelease %patchversion-%source_rel # 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")))} %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 || :) # vim: ft=spec