[Cmake-commits] CMake branch, next, updated. v3.1.0-1618-g76e41f6

Ben Boeckel ben.boeckel at kitware.com
Fri Jan 9 10:44:00 EST 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  76e41f6262ebabcc7e60ecd8112e09fa928e07db (commit)
       via  2072cb81f822d5ffc53f9daba83a03d8c4266207 (commit)
       via  37c5883963d6fc396a6a71081109ab1b47ead9a4 (commit)
       via  df16dcfb4478bb05932a1abb0e42433e60f1a565 (commit)
      from  2cfa421ac245f83e98783ecb677bbe69def1e1e0 (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=76e41f6262ebabcc7e60ecd8112e09fa928e07db
commit 76e41f6262ebabcc7e60ecd8112e09fa928e07db
Merge: 2cfa421 2072cb8
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Fri Jan 9 10:43:59 2015 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Jan 9 10:43:59 2015 -0500

    Merge topic 'add-xz-support' into next
    
    2072cb81 cmake -E tar: error out on multiple compression formats
    37c58839 cmSystemTools: use an enumeration for compression formats
    df16dcfb cmake -E tar: add support for .xz files with 'J'


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2072cb81f822d5ffc53f9daba83a03d8c4266207
commit 2072cb81f822d5ffc53f9daba83a03d8c4266207
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Fri Jan 9 10:33:36 2015 -0500
Commit:     Ben Boeckel <ben.boeckel at kitware.com>
CommitDate: Fri Jan 9 10:35:01 2015 -0500

    cmake -E tar: error out on multiple compression formats

diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index cf3b2de..1bfbb55 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -735,17 +735,27 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
         }
       cmSystemTools::cmTarCompression compress =
         cmSystemTools::TarCompressNone;
+      int nCompress = 0;
       if ( flags.find_first_of('j') != flags.npos )
         {
         compress = cmSystemTools::TarCompressBZip2;
+        ++nCompress;
         }
       if ( flags.find_first_of('J') != flags.npos )
         {
         compress = cmSystemTools::TarCompressXZ;
+        ++nCompress;
         }
       if ( flags.find_first_of('z') != flags.npos )
         {
         compress = cmSystemTools::TarCompressGZip;
+        ++nCompress;
+        }
+      if ( nCompress > 1 )
+        {
+        cmSystemTools::Error("Can only compress a tar file one way; "
+                             "at most one flag of z, j, or J may be used");
+        return 1;
         }
       if ( flags.find_first_of('v') != flags.npos )
         {

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=37c5883963d6fc396a6a71081109ab1b47ead9a4
commit 37c5883963d6fc396a6a71081109ab1b47ead9a4
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Fri Jan 9 10:33:00 2015 -0500
Commit:     Ben Boeckel <ben.boeckel at kitware.com>
CommitDate: Fri Jan 9 10:35:01 2015 -0500

    cmSystemTools: use an enumeration for compression formats
    
    Juggling 3 booleans was unwieldy.

diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index f02d78e..e1391a7 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -1675,7 +1675,7 @@ std::string cmCTest::Base64GzipEncodeFile(std::string file)
   files.push_back(file);
 
   if(!cmSystemTools::CreateTar(tarFile.c_str(), files,
-                               true, false, false, false))
+                               cmSystemTools::TarCompressGZip, false))
     {
     cmCTestLog(this, ERROR_MESSAGE, "Error creating tar while "
       "encoding file: " << file << std::endl);
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index cd63347..036e859 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -1482,7 +1482,7 @@ bool cmSystemTools::IsPathToFramework(const char* path)
 
 bool cmSystemTools::CreateTar(const char* outFileName,
                               const std::vector<std::string>& files,
-                              bool gzip, bool bzip2, bool xz,
+                              cmTarCompression compressType,
                               bool verbose)
 {
 #if defined(CMAKE_BUILD_WITH_CMAKE)
@@ -1497,11 +1497,24 @@ bool cmSystemTools::CreateTar(const char* outFileName,
     cmSystemTools::Error(e.c_str());
     return false;
     }
-  cmArchiveWrite a(fout, (gzip? cmArchiveWrite::CompressGZip :
-                          (bzip2? cmArchiveWrite::CompressBZip2 :
-                           (xz? cmArchiveWrite::CompressXZ :
-                           cmArchiveWrite::CompressNone))),
-                           cmArchiveWrite::TypeTAR);
+  cmArchiveWrite::Compress compress = cmArchiveWrite::CompressNone;
+  switch (compressType)
+    {
+    case TarCompressGZip:
+      compress = cmArchiveWrite::CompressGZip;
+      break;
+    case TarCompressBZip2:
+      compress = cmArchiveWrite::CompressBZip2;
+      break;
+    case TarCompressXZ:
+      compress = cmArchiveWrite::CompressXZ;
+      break;
+    case TarCompressNone:
+      compress = cmArchiveWrite::CompressNone;
+      break;
+    }
+  cmArchiveWrite a(fout, compress,
+                   cmArchiveWrite::TypeTAR);
   a.SetVerbose(verbose);
   for(std::vector<std::string>::const_iterator i = files.begin();
       i != files.end(); ++i)
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index 47d2771..ad269b1 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -383,11 +383,18 @@ public:
   static void EnableVSConsoleOutput();
 
   /** Create tar */
+  enum cmTarCompression
+  {
+    TarCompressGZip,
+    TarCompressBZip2,
+    TarCompressXZ,
+    TarCompressNone
+  };
   static bool ListTar(const char* outFileName,
                       bool gzip, bool verbose);
   static bool CreateTar(const char* outFileName,
-                        const std::vector<std::string>& files, bool gzip,
-                        bool bzip2, bool xz, bool verbose);
+                        const std::vector<std::string>& files,
+                        cmTarCompression compressType, bool verbose);
   static bool ExtractTar(const char* inFileName, bool gzip,
                          bool verbose);
   // This should be called first thing in main
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 6b3efb5..cf3b2de 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -733,21 +733,19 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
         {
         files.push_back(args[cc]);
         }
-      bool gzip = false;
-      bool bzip2 = false;
-      bool xz = false;
-      bool verbose = false;
+      cmSystemTools::cmTarCompression compress =
+        cmSystemTools::TarCompressNone;
       if ( flags.find_first_of('j') != flags.npos )
         {
-        bzip2 = true;
+        compress = cmSystemTools::TarCompressBZip2;
         }
       if ( flags.find_first_of('J') != flags.npos )
         {
-        xz = true;
+        compress = cmSystemTools::TarCompressXZ;
         }
       if ( flags.find_first_of('z') != flags.npos )
         {
-        gzip = true;
+        compress = cmSystemTools::TarCompressGZip;
         }
       if ( flags.find_first_of('v') != flags.npos )
         {
@@ -765,7 +763,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, gzip, bzip2, xz, verbose) )
+               outFile.c_str(), files, compress, verbose) )
           {
           cmSystemTools::Error("Problem creating tar: ", outFile.c_str());
           return 1;

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=df16dcfb4478bb05932a1abb0e42433e60f1a565
commit df16dcfb4478bb05932a1abb0e42433e60f1a565
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Thu Jan 8 16:56:33 2015 -0500
Commit:     Ben Boeckel <ben.boeckel at kitware.com>
CommitDate: Fri Jan 9 10:35:01 2015 -0500

    cmake -E tar: add support for .xz files with 'J'

diff --git a/Help/release/dev/add-xz-support.rst b/Help/release/dev/add-xz-support.rst
new file mode 100644
index 0000000..9bdf528
--- /dev/null
+++ b/Help/release/dev/add-xz-support.rst
@@ -0,0 +1,5 @@
+add-xz-support
+--------------
+
+* The :manual:`cmake(1)` ``-E tar`` command now supports creating
+  ``.xz``-compressed archives with the ``J`` flag.
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 80dbaf3..f02d78e 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -1674,7 +1674,8 @@ std::string cmCTest::Base64GzipEncodeFile(std::string file)
   std::vector<std::string> files;
   files.push_back(file);
 
-  if(!cmSystemTools::CreateTar(tarFile.c_str(), files, true, false, false))
+  if(!cmSystemTools::CreateTar(tarFile.c_str(), files,
+                               true, false, false, false))
     {
     cmCTestLog(this, ERROR_MESSAGE, "Error creating tar while "
       "encoding file: " << file << std::endl);
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 1c8c387..cd63347 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -1482,7 +1482,8 @@ bool cmSystemTools::IsPathToFramework(const char* path)
 
 bool cmSystemTools::CreateTar(const char* outFileName,
                               const std::vector<std::string>& files,
-                              bool gzip, bool bzip2, bool verbose)
+                              bool gzip, bool bzip2, bool xz,
+                              bool verbose)
 {
 #if defined(CMAKE_BUILD_WITH_CMAKE)
   std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
@@ -1498,7 +1499,8 @@ bool cmSystemTools::CreateTar(const char* outFileName,
     }
   cmArchiveWrite a(fout, (gzip? cmArchiveWrite::CompressGZip :
                           (bzip2? cmArchiveWrite::CompressBZip2 :
-                           cmArchiveWrite::CompressNone)),
+                           (xz? cmArchiveWrite::CompressXZ :
+                           cmArchiveWrite::CompressNone))),
                            cmArchiveWrite::TypeTAR);
   a.SetVerbose(verbose);
   for(std::vector<std::string>::const_iterator i = files.begin();
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index d49af74..47d2771 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -387,7 +387,7 @@ public:
                       bool gzip, bool verbose);
   static bool CreateTar(const char* outFileName,
                         const std::vector<std::string>& files, bool gzip,
-                        bool bzip2, bool verbose);
+                        bool bzip2, bool xz, bool verbose);
   static bool ExtractTar(const char* inFileName, bool gzip,
                          bool verbose);
   // This should be called first thing in main
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index f2f028a..6b3efb5 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -71,7 +71,7 @@ void CMakeCommandUsage(const char* program)
     << "  remove_directory dir      - remove a directory and its contents\n"
     << "  rename oldname newname    - rename a file or directory "
        "(on one volume)\n"
-    << "  tar [cxt][vf][zj] file.tar [file/dir1 file/dir2 ...]\n"
+    << "  tar [cxt][vf][zjJ] file.tar [file/dir1 file/dir2 ...]\n"
     << "                            - create or extract a tar or zip archive\n"
     << "  sleep <number>...         - sleep for given number of seconds\n"
     << "  time command [args] ...   - run command and return elapsed time\n"
@@ -735,11 +735,16 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
         }
       bool gzip = false;
       bool bzip2 = false;
+      bool xz = false;
       bool verbose = false;
       if ( flags.find_first_of('j') != flags.npos )
         {
         bzip2 = true;
         }
+      if ( flags.find_first_of('J') != flags.npos )
+        {
+        xz = true;
+        }
       if ( flags.find_first_of('z') != flags.npos )
         {
         gzip = true;
@@ -760,7 +765,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, gzip, bzip2, verbose) )
+               outFile.c_str(), files, gzip, bzip2, xz, verbose) )
           {
           cmSystemTools::Error("Problem creating tar: ", outFile.c_str());
           return 1;

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

Summary of changes:


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list