diff options
author | Brad King <brad.king@kitware.com> | 2015-09-21 13:25:31 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2015-09-21 13:25:31 (GMT) |
commit | 38830fc0cabb742cf95160429cc99cdb5326cce7 (patch) | |
tree | 37b2f4d88d6ff3d4dd03e79739769591068cbeca /Source | |
parent | dd8285c6880e08e4c6cbb0e2ca1a1684df3e11d1 (diff) | |
parent | da295f450da2781e82632b6a5df29df6fbf7daad (diff) | |
download | CMake-38830fc0cabb742cf95160429cc99cdb5326cce7.zip CMake-38830fc0cabb742cf95160429cc99cdb5326cce7.tar.gz CMake-38830fc0cabb742cf95160429cc99cdb5326cce7.tar.bz2 |
Merge topic 'cpack-deb-checksum-on-symlinks'
da295f45 CPack/Deb: checksum on symlinks release notes
7c7874c8 CPackDeb: preventing md5sum on symlinks
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CPack/cmCPackDebGenerator.cxx | 29 |
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) |