MCPcopy Create free account
hub / github.com/Kitware/CMake / generateMD5File

Method generateMD5File

Source/CPack/cmCPackDebGenerator.cxx:293–326  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

291}
292
293std::string DebGenerator::generateMD5File() const
294{
295 std::string md5filename = this->WorkDir + "/md5sums";
296
297 cmGeneratedFileStream out;
298 out.Open(md5filename, false, true);
299
300 std::string topLevelWithTrailingSlash = cmStrCat(this->TemporaryDir, '/');
301 for (std::string const& file : this->PackageFiles) {
302 // hash only regular files
303 if (cmSystemTools::FileIsDirectory(file) ||
304 cmSystemTools::FileIsSymlink(file)) {
305 continue;
306 }
307
308 cmCryptoHash hasher(cmCryptoHash::AlgoMD5);
309 std::string output = hasher.HashFile(file);
310 if (output.empty()) {
311 cmCPackLogger(cmCPackLog::LOG_ERROR,
312 "Problem computing the md5 of " << file << std::endl);
313 }
314
315 output += " " + file + "\n";
316 // debian md5sums entries are like this:
317 // 014f3604694729f3bf19263bac599765 usr/bin/ccmake
318 // thus strip the full path (with the trailing slash)
319 cmSystemTools::ReplaceString(output, topLevelWithTrailingSlash.c_str(),
320 "");
321 out << output;
322 }
323 // each line contains a eol.
324 // Do not end the md5sum file with yet another (invalid)
325 return md5filename;
326}
327
328bool DebGenerator::generateControlTar(std::string const& md5Filename) const
329{

Callers 1

generateMethod · 0.95

Calls 5

HashFileMethod · 0.80
c_strMethod · 0.80
cmStrCatFunction · 0.50
OpenMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected