From 81221b80e2d74d120bfb61c62e07e3f7f1b9929f Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Thu, 29 Jan 2015 11:52:30 -0500 Subject: [PATCH 1/2] CPack: Fix packaging of source tarballs with symbolic links When staging the package installation, if the first file in a directory happens to be a symbolic link, make sure we create the directory before trying to create the link. --- Source/CPack/cmCPackGenerator.cxx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index f21fcf64f..1c670d20b 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -437,6 +437,18 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( cmCPackLogger(cmCPackLog::LOG_DEBUG, "Will create a symlink: " << symlinkedIt->second << "--> " << symlinkedIt->first << std::endl); + // make sure directory exists for symlink + std::string destDir = + cmSystemTools::GetFilenamePath(symlinkedIt->second); + if(!destDir.empty() && !cmSystemTools::MakeDirectory(destDir)) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot create dir: " + << destDir + << "\nTrying to create symlink: " + << symlinkedIt->second << "--> " + << symlinkedIt->first + << std::endl); + } if (!cmSystemTools::CreateSymlink(symlinkedIt->first, symlinkedIt->second)) { From 4dc5acee634b3ac72f2e1c2f1ca0489526a86cf3 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Thu, 29 Jan 2015 11:52:30 -0500 Subject: [PATCH 2/2] CPack: Fix packaging of source tarballs with symbolic links When staging the package installation, if the first file in a directory happens to be a symbolic link, make sure we create the directory before trying to create the link. --- Source/CPack/cmCPackGenerator.cxx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 84e64821e..8139d298a 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -437,6 +437,18 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( cmCPackLogger(cmCPackLog::LOG_DEBUG, "Will create a symlink: " << symlinkedIt->second << "--> " << symlinkedIt->first << std::endl); + // make sure directory exists for symlink + std::string destDir = + cmSystemTools::GetFilenamePath(symlinkedIt->second); + if(!destDir.empty() && !cmSystemTools::MakeDirectory(destDir)) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot create dir: " + << destDir + << "\nTrying to create symlink: " + << symlinkedIt->second << "--> " + << symlinkedIt->first + << std::endl); + } if (!cmSystemTools::CreateSymlink((symlinkedIt->first).c_str(), (symlinkedIt->second).c_str())) {