MantisBT - CMake
View Issue Details
0012542CMakeCPackpublic2011-10-27 09:322011-10-27 11:41
Alex Neundorf 
Eric NOULARD 
normalminoralways
closedno change required 
CMake 2.8.6 
 
0012542: Uninstalling a cpack-generated rpm leaves empty directories behind
We are using cpack to generate rpms for our package.
When such a rpm is uninstalled later on, the files are removed, but empty directories are left behind.
It would be nice if those would be removed too.

One way could be to collect all installed directories, and put them with %dir in the spec file.
But, AFAIK, not all those directories should be removed when uninstalling the package, e.g. /usr/local/bin should not be removed.
One way to do this would be to filter the obtained list of directories against a set of known directories (e.g. from CMAKE_PREFIX_PATH), so that /usr, /usr/local, and their bin, include and lib directories are filtered out.
This could be extended by an additional variable e.g. in Modules/Platforms/UnixPaths.cmake like CMAKE_OTHER_STANDARD_PATHS which could contain e.g. shared/, doc/ etc.

Alex

No tags attached.
related to 0009654closed Eric NOULARD [CPackRPM] %files section in spec file shall not contain all directories 
related to 0012305closed Eric NOULARD RPM should include directories 
Issue History
2011-10-27 09:32Alex NeundorfNew Issue
2011-10-27 09:32Alex NeundorfStatusnew => assigned
2011-10-27 09:32Alex NeundorfAssigned To => Eric NOULARD
2011-10-27 09:33Alex NeundorfRelationship addedrelated to 0009654
2011-10-27 09:52Eric NOULARDNote Added: 0027660
2011-10-27 09:52Eric NOULARDRelationship addedrelated to 0012305
2011-10-27 09:56Eric NOULARDNote Added: 0027661
2011-10-27 10:39Alex NeundorfNote Added: 0027662
2011-10-27 11:41Alex NeundorfNote Added: 0027663
2011-10-27 11:41Alex NeundorfStatusassigned => closed
2011-10-27 11:41Alex NeundorfResolutionopen => no change required

Notes
(0027660)
Eric NOULARD   
2011-10-27 09:52   
Hi Alex,

This include or not include dir is somehow popping-up again
in various direction each time...
See 0012305

May be you have ready-to-run test case for that?
(0027661)
Eric NOULARD   
2011-10-27 09:56   
Alex,

Reading the referred bug makes me think that rpm command should remove
a directory when no installed packaged are refering to the dir.

Reading your report makes me think the other way around...

Thus my previous comment: do you have a simple test case at hand?

Could give me more info on the distro you use (Fedora, CentOS, OpenSuSE ???)
and what is the rpm version installed on the distro.

$ rpmbuild --version

should give you the answer.
(0027662)
Alex Neundorf   
2011-10-27 10:39   
Tested on OpenSUSE 11.4 (rpm 4.8.0), SLES 10 (rpm 4.4.2), Scientific Linux 6 (rpm 4.8.0) and Centos 5.6 (rpm 4.4.2.3), the empty directories stay on all 4 systems.

I just saw in your other bug report that there may be a change with cmake 2.8.6, this was still with 2.8.4.
...testing now with 2.8.6.

Alex
(0027663)
Alex Neundorf   
2011-10-27 11:41   
Ok, works fine with cmake 2.8.6.
Tested on OpenSUSE 11.4 and Centos 5.6.
Empty directories are removed.