[Cmake-commits] CMake branch, next, updated. v2.8.2-585-g4ead671
Eric Noulard
eric.noulard at gmail.com
Sat Aug 28 10:51:49 EDT 2010
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via 4ead6713c4a0aa0f04a6895ed8cc0c8bee52cc07 (commit)
via 013e0039eeb7e8bf213c3851161ce9a18f7b940d (commit)
via 216aa24d9296d3c9af607aea59e38c51c482838b (commit)
from 5bcc13a4e9634da29d1584ab3fd678a027187c44 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4ead6713c4a0aa0f04a6895ed8cc0c8bee52cc07
commit 4ead6713c4a0aa0f04a6895ed8cc0c8bee52cc07
Merge: 5bcc13a 013e003
Author: Eric Noulard <eric.noulard at gmail.com>
AuthorDate: Sat Aug 28 10:51:48 2010 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Sat Aug 28 10:51:48 2010 -0400
Merge topic 'CPack-PreserveSymlinksInInstalledDirs-v2' into next
013e003 CPack handle symlinks in CPACK_INSTALLED_DIRECTORIES fix for bug5430
216aa24 KWSys Nightly Date Stamp
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=013e0039eeb7e8bf213c3851161ce9a18f7b940d
commit 013e0039eeb7e8bf213c3851161ce9a18f7b940d
Author: Eric NOULARD <eric.noulard at gmail.com>
AuthorDate: Sat Aug 28 16:50:06 2010 +0200
Commit: Eric NOULARD <eric.noulard at gmail.com>
CommitDate: Sat Aug 28 16:50:06 2010 +0200
CPack handle symlinks in CPACK_INSTALLED_DIRECTORIES fix for bug5430
The proposed solution is to avoid to CopyIfDifferent any links
found in CPACK_INSTALLED_DIRECTORIES but memorize them instead
then at the end of the processing for each dir do re-create the
link in the installed tree.
Current patch should work if the link are "local" to the directory.
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 4ae2d1f..2204ab5 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -329,6 +329,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
it != installDirectoriesVector.end();
++it )
{
+ std::list<std::pair<std::string,std::string> > symlinkedFiles;
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Find files" << std::endl);
cmsys::Glob gl;
std::string top = it->c_str();
@@ -372,7 +373,18 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
+ cmSystemTools::RelativePath(top.c_str(), gfit->c_str());
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Copy file: "
<< inFile.c_str() << " -> " << filePath.c_str() << std::endl);
- if ( !cmSystemTools::CopyFileIfDifferent(inFile.c_str(),
+ /* If the file is a symlink we will have to re-create it */
+ if ( cmSystemTools::FileIsSymlink(inFile.c_str()))
+ {
+ std::string targetFile;
+ std::string inFileRelative =
+ cmSystemTools::RelativePath(top.c_str(),inFile.c_str());
+ cmSystemTools::ReadSymlink(inFile.c_str(),targetFile);
+ symlinkedFiles.push_back(std::pair<std::string,
+ std::string>(targetFile,inFileRelative));
+ }
+ /* If it is not a symlink then do a plain copy */
+ else if ( !cmSystemTools::CopyFileIfDifferent(inFile.c_str(),
filePath.c_str()) )
{
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem copying file: "
@@ -380,6 +392,36 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
return 0;
}
}
+ /* rebuild symlinks in the installed tree */
+ if (symlinkedFiles.size()>0)
+ {
+ std::list< std::pair<std::string,std::string> >::iterator symlinkedIt;
+ std::string curDir = cmSystemTools::GetCurrentWorkingDirectory();
+ std::string goToDir = tempDir;
+ goToDir += "/"+subdir;
+ cmCPackLogger(cmCPackLog::LOG_DEBUG,
+ "Change dir to: " << goToDir <<std::endl);
+ cmSystemTools::ChangeDirectory(goToDir.c_str());
+ for (symlinkedIt=symlinkedFiles.begin();
+ symlinkedIt != symlinkedFiles.end();
+ ++symlinkedIt)
+ {
+ cmCPackLogger(cmCPackLog::LOG_DEBUG, "Will create a symlink: "
+ << symlinkedIt->second << "--> "
+ << symlinkedIt->first << std::endl);
+ if (!cmSystemTools::CreateSymlink((symlinkedIt->first).c_str(),
+ (symlinkedIt->second).c_str()))
+ {
+ cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot create symlink: "
+ << symlinkedIt->second << "--> "
+ << symlinkedIt->first << std::endl);
+ return 0;
+ }
+ }
+ cmCPackLogger(cmCPackLog::LOG_DEBUG, "Going back to: "
+ << curDir <<std::endl);
+ cmSystemTools::ChangeDirectory(curDir.c_str());
+ }
}
}
return 1;
-----------------------------------------------------------------------
Summary of changes:
Source/CPack/cmCPackGenerator.cxx | 44 ++++++++++++++++++++++++++++++++++++-
Source/kwsys/kwsysDateStamp.cmake | 2 +-
2 files changed, 44 insertions(+), 2 deletions(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list