View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0009872CMakeCPackpublic2009-11-09 14:392009-11-28 17:17
Reporterhellerf 
Assigned ToEric NOULARD 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product VersionCMake-2-8 
Target VersionFixed in VersionCMake-2-8 
Summary0009872: CPackRPM does not work with rpmbuild version 4.7.1 (patch included)
DescriptionThank you very much for CMake--I love it.

===recreate===
1. Get rpmbuild 4.7.1 (distributed with Fedora Core 11)
2. Get lastest CVS of CMake and build, install
3. Create a CMakeLists.txt that installs a target and specifies just enough CPack info to generate an RPM (example attached)
4. cmake .
5. make
6. cpack -V -D CPACK_RPM_PACKAGE_DEBUG=1 -G RPM

===discussion and patch===

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 and cpack fails. 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.
Additional InformationI 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}

TagsNo tags attached.
Attached Filestxt file icon CMakeLists.txt [^] (372 bytes) 2009-11-09 14:39 [Show Content]
patch file icon bug-9872-erk1.patch [^] (647 bytes) 2009-11-13 17:19 [Show Content]
patch file icon bug-9872-erk2.patch [^] (2,640 bytes) 2009-11-28 07:44 [Show Content]

 Relationships

  Notes
(0018376)
Eric NOULARD (developer)
2009-11-09 15:30

The bug is not really an RPM 4.7.1 issue but more like a redhat/fedora
specific issue, since:

"I found the culprit to be /usr/lib/rpm/redhat/macros where the
__spec_install_pre does..."

The fact is that the current "short-cutted" version of the RPM spec
file generated by CPackRPM is not really following the rpmbuild steps spirits
cmake is the %prep+%configure step
make is the build step
cpack is more or less the %install step

making a shortcutted spec file was the way to merge rpm + cpack spirit.
We may have to re-think the merge before being force to apply patch over
patch to make both CPackRPM and rpmbuild happy.
(0018398)
Eric NOULARD (developer)
2009-11-11 16:29

After checking it looks like FC11 is shipped with rpm 4.7.0-1
4.7.1-1 is "only" coming with an update.

FC12 (Beta) comes with 4.7.1-6

So problems should show up in FC11 updated or in FC12 when out.
I'm reluctant to fully suppress distro-wide "__spec_install_pre" macro **unconditionnally**

I would rather find either an optional way or a way to live with it.
Optional way would be to
SET(CPACK_RPM_SUPPRESS_MACRO_SPEC_INSTALL_PRE True)
default value being False.
(0018399)
Eric NOULARD (developer)
2009-11-11 16:52

Now I'm pretty sure that rpm version is NOT the culprit.
The culprit macro file
/usr/lib/rpm/redhat/macros
is belonging to redhat-rpm-config RPM package.

try:
rpm -ql redhat-rpm-config | grep macros

I can confirm that freshly installed FC11 does not exhibit the trouble
and updated one with
redhat-rpm-config-9.0.3-11.fc11.noarch.rpm
(previously installed version was 9.0.3-6.fc11)

DOES have this new "magic" distro-wide macro...

I'm still thinking what to do.
(0018409)
Eric NOULARD (developer)
2009-11-13 17:22

Hi Forrest,

I may propose another way to patch.
Save the "properly installed by CPack" tree during %prep
Restore it during %build

then go on.

This should work in any case without requiring distro-specific tricks.

What do you think?
Could you try to update your CVS HEAD tree and apply the freshly attached
patch?
(0018411)
hellerf (reporter)
2009-11-14 20:30
edited on: 2009-11-14 20:33

The patch proposed by eric.noulard solves the problem

EDIT:
And I like it better than mine.

(0018412)
Eric NOULARD (developer)
2009-11-15 04:50

Ok Forrest,

I may apply that one.
However I did try to reproduce your bug on FC11 + update
and I did not manage to do it??

Do you by any chance have a specific .rpmmacros in $HOME?
I don't understand why in my case the __spec_install_pre
doesn't seems to be the one in /usr/lib/rpm/redhat/macros.

Eric
(0018413)
hellerf (reporter)
2009-11-15 05:27

