|
Michal Marek |
411abb |
# This file is included by all the kernel-*.spec files
|
|
Michal Marek |
411abb |
|
|
Michal Marek |
411abb |
# Build with bash instead of sh as the shell: this turns on bash
|
|
Michal Marek |
411abb |
# extensions like <(...).
|
|
Michal Marek |
411abb |
%define _buildshell /bin/bash
|
|
Michal Marek |
411abb |
|
|
Michal Marek |
411abb |
%define using_buildservice 0%{?opensuse_bs}
|
|
Michal Marek |
411abb |
|
|
Libor Pechacek |
a5f1a4 |
%if ! 0%{?using_buildservice}
|
|
Libor Pechacek |
a5f1a4 |
%define using_buildservice 0%(echo %disturl | grep -q '^obs://build\.[^.]*suse\.' && echo 1)
|
|
Libor Pechacek |
a5f1a4 |
%endif
|
|
Libor Pechacek |
a5f1a4 |
|
|
|
22ec56 |
# TW is usrmerged
|
|
|
22ec56 |
%if %{undefined usrmerged} && 0%{?suse_version} >= 1550
|
|
|
22ec56 |
%define usrmerged 1
|
|
|
22ec56 |
%endif
|
|
|
22ec56 |
|
|
Michal Marek |
411abb |
# source_rel is the package release string, without the rebuild counter
|
|
Michal Marek |
ccb20c |
# generated by the build service. If the release string has a non-digit
|
|
Michal Marek |
ccb20c |
# suffix, we keep that suffix and strip the rightmost digit component.
|
|
Michal Marek |
ccb20c |
# This is used in KOTD builds: 2.1.g1234567 -> 2.g1234567
|
|
Michal Marek |
dc2b09 |
# In PTF projects, there is no rebuild counter, so we leave the release
|
|
Michal Marek |
dc2b09 |
# string intact.
|
|
Michal Suchanek |
a5ee24 |
%define source_rel %release
|
|
Michal Marek |
ffb73e |
%define obsolete_rebuilds() %nil
|
|
Michal Suchanek |
f03778 |
%define obsolete_rebuilds_subpackage() %nil
|
|
Michal Marek |
dc2b09 |
%if %using_buildservice && ! 0%{?is_ptf}
|
|
Michal Suchanek |
a5ee24 |
%define source_rel %(echo %release | sed -r 's/\\.[0-9]+($|\\.[^.]*[^.0-9][^.]*$)/\\1/')
|
|
Michal Marek |
ffb73e |
# If the rebuild counter is > 1, obsolete all previous rebuilds (boo#867595)
|
|
Michal Suchanek |
3e55f5 |
%define obsolete_rebuilds() %( \
|
|
Michal Suchanek |
a5ee24 |
set -- $(echo %release | sed -rn 's/(.*\\.)([0-9]+)($|\\.[^.]*[^.0-9][^.]*$)/\\1 \\2 \\3/p') \
|
|
Michal Suchanek |
a5ee24 |
if test -n "$2" && test "$2" -gt 99; then echo "warning: Rebuild counter too high in %release" >&2; exit 0; fi \
|
|
Michal Marek |
083cdb |
seq 1 $(($2-1)) | sed "s/.*/Obsoletes: %1 = %version-$1&$3/" \
|
|
Michal Marek |
ffb73e |
)
|
|
Michal Suchanek |
f03778 |
%define obsolete_rebuilds_subpackage() %( %{verbose:set -x} \
|
|
Michal Suchanek |
f03778 |
set -- $(echo %release | sed -rn 's/(.*\\.)([0-9]+)($|\\.[^.]*[^.0-9][^.]*$)/\\1 \\2 \\3/p') \
|
|
Michal Suchanek |
f03778 |
if test -n "$2" && test "$2" -gt 99; then echo "warning: Rebuild counter too high in %release" >&2; exit 0; fi \
|
|
Michal Suchanek |
f03778 |
seq 1 $(($2-1)) | sed "s/.*/Obsoletes: %1 = %version-$1&$3/" \
|
|
Michal Suchanek |
f03778 |
set -- $(echo %source_rel | sed -rn 's/(.*\\.)([0-9]+)($|\\.[^.]*[^.0-9][^.]*$)/\\1 \\2 \\3/p') \
|
|
Michal Suchanek |
f03778 |
if test -n "$2" && test "$2" -gt 99; then echo "warning: Upload counter too high in %release" >&2; exit 0; fi \
|
|
Michal Suchanek |
f03778 |
seq 1 $(($2-1)) | sed "s/.*/Obsoletes: %1 = %version-$1&$3/" \
|
|
Michal Suchanek |
f03778 |
)
|
|
Michal Marek |
411abb |
%endif
|
|
Michal Marek |
411abb |
|
|
Michal Marek |
411abb |
# how the kernel release string (uname -r) should look like
|
|
Michal Marek |
b88e78 |
%define kernelrelease %patchversion-%source_rel
|
|
Michal Marek |
411abb |
|
|
Michal Marek |
ea700b |
# Compare the kernel version to the given argument, return value semantics
|
|
Michal Marek |
ea700b |
# same as strcmp(3). Example: %%if %%{kver_cmp 4.8} > 0 ... %%endif
|
|
Michal Marek |
ea700b |
%define kver_cmp() %{lua: print(rpm.vercmp(rpm.expand("%patchversion"), rpm.expand("%1")))}
|
|
Michal Marek |
ea700b |
|
|
Michal Marek |
411abb |
%define my_builddir %_builddir/%{name}-%{version}
|
|
Michal Marek |
411abb |
|
|
Michal Marek |
411abb |
# macro to add the source timestamp to package descriptions
|
|
Michal Marek |
411abb |
%define source_timestamp %(sed '1s/^/Source Timestamp: /' %_sourcedir/source-timestamp || :)
|
|
Michal Marek |
411abb |
|
|
Michal Suchanek |
692d38 |
# function used in developent package scriptlets
|
|
Michal Suchanek |
692d38 |
%define relink_function relink() { \
|
|
Michal Suchanek |
692d38 |
if [ -h "$2" ]; then \
|
|
Michal Suchanek |
692d38 |
local old=$(readlink "$2") \
|
|
Michal Suchanek |
692d38 |
[ "$old" = "$1" ] && return 0 \
|
|
Michal Suchanek |
692d38 |
echo "Changing symlink $2 from $old to $1" \
|
|
Michal Suchanek |
692d38 |
elif [ -e "$2" ]; then \
|
|
Michal Suchanek |
692d38 |
echo "Replacing file $2 with symlink to $1" \
|
|
Michal Suchanek |
692d38 |
fi \
|
|
Michal Suchanek |
692d38 |
rm -f "$2" && ln -s "$1" "$2" \
|
|
Michal Suchanek |
692d38 |
}
|
|
Michal Suchanek |
692d38 |
|
|
|
22ec56 |
%if 0%{?usrmerged}
|
|
|
22ec56 |
%define kernel_module_directory /usr/lib/modules
|
|
|
22ec56 |
%else
|
|
|
22ec56 |
%define kernel_module_directory /lib/modules
|
|
|
22ec56 |
%endif
|
|
|
22ec56 |
|
|
Michal Suchanek |
ab8dd2 |
# Very basic macro for conditional execution.
|
|
Michal Suchanek |
ab8dd2 |
%define run_if_exists run_if_exists() { \
|
|
Michal Suchanek |
ab8dd2 |
if [ -x "$1" ] ; then \
|
|
Michal Suchanek |
ab8dd2 |
"$@" \
|
|
Michal Suchanek |
ab8dd2 |
else \
|
|
Michal Suchanek |
ab8dd2 |
echo Cannot execute "$1" >&2 \
|
|
Michal Suchanek |
ab8dd2 |
fi \
|
|
Michal Suchanek |
ab8dd2 |
} \
|
|
Michal Suchanek |
ab8dd2 |
run_if_exists
|
|
Michal Suchanek |
ab8dd2 |
|
|
Michal Marek |
411abb |
# vim: ft=spec
|