| 291 | } |
| 292 | |
| 293 | std::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 | |
| 328 | bool DebGenerator::generateControlTar(std::string const& md5Filename) const |
| 329 | { |