summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorRaffi Enficiaud <raffi.enficiaud@mines-paris.org>2015-09-18 20:20:42 (GMT)
committerDomen Vrankar <domen.vrankar@gmail.com>2015-09-18 20:20:42 (GMT)
commit7c7874c86ef14f2866d38d5ee85709db6e71d217 (patch)
tree3d2ef67cd3c9c146976e2c93bd80a12d186aba83 /Source
parente3ace61212db5c960132ef0868f49cf05fe1c021 (diff)
downloadCMake-7c7874c86ef14f2866d38d5ee85709db6e71d217.zip
CMake-7c7874c86ef14f2866d38d5ee85709db6e71d217.tar.gz
CMake-7c7874c86ef14f2866d38d5ee85709db6e71d217.tar.bz2
CPackDeb: preventing md5sum on symlinks
- Direct call to cmSystemTools::ComputeFileMD5 - Avoiding hashing symlinks - Tests
Diffstat (limited to 'Source')
-rw-r--r--Source/CPack/cmCPackDebGenerator.cxx29
1 files changed, 16 insertions, 13 deletions
diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx
index 9402689..5cdab52 100644
--- a/Source/CPack/cmCPackDebGenerator.cxx
+++ b/Source/CPack/cmCPackDebGenerator.cxx
@@ -524,21 +524,24 @@ int cmCPackDebGenerator::createDeb()
packageFiles.begin();
fileIt != packageFiles.end(); ++ fileIt )
{
- std::string cmd = "\"";
- cmd += cmSystemTools::GetCMakeCommand();
- cmd += "\" -E md5sum \"";
- cmd += *fileIt;
- cmd += "\"";
-
- std::string output;
- int retval = -1;
- int res = cmSystemTools::RunSingleCommand(cmd.c_str(), &output, &output,
- &retval, toplevel.c_str(), this->GeneratorVerbose, 0);
- if ( !res || retval )
+ // hash only regular files
+ if( cmSystemTools::FileIsDirectory(*fileIt)
+ || cmSystemTools::FileIsSymlink(*fileIt))
{
- cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running cmake -E md5sum "
- << cmd << std::endl);
+ continue;
}
+
+ char md5sum[33];
+ if(!cmSystemTools::ComputeFileMD5(*fileIt, md5sum))
+ {
+ cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem computing the md5 of "
+ << *fileIt << std::endl);
+ }
+
+ md5sum[32] = 0;
+
+ std::string output(md5sum);
+ output += " " + *fileIt + "\n";
// debian md5sums entries are like this:
// 014f3604694729f3bf19263bac599765 usr/bin/ccmake
// thus strip the full path (with the trailing slash)