[Cmake-commits] CMake branch, next, updated. v3.2.1-1550-g58bbc94

Nils Gladitz nilsgladitz at gmail.com
Tue Apr 7 09:45:16 EDT 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  58bbc94bfd87cdd3fc15c8b08c568db5ef319f56 (commit)
       via  79cbd5015f5fb615075b7462b4ccbc9906ce9094 (commit)
       via  c9860d2d41e344f925116a985997f78773013b81 (commit)
       via  52d5a9b60ba9c375c9381c7afa7441d6dadd9742 (commit)
      from  86c4242ae6c4a91905ccf844373de94674bf02f8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=58bbc94bfd87cdd3fc15c8b08c568db5ef319f56
commit 58bbc94bfd87cdd3fc15c8b08c568db5ef319f56
Merge: 86c4242 79cbd50
Author:     Nils Gladitz <nilsgladitz at gmail.com>
AuthorDate: Tue Apr 7 09:45:15 2015 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Apr 7 09:45:15 2015 -0400

    Merge topic 'tar-write-format' into next
    
    79cbd501 CTestCoverageCollectGCOV: Write tar files intended for CDash in gnutar format
    c9860d2d cmake: Teach "-E tar" command a "--format=" option
    52d5a9b6 CMake Nightly Date Stamp


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=79cbd5015f5fb615075b7462b4ccbc9906ce9094
commit 79cbd5015f5fb615075b7462b4ccbc9906ce9094
Author:     Nils Gladitz <nilsgladitz at gmail.com>
AuthorDate: Tue Apr 7 12:41:55 2015 +0200
Commit:     Nils Gladitz <nilsgladitz at gmail.com>
CommitDate: Tue Apr 7 15:43:28 2015 +0200

    CTestCoverageCollectGCOV: Write tar files intended for CDash in gnutar format
    
    PHP's PharData can not currently (PHP 5.6.4) extract paxr tar archives
    with long filenames.

diff --git a/Modules/CTestCoverageCollectGCOV.cmake b/Modules/CTestCoverageCollectGCOV.cmake
index 8659a69..6c74cf3 100644
--- a/Modules/CTestCoverageCollectGCOV.cmake
+++ b/Modules/CTestCoverageCollectGCOV.cmake
@@ -198,6 +198,7 @@ ${label_files}
   execute_process(COMMAND
     ${CMAKE_COMMAND} -E tar ${tar_opts} ${GCOV_TARBALL}
     "--mtime=1970-01-01 0:0:0 UTC"
+    "--format=gnutar"
     --files-from=${coverage_dir}/coverage_file_list.txt
     WORKING_DIRECTORY ${binary_dir})
 endfunction()

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c9860d2d41e344f925116a985997f78773013b81
commit c9860d2d41e344f925116a985997f78773013b81
Author:     Nils Gladitz <nilsgladitz at gmail.com>
AuthorDate: Tue Apr 7 12:36:52 2015 +0200
Commit:     Nils Gladitz <nilsgladitz at gmail.com>
CommitDate: Tue Apr 7 15:43:28 2015 +0200

    cmake: Teach "-E tar" command a "--format=" option
    
    Allows specifying a libarchive defined archive format currently restricted to
    7zip, gnutar, pax, paxr and zip.
    
    The default is "paxr" (pax restricted).

diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst
index da41bbb..b2f7e9d 100644
--- a/Help/manual/cmake.1.rst
+++ b/Help/manual/cmake.1.rst
@@ -215,6 +215,10 @@ Available commands are:
     names start in ``-``.
   ``--mtime=<date>``
     Specify modification time recorded in tarball entries.
+  ``--format=<format>``
+    Specify the format of the archive to be created.
+    Supported formats are: ``7zip``, ``gnutar``, ``pax``,
+    ``paxr`` (restricted pax, default), and ``zip``.
 
 ``time <command> [<args>...]``
   Run command and return elapsed time.
