[CMake] Issue using CPackRPM with rpmbuild 4.7.1 and a small patch
forrest at forrestheller.com
forrest at forrestheller.com
Mon Nov 9 13:09:56 EST 2009
Thank you very much for CMake--I love it.
I need to build RPMs using CPack. This worked using rpmbuild 4.4.2.1 and
the latest CVS version of CMake.
But when I installed rpmbuild 4.7.1 I found that, prior to the %install
phase, rpmbuild clears your entire buildroot directory. This is
problematic, as CMake does not build the buildroot directory after
%install. See http://osdir.com/ml/fedora-packaging/2009-09/msg00001.html
for a full discussion.
My patch is basically stolen from
http://cvs.fedoraproject.org/viewvc/rpms/kernel/F-12/kernel.spec?revision=1.1913&view=co
The point of the patch is to override the build stage that clears the
buildroot directory
===================================================================
RCS file: /cvsroot/CMake/CMake/Modules/CPackRPM.cmake,v
retrieving revision 1.14
diff -u -r1.14 CPackRPM.cmake
--- CPackRPM.cmake 28 Sep 2009 15:46:50 -0000 1.14
+++ CPackRPM.cmake 9 Nov 2009 17:36:47 -0000
@@ -318,7 +318,9 @@
%define _topdir ${CPACK_RPM_DIRECTORY}
${TMP_RPM_SPEC_INSTALL_POST}
${CPACK_RPM_SPEC_MORE_DEFINE}
-
+# rpmbuild 4.7+ will remove the buildroot dir during pre-install
+%global __spec_install_pre %{___build_pre}
+
%description
${CPACK_RPM_PACKAGE_DESCRIPTION}
This patch allows me to generate RPMs on Fedora Core 11 with rpmbuild
4.7.1. Is it Good? Bad? Lame?
-Forrest
===extra info===
I found the culprit to be /usr/lib/rpm/redhat/macros where the
__spec_install_pre does the following:
#==============================================================================
# ---- Build policy macros.
#
#
#---------------------------------------------------------------------
# Expanded at beginning of %install scriptlet.
#
%__spec_install_pre %{___build_pre}\
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "${RPM_BUILD_ROOT}"\
mkdir -p `dirname "$RPM_BUILD_ROOT"`\
mkdir "$RPM_BUILD_ROOT"\
%{nil}
More information about the CMake
mailing list