clean up some stuff in CPack RPM script
-remove trailing whitespace -fix description of CPACK_RPM_PACKAGE_SUMMARY -fix description of CPACK_RPM_PACKAGE_VENDOR -fix description of CPACK_RPM_PACKAGE_PROVIDES -do not put changelog of that file to generated RPM but read it from CPACK_RPM_CHANGELOG_FILE -add CPACK_RPM_PACKAGE_URL -add CPACK_RPM_PACKAGE_OBSOLETES -add CPACK_RPM_PACKAGE_SUGGESTS -add a loop so adding more user supplied header fields is easy Signed-off-by: Eric NOULARD <eric.noulard@gmail.com>
This commit is contained in:
parent
efee95cd71
commit
dbe7525c6e
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# CPACK_RPM_PACKAGE_SUMMARY
|
||||
# Mandatory : YES
|
||||
# Default : CPACK_PACKAGE_DESCRIPTION
|
||||
# Default : CPACK_PACKAGE_DESCRIPTION_SUMMARY
|
||||
# The RPM package summary
|
||||
# CPACK_RPM_PACKAGE_NAME
|
||||
# Mandatory : YES
|
||||
|
@ -45,7 +45,11 @@
|
|||
# CPACK_RPM_PACKAGE_VENDOR
|
||||
# Mandatory : YES
|
||||
# Default : CPACK_PACKAGE_VENDOR if set or "unknown"
|
||||
# The RPM package group.
|
||||
# The RPM package vendor.
|
||||
# CPACK_RPM_PACKAGE_URL
|
||||
# Mandatory : NO
|
||||
# Default : -
|
||||
# The projects URL.
|
||||
# CPACK_RPM_PACKAGE_DESCRIPTION
|
||||
# Mandatory : YES
|
||||
# Default : CPACK_PACKAGE_DESCRIPTION_FILE if set or "no package description available"
|
||||
|
@ -64,10 +68,19 @@
|
|||
# Note that you must enclose the complete requires string between quotes,
|
||||
# for example:
|
||||
# set(CPACK_RPM_PACKAGE_REQUIRES "python >= 2.5.0, cmake >= 2.8")
|
||||
# CPACK_RPM_PACKAGES_PROVIDES
|
||||
# CPACK_RPM_PACKAGE_SUGGESTS
|
||||
# Mandatory : NO
|
||||
# Default : -
|
||||
# May be used to set weak RPM dependencies (suggests).
|
||||
# Note that you must enclose the complete requires string between quotes.
|
||||
# CPACK_RPM_PACKAGE_PROVIDES
|
||||
# Mandatory : NO
|
||||
# Default : -
|
||||
# May be used to set RPM dependencies (provides).
|
||||
# CPACK_RPM_PACKAGE_OBSOLETES
|
||||
# Mandatory : NO
|
||||
# Default : -
|
||||
# May be used to set RPM packages that are obsoleted by this one.
|
||||
# CPACK_RPM_SPEC_INSTALL_POST
|
||||
# Mandatory : NO
|
||||
# Default : -
|
||||
|
@ -116,6 +129,12 @@
|
|||
# put after the %post or %postun section
|
||||
# One may verify which scriptlet has been included with
|
||||
# rpm -qp --scripts package.rpm
|
||||
# CPACK_RPM_CHANGELOG_FILE
|
||||
# Mandatory : NO
|
||||
# Default : -
|
||||
# May be used to embbed a changelog in the spec file.
|
||||
# The refered file will be read and directly put after the %changelog
|
||||
# section.
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2007-2009 Kitware, Inc.
|
||||
|
@ -141,7 +160,7 @@ IF(NOT UNIX)
|
|||
ENDIF(NOT UNIX)
|
||||
|
||||
# rpmbuild is the basic command for building RPM package
|
||||
# it may be a simple (symbolic) link to rpmb command.
|
||||
# it may be a simple (symbolic) link to rpm command.
|
||||
FIND_PROGRAM(RPMBUILD_EXECUTABLE rpmbuild)
|
||||
|
||||
# Check version of the rpmbuild tool this would be easier to
|
||||
|
@ -294,25 +313,22 @@ IF (CPACK_RPM_COMPRESSION_TYPE)
|
|||
ELSE(CPACK_RPM_COMPRESSION_TYPE)
|
||||
SET(CPACK_RPM_COMPRESSION_TYPE_TMP "")
|
||||
ENDIF(CPACK_RPM_COMPRESSION_TYPE)
|
||||
# CPACK_RPM_PACKAGE_REQUIRES
|
||||
# Placeholder used to specify binary RPM dependencies (if any)
|
||||
# see http://www.rpm.org/max-rpm/s1-rpm-depend-manual-dependencies.html
|
||||
IF(CPACK_RPM_PACKAGE_REQUIRES)
|
||||
IF(CPACK_RPM_PACKAGE_DEBUG)
|
||||
MESSAGE("CPackRPM:Debug: User defined Requires:\n ${CPACK_RPM_PACKAGE_REQUIRES}")
|
||||
ENDIF(CPACK_RPM_PACKAGE_DEBUG)
|
||||
SET(TMP_RPM_REQUIRES "Requires: ${CPACK_RPM_PACKAGE_REQUIRES}")
|
||||
ENDIF(CPACK_RPM_PACKAGE_REQUIRES)
|
||||
|
||||
# CPACK_RPM_PACKAGE_PROVIDES
|
||||
# Placeholder used to specify binary RPM dependencies (if any)
|
||||
# see http://www.rpm.org/max-rpm/s1-rpm-depend-manual-dependencies.html
|
||||
IF(CPACK_RPM_PACKAGE_PROVIDES)
|
||||
# check if additional fields for RPM spec header are given
|
||||
FOREACH(_RPM_SPEC_HEADER URL REQUIRES SUGGESTS PROVIDES OBSOLETES)
|
||||
IF(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER})
|
||||
STRING(LENGTH ${_RPM_SPEC_HEADER} _PACKAGE_HEADER_STRLENGTH)
|
||||
MATH(EXPR _PACKAGE_HEADER_STRLENGTH "${_PACKAGE_HEADER_STRLENGTH} - 1")
|
||||
STRING(SUBSTRING ${_RPM_SPEC_HEADER} 1 ${_PACKAGE_HEADER_STRLENGTH} _PACKAGE_HEADER_TAIL)
|
||||
STRING(TOLOWER "${_PACKAGE_HEADER_TAIL}" _PACKAGE_HEADER_TAIL)
|
||||
STRING(SUBSTRING ${_RPM_SPEC_HEADER} 0 1 _PACKAGE_HEADER_NAME)
|
||||
SET(_PACKAGE_HEADER_NAME "${_PACKAGE_HEADER_NAME}${_PACKAGE_HEADER_TAIL}")
|
||||
IF(CPACK_RPM_PACKAGE_DEBUG)
|
||||
MESSAGE("CPackRPM:Debug: User defined Provides:\n ${CPACK_RPM_PACKAGE_PROVIDES}")
|
||||
MESSAGE("CPackRPM:Debug: User defined ${_PACKAGE_HEADER_NAME}:\n ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}}")
|
||||
ENDIF(CPACK_RPM_PACKAGE_DEBUG)
|
||||
SET(TMP_RPM_PROVIDES "Provides: ${CPACK_RPM_PACKAGE_PROVIDES}")
|
||||
ENDIF(CPACK_RPM_PACKAGE_PROVIDES)
|
||||
SET(TMP_RPM_${_RPM_SPEC_HEADER} "${_PACKAGE_HEADER_NAME}: ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}}")
|
||||
ENDIF(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER})
|
||||
ENDFOREACH(_RPM_SPEC_HEADER)
|
||||
|
||||
# CPACK_RPM_SPEC_INSTALL_POST
|
||||
# May be used to define a RPM post intallation script
|
||||
|
@ -348,7 +364,7 @@ endif(CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE)
|
|||
|
||||
# CPACK_RPM_PRE_INSTALL_SCRIPT_FILE
|
||||
# CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE
|
||||
# May be used to embbed a pre (un)installation script in the spec file.
|
||||
# May be used to embed a pre (un)installation script in the spec file.
|
||||
# The refered script file(s) will be read and directly
|
||||
# put after the %pre or %preun section
|
||||
if(CPACK_RPM_PRE_INSTALL_SCRIPT_FILE)
|
||||
|
@ -367,6 +383,17 @@ if(CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE)
|
|||
endif(EXISTS ${CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE})
|
||||
endif(CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE)
|
||||
|
||||
# CPACK_RPM_CHANGELOG_FILE
|
||||
# May be used to embed a changelog in the spec file.
|
||||
# The refered file will be read and directly put after the %changelog section
|
||||
if(CPACK_RPM_CHANGELOG_FILE)
|
||||
if(EXISTS ${CPACK_RPM_CHANGELOG_FILE})
|
||||
file(READ ${CPACK_RPM_CHANGELOG_FILE} CPACK_RPM_SPEC_CHANGELOG)
|
||||
else(EXISTS ${CPACK_RPM_CHANGELOG_FILE})
|
||||
message(SEND_ERROR "CPackRPM:Warning: CPACK_RPM_CHANGELOG_FILE <${CPACK_RPM_CHANGELOG_FILE}> does not exists - ignoring")
|
||||
endif(EXISTS ${CPACK_RPM_CHANGELOG_FILE})
|
||||
endif(CPACK_RPM_CHANGELOG_FILE)
|
||||
|
||||
# CPACK_RPM_SPEC_MORE_DEFINE
|
||||
# This is a generated spec rpm file spaceholder
|
||||
IF(CPACK_RPM_SPEC_MORE_DEFINE)
|
||||
|
@ -429,7 +456,7 @@ ENDIF(CPACK_RPM_PACKAGE_DEBUG)
|
|||
IF(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE OR NOT CPACK_RPM_USER_BINARY_SPECFILE)
|
||||
FILE(WRITE ${CPACK_RPM_BINARY_SPECFILE}.in
|
||||
"# -*- rpm-spec -*-
|
||||
Buildroot: \@CPACK_RPM_DIRECTORY\@/\@CPACK_PACKAGE_FILE_NAME\@
|
||||
BuildRoot: \@CPACK_RPM_DIRECTORY\@/\@CPACK_PACKAGE_FILE_NAME\@
|
||||
Summary: \@CPACK_RPM_PACKAGE_SUMMARY\@
|
||||
Name: \@CPACK_RPM_PACKAGE_NAME\@
|
||||
Version: \@CPACK_RPM_PACKAGE_VERSION\@
|
||||
|
@ -437,8 +464,10 @@ 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_PROVIDES\@
|
||||
\@TMP_RPM_OBSOLETES\@
|
||||
\@TMP_RPM_BUILDARCH\@
|
||||
|
||||
#p define prefix \@CMAKE_INSTALL_PREFIX\@
|
||||
|
@ -489,29 +518,7 @@ fi
|
|||
${CPACK_RPM_INSTALL_FILES}
|
||||
|
||||
%changelog
|
||||
* Sun Apr 4 2010 Erk <eric.noulard@gmail.com>
|
||||
Add support for specifying RPM compression type
|
||||
* Sat Nov 28 2009 Erk <eric.noulard@gmail.com>
|
||||
Refix backup/restore install tree for OpenSuSE 11.2
|
||||
* Sun Nov 22 2009 Erk <eric.noulard@gmail.com>
|
||||
Include symlinks in the file list.
|
||||
* Sat Nov 14 2009 Erk <eric.noulard@gmail.com>
|
||||
Replace prep and build step with backup and restore
|
||||
of the previously CPack installed tree. This should
|
||||
mimic what is expected in rpmbuild usual steps
|
||||
* Wed Nov 11 2009 Erk <eric.noulard@gmail.com>
|
||||
Add support for USER defined pre/post[un]install scripts
|
||||
* Wed Oct 07 2009 Erk <eric.noulard@gmail.com>
|
||||
Add user custom spec file support
|
||||
* Sat Oct 03 2009 Kami <cmoidavid@gmail.com>
|
||||
Update to handle more precisely the files section
|
||||
* Mon Oct 03 2008 Erk <eric.noulard@gmail.com>
|
||||
Update generator to handle optional dependencies using Requires
|
||||
Update DEBUG output typos.
|
||||
* Mon Aug 25 2008 Erk <eric.noulard@gmail.com>
|
||||
Update generator to handle optional post-install
|
||||
* Tue Aug 16 2007 Erk <eric.noulard@gmail.com>
|
||||
Generated by CPack RPM Generator and associated macros
|
||||
\@CPACK_RPM_SPEC_CHANGELOG\@
|
||||
")
|
||||
# Stop here if we were asked to only generate a template USER spec file
|
||||
# The generated file may then be used as a template by user who wants
|
||||
|
|
Loading…
Reference in New Issue