Add support for componentized USER spec file

CPACK_RPM_USER_BINARY_SPECFILE can now be specified on a per-component
basis using CPACK_RPM_<componentName>_USER_BINARY_SPECFILE.

Inspired-By: Theodore Papadopoulo with its patch proposal.
This commit is contained in:
Eric NOULARD 2013-04-01 16:06:22 +02:00
parent eb462356cf
commit 2ef908f911
1 changed files with 15 additions and 6 deletions

View File

@ -163,6 +163,8 @@
# May be set by the user in order to specify a USER binary spec file # May be set by the user in order to specify a USER binary spec file
# to be used by CPackRPM instead of generating the file. # to be used by CPackRPM instead of generating the file.
# The specified file will be processed by configure_file( @ONLY). # The specified file will be processed by configure_file( @ONLY).
# One can provide a component specific file by setting
# CPACK_RPM_<componentName>_USER_BINARY_SPECFILE.
##end ##end
##variable ##variable
# CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE - Spec file template. # CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE - Spec file template.
@ -832,11 +834,18 @@ if(CPACK_RPM_PACKAGE_DEBUG)
message("CPackRPM:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = ${CPACK_TEMPORARY_PACKAGE_FILE_NAME}") message("CPackRPM:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = ${CPACK_TEMPORARY_PACKAGE_FILE_NAME}")
endif() endif()
# USER generated spec file handling. #
# We should generate a spec file template: # USER generated/provided spec file handling.
#
# We can have a component specific spec file.
if(CPACK_RPM_PACKAGE_COMPONENT AND CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_USER_BINARY_SPECFILE)
set(CPACK_RPM_USER_BINARY_SPECFILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_USER_BINARY_SPECFILE})
endif()
# We should generate a USER spec file template:
# - either because the user asked for it : CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE # - either because the user asked for it : CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE
# - or the user did not provide one : NOT CPACK_RPM_USER_BINARY_SPECFILE # - or the user did not provide one : NOT CPACK_RPM_USER_BINARY_SPECFILE
#
if(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE OR NOT CPACK_RPM_USER_BINARY_SPECFILE) if(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE OR NOT CPACK_RPM_USER_BINARY_SPECFILE)
file(WRITE ${CPACK_RPM_BINARY_SPECFILE}.in file(WRITE ${CPACK_RPM_BINARY_SPECFILE}.in
"# -*- rpm-spec -*- "# -*- rpm-spec -*-
@ -902,9 +911,9 @@ mv \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot\" $RPM_BUILD_ROOT
%files %files
%defattr(-,root,root,-) %defattr(-,root,root,-)
${CPACK_RPM_INSTALL_FILES} \@CPACK_RPM_INSTALL_FILES\@
${CPACK_RPM_ABSOLUTE_INSTALL_FILES} \@CPACK_RPM_ABSOLUTE_INSTALL_FILES\@
${CPACK_RPM_USER_INSTALL_FILES} \@CPACK_RPM_USER_INSTALL_FILES\@
%changelog %changelog
\@CPACK_RPM_SPEC_CHANGELOG\@ \@CPACK_RPM_SPEC_CHANGELOG\@