[Cmake-commits] [cmake-commits] hoffman committed cmCPackArchiveGenerator.cxx 1.6 1.7

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Nov 9 09:58:06 EST 2009


Update of /cvsroot/CMake/CMake/Source/CPack
In directory public:/mounts/ram/cvs-serv23315/Source/CPack

Modified Files:
	cmCPackArchiveGenerator.cxx 
Log Message:
add better error checking and run from correct directory.


Index: cmCPackArchiveGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CPack/cmCPackArchiveGenerator.cxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -C 2 -d -r1.6 -r1.7
*** cmCPackArchiveGenerator.cxx	9 Nov 2009 01:54:13 -0000	1.6
--- cmCPackArchiveGenerator.cxx	9 Nov 2009 14:58:03 -0000	1.7
***************
*** 173,182 ****
    int res = ARCHIVE_OK;
  #define CHECK_ARCHIVE_ERROR(res, msg)           \
!    if(res != ARCHIVE_OK)\
      {\
      cmCPackLogger(cmCPackLog::LOG_ERROR, msg      \
                    << archive_error_string(a)      \
                    << "\n");                       \
-     return 0;                                     \
      }
    cmCPackLogger(cmCPackLog::LOG_DEBUG, "Toplevel: "
--- 173,183 ----
    int res = ARCHIVE_OK;
  #define CHECK_ARCHIVE_ERROR(res, msg)           \
!   if(res != ARCHIVE_OK)                         \
      {\
      cmCPackLogger(cmCPackLog::LOG_ERROR, msg      \
                    << archive_error_string(a)      \
+                   << cmSystemTools::GetLastSystemError()  \
+                   << " " << res                   \
                    << "\n");                       \
      }
    cmCPackLogger(cmCPackLog::LOG_DEBUG, "Toplevel: "
***************
*** 199,205 ****
--- 200,210 ----
    // create a new disk struct
    struct archive* disk = archive_read_disk_new();
+ #if !defined(_WIN32) || defined(__CYGWIN__)
    res = archive_read_disk_set_standard_lookup(disk);
+ #endif
    CHECK_ARCHIVE_ERROR(res, "archive_read_disk_set_standard_lookup:");
    std::vector<std::string>::const_iterator fileIt;
+   std::string dir = cmSystemTools::GetCurrentWorkingDirectory();
+   cmSystemTools::ChangeDirectory(toplevel);
    for ( fileIt = files.begin(); fileIt != files.end(); ++ fileIt )
      {
***************
*** 209,213 ****
      std::string rp = cmSystemTools::RelativePath(toplevel, fileIt->c_str());
      // Set the name of the entry to the file name
!     archive_entry_set_pathname(entry, rp.c_str());
      res = archive_read_disk_entry_from_file(disk, entry, -1, 0);
      CHECK_ARCHIVE_ERROR(res, "archive_read_disk_entry_from_file:");
--- 214,218 ----
      std::string rp = cmSystemTools::RelativePath(toplevel, fileIt->c_str());
      // Set the name of the entry to the file name
!     archive_entry_set_pathname(entry, rp.c_str());  
      res = archive_read_disk_entry_from_file(disk, entry, -1, 0);
      CHECK_ARCHIVE_ERROR(res, "archive_read_disk_entry_from_file:");
***************
*** 247,250 ****
--- 252,256 ----
      archive_entry_free(entry);
      }
+   cmSystemTools::ChangeDirectory(dir.c_str());
    // close the archive and finish the write
    archive_write_close(a);



More information about the Cmake-commits mailing list