summaryrefslogtreecommitdiffstats
path: root/Source/CPack/cmCPackDebGenerator.cxx
diff options
context:
space:
mode:
authorAlexander Neundorf <neundorf@kde.org>2008-03-29 00:23:01 (GMT)
committerAlexander Neundorf <neundorf@kde.org>2008-03-29 00:23:01 (GMT)
commit12ba1e9b208a25a8d4b5a97177e1fd6e4d4e5afa (patch)
treefe32b1f7274e5574989afcdffa66b43ff1139311 /Source/CPack/cmCPackDebGenerator.cxx
parentfb8a779c437fe11e6de44db06fbef8b7e6e1c3f6 (diff)
downloadCMake-12ba1e9b208a25a8d4b5a97177e1fd6e4d4e5afa.zip
CMake-12ba1e9b208a25a8d4b5a97177e1fd6e4d4e5afa.tar.gz
CMake-12ba1e9b208a25a8d4b5a97177e1fd6e4d4e5afa.tar.bz2
BUG: fix packaging of files installed to absolute paths, works only when
used with SET(CPACK_SET_DESTDIR "ON") Alex
Diffstat (limited to 'Source/CPack/cmCPackDebGenerator.cxx')
-rw-r--r--Source/CPack/cmCPackDebGenerator.cxx22
1 files changed, 21 insertions, 1 deletions
diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx
index 2a9d222..b0ade56 100644
--- a/Source/CPack/cmCPackDebGenerator.cxx
+++ b/Source/CPack/cmCPackDebGenerator.cxx
@@ -124,7 +124,27 @@ int cmCPackDebGenerator::CompressFiles(const char* outFileName,
std::string cmd;
cmd = "\"";
cmd += cmakeExecutable;
- cmd += "\" -E tar cfz data.tar.gz ./usr";
+ cmd += "\" -E tar cfz data.tar.gz ";
+
+ // now add all directories which have to be compressed
+ // collect all top level install dirs for that
+ // e.g. /opt/bin/foo, /usr/bin/bar and /usr/bin/baz would give /usr and /opt
+ int topLevelLength = strlen(toplevel);
+ std::set<std::string> installDirs;
+ for (std::vector<std::string>::const_iterator fileIt = files.begin();
+ fileIt != files.end(); ++ fileIt )
+ {
+ std::string::size_type slashPos = fileIt->find('/', topLevelLength+1);
+ std::string relativeDir = fileIt->substr(topLevelLength,
+ slashPos - topLevelLength);
+ if (installDirs.find(relativeDir) == installDirs.end())
+ {
+ installDirs.insert(relativeDir);
+ cmd += " .";
+ cmd += relativeDir;
+ }
+ }
+
std::string output;
int retVal = -1;
int res = cmSystemTools::RunSingleCommand(cmd.c_str(), &output,