BUG: fix packaging of files installed to absolute paths, works only when
used with SET(CPACK_SET_DESTDIR "ON") Alex
This commit is contained in:
parent
fb8a779c43
commit
12ba1e9b20
|
@ -124,7 +124,27 @@ int cmCPackDebGenerator::CompressFiles(const char* outFileName,
|
||||||
std::string cmd;
|
std::string cmd;
|
||||||
cmd = "\"";
|
cmd = "\"";
|
||||||
cmd += cmakeExecutable;
|
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;
|
std::string output;
|
||||||
int retVal = -1;
|
int retVal = -1;
|
||||||
int res = cmSystemTools::RunSingleCommand(cmd.c_str(), &output,
|
int res = cmSystemTools::RunSingleCommand(cmd.c_str(), &output,
|
||||||
|
|
Loading…
Reference in New Issue