Implement RPM recommends for libdrm-amdgpu
CPack does not support recommends for RPM generation, so I've generated a template RPM SPEC files in order to make modifications to allow for support of recommends. The spec.in file was generated using the cpack option "CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE" and was modified very sparingly to avoid any maintanance burden, e.g. can be easily regenerated. The CPACK_RPM_USER_BINARY_SPECFILE is then used to specify the customized template file, instead of using the cmake's template. From what I understand, the point of these two options is to allow developers to tailor the specfile to their desire, since rpm spec files are much more advanced then the equilivent debian file. Change-Id: I80c69be58a3c57729ed997fd2ce01f5d16b9e9b9 Signed-off-by: Jeremy Newton <Jeremy.Newton@amd.com>
This commit is contained in:
+9
-7
@@ -333,6 +333,10 @@ if(DEFINED ENV{CPACK_RPM_PACKAGE_RELEASE})
|
||||
else()
|
||||
set(CPACK_RPM_PACKAGE_RELEASE "local")
|
||||
endif()
|
||||
## Specify a RPM SPEC template
|
||||
# This template was generated by using "CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE"
|
||||
# but I've modified it to support CPACK_RPM_PACKAGE_RECOMMENDS for EL8+ and SLE
|
||||
set ( CPACK_RPM_USER_BINARY_SPECFILE "${CMAKE_CURRENT_BINARY_DIR}/RPM/${CPACK_RPM_PACKAGE_NAME}.spec.in" )
|
||||
|
||||
# 'dist' breaks manual builds on debian systems due to empty Provides
|
||||
execute_process( COMMAND rpm --eval %{?dist}
|
||||
@@ -356,15 +360,13 @@ set(CPACK_DEBIAN_PACKAGE_REPLACES "hsakmt-roct")
|
||||
|
||||
set(CPACK_RPM_PACKAGE_REQUIRES "libdrm-devel, rocm-core")
|
||||
|
||||
# NOTE: CentOS/RHEL <8 and SUSE <10 have no concept of "Suggests"
|
||||
# so a "suggests" field will just cause rpm installation to fail
|
||||
# If the HSAKMT_REQUIRES_LIBDRM variable is true in the build
|
||||
# environment, we use REQUIRES. Otherwise we use SUGGESTS
|
||||
# For the distros above, this variable should be set to true
|
||||
if(DEFINED HSAKMT_REQUIRES_LIBDRM)
|
||||
# NOTE: CentOS/RHEL <8 and SUSE <10 do not have support for rpm recommends,
|
||||
# so HSAKMT_REQUIRES_LIBDRM should be defined when building EL7 to avoid
|
||||
# producing binaries which do not install on CentOS7 or RHEL7
|
||||
if(HSAKMT_REQUIRES_LIBDRM)
|
||||
string ( APPEND CPACK_RPM_PACKAGE_REQUIRES ", libdrm-amdgpu" )
|
||||
else()
|
||||
set(CPACK_RPM_PACKAGE_SUGGESTS "libdrm-amdgpu" )
|
||||
set(CPACK_RPM_PACKAGE_RECOMMENDS "libdrm-amdgpu" )
|
||||
endif()
|
||||
|
||||
# Set the names now using CPACK utility
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
# Restore old style debuginfo creation for rpm >= 4.14.
|
||||
%undefine _debugsource_packages
|
||||
%undefine _debuginfo_subpackages
|
||||
|
||||
# -*- rpm-spec -*-
|
||||
BuildRoot: %_topdir/@CPACK_PACKAGE_FILE_NAME@@CPACK_RPM_PACKAGE_COMPONENT_PART_PATH@
|
||||
Summary: @CPACK_RPM_PACKAGE_SUMMARY@
|
||||
Name: @CPACK_RPM_PACKAGE_NAME@
|
||||
Version: @CPACK_RPM_PACKAGE_VERSION@
|
||||
Release: @CPACK_RPM_PACKAGE_RELEASE@
|
||||
License: @CPACK_RPM_PACKAGE_LICENSE@
|
||||
Group: @CPACK_RPM_PACKAGE_GROUP@
|
||||
Vendor: @CPACK_RPM_PACKAGE_VENDOR@
|
||||
|
||||
@TMP_RPM_URL@
|
||||
@TMP_RPM_REQUIRES@
|
||||
@TMP_RPM_REQUIRES_PRE@
|
||||
@TMP_RPM_REQUIRES_POST@
|
||||
@TMP_RPM_REQUIRES_PREUN@
|
||||
@TMP_RPM_REQUIRES_POSTUN@
|
||||
@TMP_RPM_PROVIDES@
|
||||
@TMP_RPM_OBSOLETES@
|
||||
@TMP_RPM_CONFLICTS@
|
||||
@TMP_RPM_SUGGESTS@
|
||||
@TMP_RPM_AUTOPROV@
|
||||
@TMP_RPM_AUTOREQ@
|
||||
@TMP_RPM_AUTOREQPROV@
|
||||
@TMP_RPM_BUILDARCH@
|
||||
@TMP_RPM_PREFIXES@
|
||||
@TMP_RPM_EPOCH@
|
||||
|
||||
# Modifications to allow recommends to be used (not implemented in cpack):
|
||||
%if "@CPACK_RPM_PACKAGE_RECOMMENDS@" != ""
|
||||
Recommends: @CPACK_RPM_PACKAGE_RECOMMENDS@
|
||||
%endif
|
||||
# End of modifications
|
||||
|
||||
@TMP_RPM_DEBUGINFO@
|
||||
|
||||
%define _rpmdir %_topdir/RPMS
|
||||
%define _srcrpmdir %_topdir/SRPMS
|
||||
@FILE_NAME_DEFINE@
|
||||
%define _unpackaged_files_terminate_build 0
|
||||
@TMP_RPM_SPEC_INSTALL_POST@
|
||||
@CPACK_RPM_SPEC_MORE_DEFINE@
|
||||
@CPACK_RPM_COMPRESSION_TYPE_TMP@
|
||||
|
||||
%description
|
||||
@CPACK_RPM_PACKAGE_DESCRIPTION@
|
||||
|
||||
# This is a shortcutted spec file generated by CMake RPM generator
|
||||
# we skip _install step because CPack does that for us.
|
||||
# We do only save CPack installed tree in _prepr
|
||||
# and then restore it in build.
|
||||
%prep
|
||||
mv $RPM_BUILD_ROOT %_topdir/tmpBBroot
|
||||
|
||||
%install
|
||||
if [ -e $RPM_BUILD_ROOT ];
|
||||
then
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
fi
|
||||
mv %_topdir/tmpBBroot $RPM_BUILD_ROOT
|
||||
|
||||
@TMP_RPM_DEBUGINFO_INSTALL@
|
||||
|
||||
%clean
|
||||
|
||||
%post
|
||||
@RPM_SYMLINK_POSTINSTALL@
|
||||
@CPACK_RPM_SPEC_POSTINSTALL@
|
||||
|
||||
%posttrans
|
||||
@CPACK_RPM_SPEC_POSTTRANS@
|
||||
|
||||
%postun
|
||||
@CPACK_RPM_SPEC_POSTUNINSTALL@
|
||||
|
||||
%pre
|
||||
@CPACK_RPM_SPEC_PREINSTALL@
|
||||
|
||||
%pretrans
|
||||
@CPACK_RPM_SPEC_PRETRANS@
|
||||
|
||||
%preun
|
||||
@CPACK_RPM_SPEC_PREUNINSTALL@
|
||||
|
||||
%files
|
||||
%defattr(@TMP_DEFAULT_FILE_PERMISSIONS@,@TMP_DEFAULT_USER@,@TMP_DEFAULT_GROUP@,@TMP_DEFAULT_DIR_PERMISSIONS@)
|
||||
@CPACK_RPM_INSTALL_FILES@
|
||||
@CPACK_RPM_ABSOLUTE_INSTALL_FILES@
|
||||
@CPACK_RPM_USER_INSTALL_FILES@
|
||||
|
||||
%changelog
|
||||
@CPACK_RPM_SPEC_CHANGELOG@
|
||||
|
||||
@TMP_OTHER_COMPONENTS@
|
||||
Reference in New Issue
Block a user