Attached Files | bug-9679-erk1.patch [^] (7,262 bytes) 2009-10-07 15:07 [Show Content] [Hide Content]Index: Modules/CPackRPM.cmake
===================================================================
RCS file: /cvsroot/CMake/CMake/Modules/CPackRPM.cmake,v
retrieving revision 1.13.2.1
diff -u -r1.13.2.1 CPackRPM.cmake
--- Modules/CPackRPM.cmake 1 Oct 2009 21:20:22 -0000 1.13.2.1
+++ Modules/CPackRPM.cmake 7 Oct 2009 19:07:25 -0000
@@ -255,10 +255,6 @@
ENDIF(CPACK_RPM_PACKAGE_DEBUG)
ENDIF(CPACK_RPM_SPEC_MORE_DEFINE)
-# CPACK_RPM_USER_BINARY_SPECFILE
-# FIXME when this is set then CPack should us the
-# user provided file.
-
# Now we may create the RPM build tree structure
SET(CPACK_RPM_ROOTDIR "${CPACK_TOPLEVEL_DIRECTORY}")
MESSAGE(STATUS "CPackRPM:Debug: Using CPACK_RPM_ROOTDIR=${CPACK_RPM_ROOTDIR}")
@@ -278,49 +274,51 @@
#STRING(REGEX REPLACE " " "\\\\ " CPACK_RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}")
SET(CPACK_RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}")
-
+# The name of the final spec file to be used by rpmbuild
SET(CPACK_RPM_BINARY_SPECFILE "${CPACK_RPM_ROOTDIR}/SPECS/${CPACK_RPM_PACKAGE_NAME}.spec")
-IF(CPACK_RPM_USER_BINARY_SPECFILE)
- # User may have specified SPECFILE just use it
- MESSAGE("CPackRPM: Will use user specified spec file: ${CPACK_RPM_USER_BINARY_SPECFILE}")
- # Note that user provided file is processed for @var replacement
- CONFIGURE_FILE(${CPACK_RPM_USER_BINARY_SPECFILE} ${CPACK_RPM_BINARY_SPECFILE} @ONLY)
-ELSE(CPACK_RPM_USER_BINARY_SPECFILE)
- # No User specified spec file generate a valid one using var values
- IF(CPACK_RPM_PACKAGE_DEBUG)
- MESSAGE("CPackRPM:Debug: CPACK_TOPLEVEL_DIRECTORY = ${CPACK_TOPLEVEL_DIRECTORY}")
- MESSAGE("CPackRPM:Debug: CPACK_TOPLEVEL_TAG = ${CPACK_TOPLEVEL_TAG}")
- MESSAGE("CPackRPM:Debug: CPACK_TEMPORARY_DIRECTORY = ${CPACK_TEMPORARY_DIRECTORY}")
- MESSAGE("CPackRPM:Debug: CPACK_OUTPUT_FILE_NAME = ${CPACK_OUTPUT_FILE_NAME}")
- MESSAGE("CPackRPM:Debug: CPACK_OUTPUT_FILE_PATH = ${CPACK_OUTPUT_FILE_PATH}")
- MESSAGE("CPackRPM:Debug: CPACK_PACKAGE_FILE_NAME = ${CPACK_PACKAGE_FILE_NAME}")
- MESSAGE("CPackRPM:Debug: CPACK_RPM_BINARY_SPECFILE = ${CPACK_RPM_BINARY_SPECFILE}")
- MESSAGE("CPackRPM:Debug: CPACK_PACKAGE_INSTALL_DIRECTORY = ${CPACK_PACKAGE_INSTALL_DIRECTORY}")
- MESSAGE("CPackRPM:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = ${CPACK_TEMPORARY_PACKAGE_FILE_NAME}")
- ENDIF(CPACK_RPM_PACKAGE_DEBUG)
- FILE(WRITE ${CPACK_RPM_BINARY_SPECFILE}
+
+# Print out some debug information if we were asked for that
+IF(CPACK_RPM_PACKAGE_DEBUG)
+ MESSAGE("CPackRPM:Debug: CPACK_TOPLEVEL_DIRECTORY = ${CPACK_TOPLEVEL_DIRECTORY}")
+ MESSAGE("CPackRPM:Debug: CPACK_TOPLEVEL_TAG = ${CPACK_TOPLEVEL_TAG}")
+ MESSAGE("CPackRPM:Debug: CPACK_TEMPORARY_DIRECTORY = ${CPACK_TEMPORARY_DIRECTORY}")
+ MESSAGE("CPackRPM:Debug: CPACK_OUTPUT_FILE_NAME = ${CPACK_OUTPUT_FILE_NAME}")
+ MESSAGE("CPackRPM:Debug: CPACK_OUTPUT_FILE_PATH = ${CPACK_OUTPUT_FILE_PATH}")
+ MESSAGE("CPackRPM:Debug: CPACK_PACKAGE_FILE_NAME = ${CPACK_PACKAGE_FILE_NAME}")
+ MESSAGE("CPackRPM:Debug: CPACK_RPM_BINARY_SPECFILE = ${CPACK_RPM_BINARY_SPECFILE}")
+ MESSAGE("CPackRPM:Debug: CPACK_PACKAGE_INSTALL_DIRECTORY = ${CPACK_PACKAGE_INSTALL_DIRECTORY}")
+ MESSAGE("CPackRPM:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = ${CPACK_TEMPORARY_PACKAGE_FILE_NAME}")
+ENDIF(CPACK_RPM_PACKAGE_DEBUG)
+
+# USER generated spec file handling.
+# We should generate a spec file 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
+#
+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}
-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_REQUIRES}
-${TMP_RPM_BUILDARCH}
-
-#p define prefix ${CMAKE_INSTALL_PREFIX}
-%define _rpmdir ${CPACK_RPM_DIRECTORY}
-%define _rpmfilename ${CPACK_RPM_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\@
+Release: \@CPACK_RPM_PACKAGE_RELEASE\@
+License: \@CPACK_RPM_PACKAGE_LICENSE\@
+Group: \@CPACK_RPM_PACKAGE_GROUP\@
+Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@
+\@TMP_RPM_REQUIRES\@
+\@TMP_RPM_BUILDARCH\@
+
+#p define prefix \@CMAKE_INSTALL_PREFIX\@
+%define _rpmdir \@CPACK_RPM_DIRECTORY\@
+%define _rpmfilename \@CPACK_RPM_FILE_NAME\@
%define _unpackaged_files_terminate_build 0
-%define _topdir ${CPACK_RPM_DIRECTORY}
-${TMP_RPM_SPEC_INSTALL_POST}
-${CPACK_RPM_SPEC_MORE_DEFINE}
+%define _topdir \@CPACK_RPM_DIRECTORY\@
+\@TMP_RPM_SPEC_INSTALL_POST\@
+\@CPACK_RPM_SPEC_MORE_DEFINE\@
%description
-${CPACK_RPM_PACKAGE_DESCRIPTION}
+\@CPACK_RPM_PACKAGE_DESCRIPTION\@
# This is a shortcutted spec file
# generated by CMake RPM generator
@@ -341,6 +339,8 @@
/*
%changelog
+* Wed Oct 07 2009 Erk <eric.noulard@gmail.com>
+ Add user custom spec file support
* Mon Oct 03 2008 Erk <eric.noulard@gmail.com>
Update generator to handle optional dependencies using Requires
Update DEBUG output typos.
@@ -349,8 +349,27 @@
* Tue Aug 16 2007 Erk <eric.noulard@gmail.com>
Generated by CPack RPM Generator and associated macros
")
-ENDIF(CPACK_RPM_USER_BINARY_SPECFILE)
+ # 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
+ # to customize their own spec file.
+ IF(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE)
+ MESSAGE(FATAL_ERROR "CPackRPM: STOP here Generated USER binary spec file templare is: ${CPACK_RPM_BINARY_SPECFILE}.in")
+ ENDIF(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE)
+ENDIF(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE OR NOT CPACK_RPM_USER_BINARY_SPECFILE)
+# After that we may either use a user provided spec file
+# or generate one using appropriate variables value.
+IF(CPACK_RPM_USER_BINARY_SPECFILE)
+ # User may have specified SPECFILE just use it
+ MESSAGE("CPackRPM: Will use USER specified spec file: ${CPACK_RPM_USER_BINARY_SPECFILE}")
+ # The user provided file is processed for @var replacement
+ CONFIGURE_FILE(${CPACK_RPM_USER_BINARY_SPECFILE} ${CPACK_RPM_BINARY_SPECFILE} @ONLY)
+ELSE(CPACK_RPM_USER_BINARY_SPECFILE)
+ # No User specified spec file, will use the generated spec file
+ MESSAGE("CPackRPM: Will use GENERATED spec file: ${CPACK_RPM_BINARY_SPECFILE}")
+ # Note the just created file is processed for @var replacement
+ CONFIGURE_FILE(${CPACK_RPM_BINARY_SPECFILE}.in ${CPACK_RPM_BINARY_SPECFILE} @ONLY)
+ENDIF(CPACK_RPM_USER_BINARY_SPECFILE)
IF(RPMBUILD_EXECUTABLE)
# Now call rpmbuild using the SPECFILE
bug-9679-erk2.patch [^] (8,350 bytes) 2009-10-07 15:14 [Show Content] [Hide Content]Index: Modules/CPackRPM.cmake
===================================================================
RCS file: /cvsroot/CMake/CMake/Modules/CPackRPM.cmake,v
retrieving revision 1.13.2.1
diff -u -r1.13.2.1 CPackRPM.cmake
--- Modules/CPackRPM.cmake 1 Oct 2009 21:20:22 -0000 1.13.2.1
+++ Modules/CPackRPM.cmake 7 Oct 2009 19:14:22 -0000
@@ -69,6 +69,20 @@
# May be set when invoking cpack in order to trace debug informations
# during CPack RPM run. For example you may launch CPack like this
# cpack -D CPACK_RPM_PACKAGE_DEBUG=1 -G RPM
+# CPACK_RPM_USER_BINARY_SPECFILE
+# Mandatory : NO
+# Default : -
+# 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.
+# The specified file will be processed by CONFIGURE_FILE( @ONLY).
+# CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE
+# Mandatory : NO
+# Default : -
+# If set CPack will generate a template for USER specified binary
+# spec file and stop with an error. For example launch CPack like this
+# cpack -D CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE=1 -G RPM
+# The user may then use this file in order to hand-craft is own
+# binary spec file which may be used with CPACK_RPM_USER_BINARY_SPECFILE.
#=============================================================================
# Copyright 2007-2009 Kitware, Inc.
@@ -255,10 +269,6 @@
ENDIF(CPACK_RPM_PACKAGE_DEBUG)
ENDIF(CPACK_RPM_SPEC_MORE_DEFINE)
-# CPACK_RPM_USER_BINARY_SPECFILE
-# FIXME when this is set then CPack should us the
-# user provided file.
-
# Now we may create the RPM build tree structure
SET(CPACK_RPM_ROOTDIR "${CPACK_TOPLEVEL_DIRECTORY}")
MESSAGE(STATUS "CPackRPM:Debug: Using CPACK_RPM_ROOTDIR=${CPACK_RPM_ROOTDIR}")
@@ -278,49 +288,51 @@
#STRING(REGEX REPLACE " " "\\\\ " CPACK_RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}")
SET(CPACK_RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}")
-
+# The name of the final spec file to be used by rpmbuild
SET(CPACK_RPM_BINARY_SPECFILE "${CPACK_RPM_ROOTDIR}/SPECS/${CPACK_RPM_PACKAGE_NAME}.spec")
-IF(CPACK_RPM_USER_BINARY_SPECFILE)
- # User may have specified SPECFILE just use it
- MESSAGE("CPackRPM: Will use user specified spec file: ${CPACK_RPM_USER_BINARY_SPECFILE}")
- # Note that user provided file is processed for @var replacement
- CONFIGURE_FILE(${CPACK_RPM_USER_BINARY_SPECFILE} ${CPACK_RPM_BINARY_SPECFILE} @ONLY)
-ELSE(CPACK_RPM_USER_BINARY_SPECFILE)
- # No User specified spec file generate a valid one using var values
- IF(CPACK_RPM_PACKAGE_DEBUG)
- MESSAGE("CPackRPM:Debug: CPACK_TOPLEVEL_DIRECTORY = ${CPACK_TOPLEVEL_DIRECTORY}")
- MESSAGE("CPackRPM:Debug: CPACK_TOPLEVEL_TAG = ${CPACK_TOPLEVEL_TAG}")
- MESSAGE("CPackRPM:Debug: CPACK_TEMPORARY_DIRECTORY = ${CPACK_TEMPORARY_DIRECTORY}")
- MESSAGE("CPackRPM:Debug: CPACK_OUTPUT_FILE_NAME = ${CPACK_OUTPUT_FILE_NAME}")
- MESSAGE("CPackRPM:Debug: CPACK_OUTPUT_FILE_PATH = ${CPACK_OUTPUT_FILE_PATH}")
- MESSAGE("CPackRPM:Debug: CPACK_PACKAGE_FILE_NAME = ${CPACK_PACKAGE_FILE_NAME}")
- MESSAGE("CPackRPM:Debug: CPACK_RPM_BINARY_SPECFILE = ${CPACK_RPM_BINARY_SPECFILE}")
- MESSAGE("CPackRPM:Debug: CPACK_PACKAGE_INSTALL_DIRECTORY = ${CPACK_PACKAGE_INSTALL_DIRECTORY}")
- MESSAGE("CPackRPM:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = ${CPACK_TEMPORARY_PACKAGE_FILE_NAME}")
- ENDIF(CPACK_RPM_PACKAGE_DEBUG)
- FILE(WRITE ${CPACK_RPM_BINARY_SPECFILE}
+
+# Print out some debug information if we were asked for that
+IF(CPACK_RPM_PACKAGE_DEBUG)
+ MESSAGE("CPackRPM:Debug: CPACK_TOPLEVEL_DIRECTORY = ${CPACK_TOPLEVEL_DIRECTORY}")
+ MESSAGE("CPackRPM:Debug: CPACK_TOPLEVEL_TAG = ${CPACK_TOPLEVEL_TAG}")
+ MESSAGE("CPackRPM:Debug: CPACK_TEMPORARY_DIRECTORY = ${CPACK_TEMPORARY_DIRECTORY}")
+ MESSAGE("CPackRPM:Debug: CPACK_OUTPUT_FILE_NAME = ${CPACK_OUTPUT_FILE_NAME}")
+ MESSAGE("CPackRPM:Debug: CPACK_OUTPUT_FILE_PATH = ${CPACK_OUTPUT_FILE_PATH}")
+ MESSAGE("CPackRPM:Debug: CPACK_PACKAGE_FILE_NAME = ${CPACK_PACKAGE_FILE_NAME}")
+ MESSAGE("CPackRPM:Debug: CPACK_RPM_BINARY_SPECFILE = ${CPACK_RPM_BINARY_SPECFILE}")
+ MESSAGE("CPackRPM:Debug: CPACK_PACKAGE_INSTALL_DIRECTORY = ${CPACK_PACKAGE_INSTALL_DIRECTORY}")
+ MESSAGE("CPackRPM:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = ${CPACK_TEMPORARY_PACKAGE_FILE_NAME}")
+ENDIF(CPACK_RPM_PACKAGE_DEBUG)
+
+# USER generated spec file handling.
+# We should generate a spec file 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
+#
+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}
-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_REQUIRES}
-${TMP_RPM_BUILDARCH}
-
-#p define prefix ${CMAKE_INSTALL_PREFIX}
-%define _rpmdir ${CPACK_RPM_DIRECTORY}
-%define _rpmfilename ${CPACK_RPM_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\@
+Release: \@CPACK_RPM_PACKAGE_RELEASE\@
+License: \@CPACK_RPM_PACKAGE_LICENSE\@
+Group: \@CPACK_RPM_PACKAGE_GROUP\@
+Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@
+\@TMP_RPM_REQUIRES\@
+\@TMP_RPM_BUILDARCH\@
+
+#p define prefix \@CMAKE_INSTALL_PREFIX\@
+%define _rpmdir \@CPACK_RPM_DIRECTORY\@
+%define _rpmfilename \@CPACK_RPM_FILE_NAME\@
%define _unpackaged_files_terminate_build 0
-%define _topdir ${CPACK_RPM_DIRECTORY}
-${TMP_RPM_SPEC_INSTALL_POST}
-${CPACK_RPM_SPEC_MORE_DEFINE}
+%define _topdir \@CPACK_RPM_DIRECTORY\@
+\@TMP_RPM_SPEC_INSTALL_POST\@
+\@CPACK_RPM_SPEC_MORE_DEFINE\@
%description
-${CPACK_RPM_PACKAGE_DESCRIPTION}
+\@CPACK_RPM_PACKAGE_DESCRIPTION\@
# This is a shortcutted spec file
# generated by CMake RPM generator
@@ -341,6 +353,8 @@
/*
%changelog
+* Wed Oct 07 2009 Erk <eric.noulard@gmail.com>
+ Add user custom spec file support
* Mon Oct 03 2008 Erk <eric.noulard@gmail.com>
Update generator to handle optional dependencies using Requires
Update DEBUG output typos.
@@ -349,8 +363,27 @@
* Tue Aug 16 2007 Erk <eric.noulard@gmail.com>
Generated by CPack RPM Generator and associated macros
")
-ENDIF(CPACK_RPM_USER_BINARY_SPECFILE)
+ # 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
+ # to customize their own spec file.
+ IF(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE)
+ MESSAGE(FATAL_ERROR "CPackRPM: STOP here Generated USER binary spec file templare is: ${CPACK_RPM_BINARY_SPECFILE}.in")
+ ENDIF(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE)
+ENDIF(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE OR NOT CPACK_RPM_USER_BINARY_SPECFILE)
+# After that we may either use a user provided spec file
+# or generate one using appropriate variables value.
+IF(CPACK_RPM_USER_BINARY_SPECFILE)
+ # User may have specified SPECFILE just use it
+ MESSAGE("CPackRPM: Will use USER specified spec file: ${CPACK_RPM_USER_BINARY_SPECFILE}")
+ # The user provided file is processed for @var replacement
+ CONFIGURE_FILE(${CPACK_RPM_USER_BINARY_SPECFILE} ${CPACK_RPM_BINARY_SPECFILE} @ONLY)
+ELSE(CPACK_RPM_USER_BINARY_SPECFILE)
+ # No User specified spec file, will use the generated spec file
+ MESSAGE("CPackRPM: Will use GENERATED spec file: ${CPACK_RPM_BINARY_SPECFILE}")
+ # Note the just created file is processed for @var replacement
+ CONFIGURE_FILE(${CPACK_RPM_BINARY_SPECFILE}.in ${CPACK_RPM_BINARY_SPECFILE} @ONLY)
+ENDIF(CPACK_RPM_USER_BINARY_SPECFILE)
IF(RPMBUILD_EXECUTABLE)
# Now call rpmbuild using the SPECFILE
|