[Cmake-commits] [cmake-commits] hoffman committed cmCPackArchiveGenerator.cxx 1.2 1.3 cmCPackCygwinBinaryGenerator.cxx 1.6 1.7 cmCPackCygwinSourceGenerator.cxx 1.6 1.7
cmake-commits at cmake.org
cmake-commits at cmake.org
Tue Nov 3 09:41:00 EST 2009
Update of /cvsroot/CMake/CMake/Source/CPack
In directory public:/mounts/ram/cvs-serv30658
Modified Files:
cmCPackArchiveGenerator.cxx cmCPackCygwinBinaryGenerator.cxx
cmCPackCygwinSourceGenerator.cxx
Log Message:
Fix cygwin package stuff to work with libarchive
Index: cmCPackCygwinBinaryGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CPack/cmCPackCygwinBinaryGenerator.cxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -C 2 -d -r1.6 -r1.7
*** cmCPackCygwinBinaryGenerator.cxx 28 Sep 2009 15:42:50 -0000 1.6
--- cmCPackCygwinBinaryGenerator.cxx 3 Nov 2009 14:40:57 -0000 1.7
***************
*** 26,30 ****
cmCPackCygwinBinaryGenerator::cmCPackCygwinBinaryGenerator()
{
- this->Compress = false;
}
--- 26,29 ----
***************
*** 39,54 ****
this->SetOptionIfNotSet("CPACK_PACKAGING_INSTALL_PREFIX", "/usr");
this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "0");
- std::vector<std::string> path;
- std::string pkgPath = cmSystemTools::FindProgram("bzip2", path, false);
- if ( pkgPath.empty() )
- {
- cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find BZip2" << std::endl);
- return 0;
- }
- this->SetOptionIfNotSet("CPACK_INSTALLER_PROGRAM", pkgPath.c_str());
- cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Found Compress program: "
- << pkgPath.c_str()
- << std::endl);
-
return this->Superclass::InitializeInternal();
}
--- 38,41 ----
***************
*** 86,89 ****
--- 73,77 ----
std::vector<std::string> filesWithManifest = files;
filesWithManifest.push_back(manifestFile);
+
// create the bzip2 tar file
return this->Superclass::CompressFiles(outFileName, toplevel,
Index: cmCPackCygwinSourceGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CPack/cmCPackCygwinSourceGenerator.cxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -C 2 -d -r1.6 -r1.7
*** cmCPackCygwinSourceGenerator.cxx 28 Sep 2009 15:42:50 -0000 1.6
--- cmCPackCygwinSourceGenerator.cxx 3 Nov 2009 14:40:57 -0000 1.7
***************
*** 34,38 ****
cmCPackCygwinSourceGenerator::cmCPackCygwinSourceGenerator()
{
- this->Compress = false;
}
--- 34,37 ----
***************
*** 46,61 ****
{
this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "0");
- std::vector<std::string> path;
- std::string pkgPath = cmSystemTools::FindProgram("bzip2", path, false);
- if ( pkgPath.empty() )
- {
- cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find BZip2" << std::endl);
- return 0;
- }
- this->SetOptionIfNotSet("CPACK_INSTALLER_PROGRAM", pkgPath.c_str());
- cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Found Compress program: "
- << pkgPath.c_str()
- << std::endl);
-
return this->Superclass::InitializeInternal();
}
--- 45,48 ----
***************
*** 68,91 ****
std::string packageDirFileName
= this->GetOption("CPACK_TEMPORARY_DIRECTORY");
! packageDirFileName += ".tar";
std::string output;
! // skip one parent up to the cmCPackTGZGenerator to create tar file
! this->Compress = false; // just create tar not tar.gz
! if ( !this->cmCPackTGZGenerator::CompressFiles(packageDirFileName.c_str(),
toplevel, files) )
{
return 0;
}
- // Now bzip2 the source tar file
- if(!this->BZip2File(packageDirFileName.c_str()))
- {
- cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running BZip2 on file: "
- << packageDirFileName.c_str());
- return 0;
- }
// Now create a tar file that contains the above .tar.bz2 file
// and the CPACK_CYGWIN_PATCH_FILE and CPACK_TOPLEVEL_DIRECTORY
// files
! std::string compressOutFile = packageDirFileName + ".bz2";
// at this point compressOutFile is the full path to
// _CPack_Package/.../package-2.5.0.tar.bz2
--- 55,74 ----
std::string packageDirFileName
= this->GetOption("CPACK_TEMPORARY_DIRECTORY");
! packageDirFileName += ".tar.bz2";
std::string output;
! // skip one parent up to the cmCPackTarBZip2Generator
! // to create tar.bz2 file with the list of source
! // files
! this->Compress = BZIP2;
! if ( !this->cmCPackTarBZip2Generator::
! CompressFiles(packageDirFileName.c_str(),
toplevel, files) )
{
return 0;
}
// Now create a tar file that contains the above .tar.bz2 file
// and the CPACK_CYGWIN_PATCH_FILE and CPACK_TOPLEVEL_DIRECTORY
// files
! std::string compressOutFile = packageDirFileName;
// at this point compressOutFile is the full path to
// _CPack_Package/.../package-2.5.0.tar.bz2
***************
*** 96,100 ****
--- 79,93 ----
// _CPack_Package/.../package-2.5.0.tar.bz2
// the -1 is CPACK_CYGWIN_PATCH_NUMBER
+
+ // first copy the patch file and the .sh file
+ // to the toplevel cpack temp dir
+
// copy the patch file into place
+ if(!this->GetOption("CPACK_CYGWIN_PATCH_FILE"))
+ {
+ cmCPackLogger(cmCPackLog::LOG_ERROR,
+ "No patch file specified for cygwin sources.");
+ return 0;
+ }
if(!cmSystemTools::CopyFileAlways(
this->GetOption("CPACK_CYGWIN_PATCH_FILE"),
***************
*** 106,109 ****
--- 99,108 ----
return 0;
}
+ if(!this->GetOption("CPACK_CYGWIN_BUILD_SCRIPT"))
+ {
+ cmCPackLogger(cmCPackLog::LOG_ERROR,
+ "No build script specified for cygwin sources.");
+ return 0;
+ }
// copy the build script into place
if(!cmSystemTools::CopyFileAlways(
***************
*** 116,120 ****
return 0;
}
- // create the tar file
std::string outerTarFile
= this->GetOption("CPACK_TEMPORARY_DIRECTORY");
--- 115,118 ----
***************
*** 128,139 ****
}
outerTarFile += patch;
! outerTarFile += "-src.tar";
! std::string buildScript = cmSystemTools::GetFilenameName(
this->GetOption("CPACK_CYGWIN_BUILD_SCRIPT"));
! std::string patchFile = cmSystemTools::GetFilenameName(
this->GetOption("CPACK_CYGWIN_PATCH_FILE"));
! std::vector<cmStdString> outerFiles;
std::string file = cmSystemTools::GetFilenameName(compressOutFile);
! std::string path = cmSystemTools::GetFilenamePath(compressOutFile);
// a source release in cygwin should have the build script used
// to build the package, the patch file that is different from the
--- 126,144 ----
}
outerTarFile += patch;
! outerTarFile += "-src.tar.bz2";
! std::string tmpDir = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
! std::string buildScript = tmpDir;
! buildScript += "/";
! buildScript += cmSystemTools::GetFilenameName(
this->GetOption("CPACK_CYGWIN_BUILD_SCRIPT"));
! std::string patchFile = tmpDir;
! patchFile += "/";
! patchFile += cmSystemTools::GetFilenameName(
this->GetOption("CPACK_CYGWIN_PATCH_FILE"));
! std::vector<std::string> outerFiles;
std::string file = cmSystemTools::GetFilenameName(compressOutFile);
! std::string sourceTar = cmSystemTools::GetFilenamePath(compressOutFile);
! sourceTar += "/";
! sourceTar += file;
// a source release in cygwin should have the build script used
// to build the package, the patch file that is different from the
***************
*** 142,169 ****
outerFiles.push_back(buildScript);
outerFiles.push_back(patchFile);
! outerFiles.push_back(file);
! std::string saveDir= cmSystemTools::GetCurrentWorkingDirectory();
! cmSystemTools::ChangeDirectory(path.c_str());
! cmSystemTools::CreateTar(outerTarFile.c_str(),
! outerFiles, false, false);
! cmSystemTools::ChangeDirectory(saveDir.c_str());
! // now compress the outer tar file
! if(!this->BZip2File(outerTarFile.c_str()))
{
return 0;
}
- compressOutFile = outerTarFile;
- compressOutFile += ".bz2";
- // now rename the file to its final name
- if ( !cmSystemTools::SameFile(compressOutFile.c_str(), outFileName ) )
- {
- if ( !this->RenameFile(compressOutFile.c_str(), outFileName) )
- {
- cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem renaming: \""
- << compressOutFile.c_str() << "\" to \""
- << (outFileName ? outFileName : "(NULL)") << std::endl);
- return 0;
- }
- }
return 1;
}
--- 147,157 ----
outerFiles.push_back(buildScript);
outerFiles.push_back(patchFile);
! outerFiles.push_back(sourceTar);
! if ( !this->cmCPackTarBZip2Generator::
! CompressFiles(outerTarFile.c_str(),
! tmpDir.c_str(), outerFiles) )
{
return 0;
}
return 1;
}
Index: cmCPackArchiveGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CPack/cmCPackArchiveGenerator.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -C 2 -d -r1.2 -r1.3
*** cmCPackArchiveGenerator.cxx 2 Nov 2009 14:20:53 -0000 1.2
--- cmCPackArchiveGenerator.cxx 3 Nov 2009 14:40:57 -0000 1.3
***************
*** 50,55 ****
cmCPackArchiveGenerator::ArchiveType at)
{
- // pick a compression type
int res;
switch(ct)
{
--- 50,72 ----
cmCPackArchiveGenerator::ArchiveType at)
{
int res;
+ // pick the archive type
+ switch(at)
+ {
+ case cmCPackArchiveGenerator::TAR:
+ // maybe this:
+ //res = archive_write_set_format_pax(a);
+ res = archive_write_set_format_ustar(a); // is this what we want?
+ break;
+ case cmCPackArchiveGenerator::ZIP:
+ res = archive_write_set_format_zip(a);
+ break;
+ }
+ if(res != ARCHIVE_OK)
+ {
+ return false;
+ }
+
+ // pick a compression type
switch(ct)
{
***************
*** 69,93 ****
default:
res = archive_write_set_compression_none(a);
! }
if(res != ARCHIVE_OK)
{
return false;
}
! // pick the archive type
! switch(at)
! {
! case cmCPackArchiveGenerator::TAR:
! // maybe this:
! // archive_write_set_format_pax(a);
! res = archive_write_set_format_ustar(a); // is this what we want?
! break;
! case cmCPackArchiveGenerator::ZIP:
! res = archive_write_set_format_zip(a);
! break;
! }
if(res != ARCHIVE_OK)
{
return false;
}
return true;
}
--- 86,101 ----
default:
res = archive_write_set_compression_none(a);
! }
if(res != ARCHIVE_OK)
{
return false;
}
! // do not pad the last block!!
! res = archive_write_set_bytes_in_last_block(a, 1);
if(res != ARCHIVE_OK)
{
return false;
}
+
return true;
}
***************
*** 202,206 ****
{
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem with fopen(): "
! << file
<< strerror(errno)
<< std::endl);
--- 210,214 ----
{
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem with fopen(): "
! << fileIt->c_str()
<< strerror(errno)
<< std::endl);
More information about the Cmake-commits
mailing list