I have no custom macros and very little customization on the system in general.
#yum search '*/macros'
...
redhat-rpm-config-9.0.3-10.fc11.noarch : Red Hat specific rpm configuration files.
Repo : installed
Matched from:
Filename : /usr/lib/rpm/redhat/macros
(0018415)
Eric NOULARD (developer)
2009-11-15 13:56

The fix is now in CVS HEAD

$ cvs ci Modules/CPackRPM.cmake
Committer: Eric Noulard <eric.noulard@gmail.com>
/cvsroot/CMake/CMake/Modules/CPackRPM.cmake,v <-- Modules/CPackRPM.cmake
new revision: 1.19; previous revision: 1.18
(0018535)
Eric NOULARD (developer)
2009-11-22 13:30

may be included in 2.8.1
(0018588)
Eric NOULARD (developer)
2009-11-25 09:01

Looks like the fix is not working on some Open SuSE distro:
see:
http://www.cmake.org/pipermail/cmake/2009-November/033523.html [^]
(0018603)
Eric NOULARD (developer)
2009-11-28 07:46

Second try patch under review.
This second patch is made against current CVS HEAD.
Already tried it successfully on OpenSuSE 11.2.
Now trying on Fedora 11
(0018604)
Eric NOULARD (developer)
2009-11-28 10:00

Tested on Fedora too.
This fix looks good for both Open SuSE and Fedora now.

Committer: Eric Noulard <eric.noulard@gmail.com>
/cvsroot/CMake/CMake/Modules/CPackRPM.cmake,v <-- Modules/CPackRPM.cmake
new revision: 1.21; previous revision: 1.20

Forrest may you retry CVS HEAD
Like I said I tested the checked in version on Fedora 11 + update
but last time I wasn't able to reproduce the problem you had so
may be it'll good for you to try in your own environment.
(0018610)
hellerf (reporter)
2009-11-28 17:12

It works!

Pulled from CVS HEAD and confirmed that your latest commit was present

cd cmakebuild
rm -rf *
cmake ..
cpack -G RPM

Produces the expected RPM and is installable. Thanks!
(0018611)
Eric NOULARD (developer)
2009-11-28 17:17

Hopefully really closed this time.
Working on Fedora as before and now with no bad side-effect on Open SuSE.

 Issue History
Date Modified Username Field Change
2009-11-09 14:39 hellerf New Issue
2009-11-09 14:39 hellerf File Added: CMakeLists.txt
2009-11-09 15:30 Eric NOULARD Note Added: 0018376
2009-11-11 16:29 Eric NOULARD Note Added: 0018398
2009-11-11 16:52 Eric NOULARD Note Added: 0018399
2009-11-13 17:19 Eric NOULARD File Added: bug-9872-erk1.patch
2009-11-13 17:22 Eric NOULARD Note Added: 0018409
2009-11-14 20:30 hellerf Note Added: 0018411
2009-11-14 20:33 hellerf Note Edited: 0018411
2009-11-15 04:50 Eric NOULARD Note Added: 0018412
2009-11-15 05:27 hellerf Note Added: 0018413
2009-11-15 13:56 Eric NOULARD Note Added: 0018415
2009-11-22 09:33 Alex Neundorf Status new => assigned
2009-11-22 09:33 Alex Neundorf Assigned To => Eric NOULARD
2009-11-22 13:30 Eric NOULARD Note Added: 0018535
2009-11-22 13:30 Eric NOULARD Status assigned => closed
2009-11-22 13:30 Eric NOULARD Resolution open => fixed
2009-11-22 13:30 Eric NOULARD Fixed in Version => CMake-2-8
2009-11-25 09:01 Eric NOULARD Note Added: 0018588
2009-11-25 09:01 Eric NOULARD Status closed => feedback
2009-11-25 09:01 Eric NOULARD Resolution fixed => reopened
2009-11-28 07:44 Eric NOULARD File Added: bug-9872-erk2.patch
2009-11-28 07:46 Eric NOULARD Note Added: 0018603
2009-11-28 10:00 Eric NOULARD Note Added: 0018604
2009-11-28 17:12 hellerf Note Added: 0018610
2009-11-28 17:17 Eric NOULARD Note Added: 0018611
2009-11-28 17:17 Eric NOULARD Status feedback => closed
2009-11-28 17:17 Eric NOULARD Resolution reopened => fixed


Copyright © 2000 - 2018 MantisBT Team