kernel-source-rt/kernel-subpackage-spec

110 lines
4.7 KiB
Plaintext

%define rpm_kver %(rpm -q --qf '%%{VERSION}' %kernel_package_name)
%define rpm_krel %(rpm -q --qf '%%{RELEASE}' %kernel_package_name)
%include /usr/lib/rpm/kernel/kernel-spec-macros
# Force bzip2 instead of lzma compression to
# 1) allow install on older dist versions, and
# 2) decrease build times (bsc#962356)
# %%define _binary_payload w9.bzdio
# Do not recompute the build-id of vmlinux in find-debuginfo.sh (bsc#964063)
%undefine _unique_build_ids
%define _no_recompute_build_ids 1
# prevent usr/lib/debug/boot/vmlinux-4.12.14-11.10-default-4.12.14-11.10.ppc64le.debug
%undefine _unique_debug_names
%define kernel_requires %(rpm -q --queryformat '[%%{REQUIREFLAGS:deptype},%%{REQUIRENEVRS}\\n]' %kernel_package_name | grep -vE 'rpmlib,|interp,' | grep -E 'manual,' | sed -e 's/.*,//' | tr '\\n' ' ')
%define kernel_requires_pre %(rpm -q --queryformat '[%%{REQUIREFLAGS:deptype},%%{REQUIRENEVRS}\\n]' %kernel_package_name | grep -vE 'rpmlib,|interp,' | grep -E 'pre,' | sed -e 's/.*,//' | tr '\\n' ' ')
%define kernel_requires_preun %(rpm -q --queryformat '[%%{REQUIREFLAGS:deptype},%%{REQUIRENEVRS}\\n]' %kernel_package_name | grep -vE 'rpmlib,|interp,' | grep -E 'preun,' | sed -e 's/.*,//' | tr '\\n' ' ')
%define kernel_requires_post %(rpm -q --queryformat '[%%{REQUIREFLAGS:deptype},%%{REQUIRENEVRS}\\n]' %kernel_package_name | grep -vE 'rpmlib,|interp,' | grep -E 'post,' | sed -e 's/.*,//' | tr '\\n' ' ')
%define kernel_requires_postun %(rpm -q --queryformat '[%%{REQUIREFLAGS:deptype},%%{REQUIRENEVRS}\\n]' %kernel_package_name | grep -vE 'rpmlib,|interp,' | grep -E 'postun,' | sed -e 's/.*,//' | tr '\\n' ' ')
%define kernel_base_provides %(rpm -q --queryformat '[%%{PROVIDENEVRS}\\n]' %kernel_package_name | sed -E 's/^%kernel_package_name(-srchash| =)/%name\\1/g' | grep -vE '^(ksym|kmod|firmware)[(]' | tr '\\n' ' )')
%define kernel_base_obsoletes %(rpm -q --queryformat '[%%{OBSOLETENEVRS}\\n]' %kernel_package_name | sed -E 's/^%kernel_package_name(-srchash| =)/%name\\1/g' | grep -vE '^(ksym|kmod|firmware)[(]' | tr '\\n' ' )')
%define kernel_base_conflicts %(rpm -q --queryformat '[%%{CONFLICTNEVRS}\\n]' %kernel_package_name | grep -vE '^(ksym|kmod|firmware)[(]' | tr '\\n' ' )')
%define kernel_base_recommends %(rpm -q --queryformat '[%%{RECOMMENDNEVRS}\\n]' %kernel_package_name | grep -v '^kernel-firmware' | grep -vE '^(ksym|kmod|firmware)[(]' | tr '\\n' ' )')
%if ! %(expr 1 - 1)
%if "%{kernel_requires}" != ""
Requires: %kernel_requires
%endif
%if "%{kernel_requires_pre}" != ""
Requires(pre): %kernel_requires_pre
%endif
%if "%{kernel_requires_preun}" != ""
Requires(preun):%kernel_requires_preun
%endif
%if "%{kernel_requires_post}" != ""
Requires(post): %kernel_requires_post
%endif
%if "%{kernel_requires_postun}" != ""
Requires(postun):%kernel_requires_postun
%endif
%endif
%if "%{kernel_base_provides}" != ""
Provides: %{kernel_base_provides}
%endif
%if "%{kernel_base_obsoletes}" != ""
Obsoletes: %{kernel_base_obsoletes}
%endif
%if "%{kernel_base_conflicts}" != ""
Conflicts: %{kernel_base_conflicts}
%endif
%if "%{kernel_base_recommends}" != ""
Recommends: %{kernel_base_recommends}
%endif
# This should give Conflicts: %%kernel_package_name = %%source_rel as old
# kernel-default-base did. Together with the %%obsolete_rebuilds translated
# from %%kernel_package_name to %%name we should be set for obsoletes against
# kernel rebuilds.
Conflicts: %(rpm -q --queryformat '[%%{PROVIDENEVRS}\n]' %kernel_package_name | grep '^%kernel_package_name =' | sort -V | head -n 1)
# To protect against obsolete rebuilds of self we need a provide equivalent to
# %%source_rel on this package version, and do obsolete of lower upload numbers
# and lower rebuild numbers of %%name built against same kernel.
# The %%source-rel is calculated from the subpackage version here.
Provides: %name = %version-%source_rel
%obsolete_rebuilds_subpackage %name
%description
%(rpm -q --qf '%%{DESCRIPTION}' %kernel_package_name)
%extradescription
This is a subpackage of %kernel_package_name. Development files are in
%kernel_package_name-devel, sources in kernel-source%variant, and
debug information in %kernel_package_name-debuginfo.
%package rebuild
Summary: Empty package to ensure rebuilding %name in OBS
Group: Other
Requires: %kernel_package_name = %rpm_kver-%rpm_krel
%description rebuild
This is empty package that ensures %name is rebuilt every time
%kernel_package_name is rebuilt in OBS.
There is no reason to install this package.
%files rebuild
%prep
%build
%install
echo "%{?modules}" | tr ', ' '\n\n' > request-modules
%scriptdir/kernel-subpackage-build %kernel_package_name %rpm_kver-%rpm_krel %package_name-%version-%release
%pre -f prein.sh
%post -f postin.sh
%preun -f preun.sh
%postun -f postun.sh
%posttrans -f posttrans.sh
%files -f subpackage.flist
%changelog