diff --git a/Help/release/dev/tar-write-format.rst b/Help/release/dev/tar-write-format.rst
new file mode 100644
index 0000000..004df21
--- /dev/null
+++ b/Help/release/dev/tar-write-format.rst
@@ -0,0 +1,6 @@
+tar-write-format
+----------------
+
+* The :manual:`cmake(1)` ``-E tar`` command learned a new
+  ``--format<format>`` option to specify the archive format to
+  be written.
diff --git a/Source/CPack/cmCPack7zGenerator.cxx b/Source/CPack/cmCPack7zGenerator.cxx
index ce31ad4..2809e56 100644
--- a/Source/CPack/cmCPack7zGenerator.cxx
+++ b/Source/CPack/cmCPack7zGenerator.cxx
@@ -15,7 +15,7 @@
 //----------------------------------------------------------------------
 cmCPack7zGenerator::cmCPack7zGenerator()
   :cmCPackArchiveGenerator(cmArchiveWrite::CompressNone,
-                           cmArchiveWrite::Type7Zip)
+                           "7zip")
 {
 }
 
diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx
index 05b5cd9..58bd947 100644
--- a/Source/CPack/cmCPackArchiveGenerator.cxx
+++ b/Source/CPack/cmCPackArchiveGenerator.cxx
@@ -27,10 +27,10 @@
 
 //----------------------------------------------------------------------
 cmCPackArchiveGenerator::cmCPackArchiveGenerator(cmArchiveWrite::Compress t,
-  cmArchiveWrite::Type at)
+  std::string const& format)
 {
   this->Compress = t;
-  this->Archive = at;
+  this->ArchiveFormat = format;
 }
 
 //----------------------------------------------------------------------
@@ -108,7 +108,7 @@ if (!GenerateHeader(&gf)) \
             << ">." << std::endl); \
     return 0; \
   } \
-cmArchiveWrite archive(gf,this->Compress, this->Archive); \
+cmArchiveWrite archive(gf,this->Compress, this->ArchiveFormat); \
 if (!archive) \
   { \
   cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem to create archive < " \
diff --git a/Source/CPack/cmCPackArchiveGenerator.h b/Source/CPack/cmCPackArchiveGenerator.h
index 6411b1e..16e7632 100644
--- a/Source/CPack/cmCPackArchiveGenerator.h
+++ b/Source/CPack/cmCPackArchiveGenerator.h
@@ -31,7 +31,7 @@ public:
   /**
    * Construct generator
    */
-  cmCPackArchiveGenerator(cmArchiveWrite::Compress, cmArchiveWrite::Type);
+  cmCPackArchiveGenerator(cmArchiveWrite::Compress, std::string const& format);
   virtual ~cmCPackArchiveGenerator();
   // Used to add a header to the archive
   virtual int GenerateHeader(std::ostream* os);
@@ -68,7 +68,7 @@ protected:
   int PackageComponentsAllInOne();
   virtual const char* GetOutputExtension() = 0;
   cmArchiveWrite::Compress Compress;
-  cmArchiveWrite::Type Archive;
+  std::string ArchiveFormat;
   };
 
 #endif
diff --git a/Source/CPack/cmCPackTGZGenerator.cxx b/Source/CPack/cmCPackTGZGenerator.cxx
index 509c7f8..3fa2b64 100644
--- a/Source/CPack/cmCPackTGZGenerator.cxx
+++ b/Source/CPack/cmCPackTGZGenerator.cxx
@@ -15,7 +15,7 @@
 //----------------------------------------------------------------------
 cmCPackTGZGenerator::cmCPackTGZGenerator()
   :cmCPackArchiveGenerator(cmArchiveWrite::CompressGZip,
-                           cmArchiveWrite::TypeTAR)
+                           "paxr")
 {
 }
 
diff --git a/Source/CPack/cmCPackTXZGenerator.cxx b/Source/CPack/cmCPackTXZGenerator.cxx
index ecfc177..6d4ede1 100644
--- a/Source/CPack/cmCPackTXZGenerator.cxx
+++ b/Source/CPack/cmCPackTXZGenerator.cxx
@@ -15,7 +15,7 @@
 //----------------------------------------------------------------------
 cmCPackTXZGenerator::cmCPackTXZGenerator()
   :cmCPackArchiveGenerator(cmArchiveWrite::CompressXZ,
-                           cmArchiveWrite::TypeTAR)
+                           "paxr")
 {
 }
 
diff --git a/Source/CPack/cmCPackTarBZip2Generator.cxx b/Source/CPack/cmCPackTarBZip2Generator.cxx
index ae73c37..9ff588b 100644
--- a/Source/CPack/cmCPackTarBZip2Generator.cxx
+++ b/Source/CPack/cmCPackTarBZip2Generator.cxx
@@ -14,7 +14,7 @@
 //----------------------------------------------------------------------
 cmCPackTarBZip2Generator::cmCPackTarBZip2Generator()
  :cmCPackArchiveGenerator(cmArchiveWrite::CompressBZip2,
-                          cmArchiveWrite::TypeTAR)
+                          "paxr")
 {
 }
 
diff --git a/Source/CPack/cmCPackTarCompressGenerator.cxx b/Source/CPack/cmCPackTarCompressGenerator.cxx
index df29408..1c8311b 100644
--- a/Source/CPack/cmCPackTarCompressGenerator.cxx
+++ b/Source/CPack/cmCPackTarCompressGenerator.cxx
@@ -15,7 +15,7 @@
 //----------------------------------------------------------------------
 cmCPackTarCompressGenerator::cmCPackTarCompressGenerator()
   :cmCPackArchiveGenerator(cmArchiveWrite::CompressCompress,
-                           cmArchiveWrite::TypeTAR)
+                           "paxr")
 {
 }
 
diff --git a/Source/CPack/cmCPackZIPGenerator.cxx b/Source/CPack/cmCPackZIPGenerator.cxx
index e6e4e77..7ef7729 100644
--- a/Source/CPack/cmCPackZIPGenerator.cxx
+++ b/Source/CPack/cmCPackZIPGenerator.cxx
@@ -15,7 +15,7 @@
 //----------------------------------------------------------------------
 cmCPackZIPGenerator::cmCPackZIPGenerator()
   :cmCPackArchiveGenerator(cmArchiveWrite::CompressNone,
-                           cmArchiveWrite::TypeZIP)
+                           "zip")
 {
 }
 
diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx
index cf2fe82..72818f5 100644
--- a/Source/cmArchiveWrite.cxx
+++ b/Source/cmArchiveWrite.cxx
@@ -79,11 +79,12 @@ struct cmArchiveWrite::Callback
 };
 
 //----------------------------------------------------------------------------
-cmArchiveWrite::cmArchiveWrite(std::ostream& os, Compress c, Type t):
-  Stream(os),
-  Archive(archive_write_new()),
-  Disk(archive_read_disk_new()),
-  Verbose(false)
+cmArchiveWrite::cmArchiveWrite(
+  std::ostream& os, Compress c, std::string const& format):
+    Stream(os),
+    Archive(archive_write_new()),
+    Disk(archive_read_disk_new()),
+    Verbose(false)
 {
   switch (c)
     {
@@ -141,35 +142,16 @@ cmArchiveWrite::cmArchiveWrite(std::ostream& os, Compress c, Type t):
     {
     this->Error = "archive_read_disk_set_standard_lookup: ";
     this->Error += cm_archive_error_string(this->Archive);
-    return;;
+    return;
     }
 #endif
-  switch (t)
+
+  if(archive_write_set_format_by_name(this->Archive, format.c_str())
+    != ARCHIVE_OK)
     {
-    case TypeZIP:
-      if(archive_write_set_format_zip(this->Archive) != ARCHIVE_OK)
-        {
-        this->Error = "archive_write_set_format_zip: ";
-        this->Error += cm_archive_error_string(this->Archive);
-        return;
-        }
-      break;
-    case TypeTAR:
-      if(archive_write_set_format_pax_restricted(this->Archive) != ARCHIVE_OK)
-        {
-        this->Error = "archive_write_set_format_pax_restricted: ";
-        this->Error += cm_archive_error_string(this->Archive);
-        return;
-        }
-      break;
-    case Type7Zip:
-      if(archive_write_set_format_7zip(this->Archive) != ARCHIVE_OK)
-        {
-        this->Error = "archive_write_set_format_7zip: ";
-        this->Error += cm_archive_error_string(this->Archive);
-        return;
-        }
-      break;
+    this->Error = "archive_write_set_format_by_name: ";
+    this->Error += cm_archive_error_string(this->Archive);
+    return;
     }
 
   // do not pad the last block!!
diff --git a/Source/cmArchiveWrite.h b/Source/cmArchiveWrite.h
index 17357b4..794cb28 100644
--- a/Source/cmArchiveWrite.h
+++ b/Source/cmArchiveWrite.h
@@ -38,16 +38,10 @@ public:
     CompressXZ
   };
 
-  /** Archive Type */
-  enum Type
-  {
-    TypeTAR,
-    TypeZIP,
-    Type7Zip
-  };
-
   /** Construct with output stream to which to write archive.  */
-  cmArchiveWrite(std::ostream& os, Compress c = CompressNone, Type = TypeTAR);
+  cmArchiveWrite(std::ostream& os, Compress c = CompressNone,
+    std::string const& format = "paxr");
+
   ~cmArchiveWrite();
 
   /**
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 5264123..95d05a6 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -1475,7 +1475,8 @@ bool cmSystemTools::IsPathToFramework(const char* path)
 bool cmSystemTools::CreateTar(const char* outFileName,
                               const std::vector<std::string>& files,
                               cmTarCompression compressType,
-                              bool verbose, std::string const& mtime)
+                              bool verbose, std::string const& mtime,
+                              std::string const& format)
 {
 #if defined(CMAKE_BUILD_WITH_CMAKE)
   std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
@@ -1505,8 +1506,10 @@ bool cmSystemTools::CreateTar(const char* outFileName,
       compress = cmArchiveWrite::CompressNone;
       break;
     }
+
   cmArchiveWrite a(fout, compress,
-                   cmArchiveWrite::TypeTAR);
+    format.empty() ? "paxr" : format);
+
   a.SetMTime(mtime);
   a.SetVerbose(verbose);
   for(std::vector<std::string>::const_iterator i = files.begin();
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index c59ae96..433ef46 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -395,7 +395,8 @@ public:
   static bool CreateTar(const char* outFileName,
                         const std::vector<std::string>& files,
                         cmTarCompression compressType, bool verbose,
-                        std::string const& mtime = std::string());
+                        std::string const& mtime = std::string(),
+                        std::string const& format = std::string());
   static bool ExtractTar(const char* inFileName, bool verbose);
   // This should be called first thing in main
   // it will keep child processes from inheriting the
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 9f2ea46..c561e17 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -703,10 +703,20 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
     // Tar files
     else if (args[1] == "tar" && args.size() > 3)
       {
+      const char* knownFormats[] =
+        {
+        "7zip",
+        "gnutar",
+        "pax",
+        "paxr",
+        "zip"
+        };
+
       std::string flags = args[2];
       std::string outFile = args[3];
       std::vector<std::string> files;
       std::string mtime;
+      std::string format;
       bool doing_options = true;
       for (std::string::size_type cc = 4; cc < args.size(); cc ++)
         {
@@ -729,6 +739,19 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
               return 1;
               }
             }
+          else if (cmHasLiteralPrefix(arg, "--format="))
+            {
+            format = arg.substr(9);
+            bool isKnown = std::find(cmArrayBegin(knownFormats),
+              cmArrayEnd(knownFormats), format) != cmArrayEnd(knownFormats);
+
+            if(!isKnown)
+              {
+              cmSystemTools::Error("Unknown -E tar --format= argument: ",
+                format.c_str());
+              return 1;
+              }
+            }
           else
             {
             cmSystemTools::Error("Unknown option to -E tar: ", arg.c_str());
@@ -781,7 +804,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
       else if ( flags.find_first_of('c') != flags.npos )
         {
         if ( !cmSystemTools::CreateTar(
-               outFile.c_str(), files, compress, verbose, mtime) )
+               outFile.c_str(), files, compress, verbose, mtime, format) )
           {
           cmSystemTools::Error("Problem creating tar: ", outFile.c_str());
           return 1;
diff --git a/Tests/RunCMake/CommandLine/E_tar-bad-format-result.txt b/Tests/RunCMake/CommandLine/E_tar-bad-format-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_tar-bad-format-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/E_tar-bad-format-stderr.txt b/Tests/RunCMake/CommandLine/E_tar-bad-format-stderr.txt
new file mode 100644
index 0000000..fe9e2dc
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_tar-bad-format-stderr.txt
@@ -0,0 +1 @@
+CMake Error: Unknown -E tar --format= argument: bad-format
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index e8b4584..e3942a8 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -10,6 +10,7 @@ run_cmake_command(E_tar-bad-from5  ${CMAKE_COMMAND} -E tar cvf bad.tar --files-f
 run_cmake_command(E_tar-end-opt1   ${CMAKE_COMMAND} -E tar cvf bad.tar -- --bad)
 run_cmake_command(E_tar-end-opt2   ${CMAKE_COMMAND} -E tar cvf bad.tar --)
 run_cmake_command(E_tar-mtime      ${CMAKE_COMMAND} -E tar cvf bad.tar "--mtime=1970-01-01 00:00:00 UTC")
+run_cmake_command(E_tar-bad-format ${CMAKE_COMMAND} -E tar cvf bad.tar "--format=bad-format")
 
 run_cmake_command(build-no-cache
   ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR})

-----------------------------------------------------------------------

Summary of changes:
 Help/manual/cmake.1.rst                            |    4 ++
 Help/release/dev/tar-write-format.rst              |    6 +++
 Modules/CTestCoverageCollectGCOV.cmake             |    1 +
 Source/CMakeVersion.cmake                          |    2 +-
 Source/CPack/cmCPack7zGenerator.cxx                |    2 +-
 Source/CPack/cmCPackArchiveGenerator.cxx           |    6 +--
 Source/CPack/cmCPackArchiveGenerator.h             |    4 +-
 Source/CPack/cmCPackTGZGenerator.cxx               |    2 +-
 Source/CPack/cmCPackTXZGenerator.cxx               |    2 +-
 Source/CPack/cmCPackTarBZip2Generator.cxx          |    2 +-
 Source/CPack/cmCPackTarCompressGenerator.cxx       |    2 +-
 Source/CPack/cmCPackZIPGenerator.cxx               |    2 +-
 Source/cmArchiveWrite.cxx                          |   44 ++++++--------------
 Source/cmArchiveWrite.h                            |   12 ++----
 Source/cmSystemTools.cxx                           |    7 +++-
 Source/cmSystemTools.h                             |    3 +-
 Source/cmcmd.cxx                                   |   25 ++++++++++-
 .../E_tar-bad-format-result.txt}                   |    0
 .../CommandLine/E_tar-bad-format-stderr.txt        |    3 +-
 Tests/RunCMake/CommandLine/RunCMakeTest.cmake      |    1 +
 20 files changed, 72 insertions(+), 58 deletions(-)
 create mode 100644 Help/release/dev/tar-write-format.rst
 copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => CommandLine/E_tar-bad-format-result.txt} (100%)
 copy Modules/Platform/Linux-PGI-Fortran.cmake => Tests/RunCMake/CommandLine/E_tar-bad-format-stderr.txt (50%)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list