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

Method generateDeb

Source/CPack/cmCPackDebGenerator.cxx:476–518  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

474}
475
476bool DebGenerator::generateDeb() const
477{
478 // ar -r your-package-name.deb debian-binary control.tar.* data.tar.*
479 // A debian package .deb is simply an 'ar' archive. The only subtle
480 // difference is that debian uses the BSD ar style archive whereas most
481 // Linux distro have a GNU ar.
482 // See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=161593 for more info
483 std::string const outputPath = this->TopLevelDir + "/" + this->OutputName;
484 std::string const tlDir = this->WorkDir + "/";
485 cmGeneratedFileStream debStream;
486 debStream.Open(outputPath, false, true);
487 cmArchiveWrite deb(debStream, cmArchiveWrite::CompressNone, "arbsd");
488 if (!deb.Open()) {
489 cmCPackLogger(cmCPackLog::LOG_ERROR,
490 "Error opening the archive \""
491 << outputPath << "\", ERROR = " << deb.GetError()
492 << std::endl);
493 return false;
494 }
495
496 // uid/gid should be the one of the root user, and this root user has
497 // always uid/gid equal to 0.
498 deb.SetUIDAndGID(0u, 0u);
499 deb.SetUNAMEAndGNAME("root", "root");
500
501 if (!deb.Add(tlDir + "debian-binary", tlDir.length()) ||
502 !deb.Add(tlDir + "control.tar" + this->CompressionSuffix,
503 tlDir.length()) ||
504 !deb.Add(tlDir + "data.tar" + this->CompressionSuffix, tlDir.length())) {
505 cmCPackLogger(cmCPackLog::LOG_ERROR,
506 "Error creating debian package:\n"
507 "#top level directory: "
508 << this->TopLevelDir
509 << "\n"
510 "#file: "
511 << this->OutputName
512 << "\n"
513 "#error:"
514 << deb.GetError() << std::endl);
515 return false;
516 }
517 return true;
518}
519
520std::vector<std::string> findFilesIn(std::string const& path)
521{

Callers 1

generateMethod · 0.95

Calls 6

SetUIDAndGIDMethod · 0.80
SetUNAMEAndGNAMEMethod · 0.80
lengthMethod · 0.80
OpenMethod · 0.45
GetErrorMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected