zeroc-ice (3.3.1-12) 30-icepatch2-remove-bz2.patch

Summary

 cpp/include/IcePatch2/ClientUtil.h |    1 +
 cpp/src/IcePatch2/Client.cpp       |    5 +++++
 cpp/src/IcePatch2/ClientUtil.cpp   |   15 ++++++++++-----
 3 files changed, 16 insertions(+), 5 deletions(-)

    
download this patch

Patch contents

This patch adds a --preserve flag to icepatch2client to avoid removal of
compressed files.  It could be used to setup hierarchical IcePatch2
services.

diff --git a/cpp/src/IcePatch2/Client.cpp b/cpp/src/IcePatch2/Client.cpp
index 29cd151..262e5b2 100644
diff -Nur -x '*.orig' -x '*~' zeroc-ice/cpp/include/IcePatch2/ClientUtil.h zeroc-ice.new/cpp/include/IcePatch2/ClientUtil.h
--- zeroc-ice/cpp/include/IcePatch2/ClientUtil.h	2009-03-27 09:14:00.734546020 +0100
+++ zeroc-ice.new/cpp/include/IcePatch2/ClientUtil.h	2009-10-27 16:36:25.822302484 +0100
@@ -147,6 +147,7 @@
     const bool _thorough;
     const Ice::Int _chunkSize;
     const Ice::Int _remove;
+    const bool _removeCompressed;
     const FileServerPrx _serverCompress;
     const FileServerPrx _serverNoCompress;
 
diff -Nur -x '*.orig' -x '*~' zeroc-ice/cpp/src/IcePatch2/Client.cpp zeroc-ice.new/cpp/src/IcePatch2/Client.cpp
--- zeroc-ice/cpp/src/IcePatch2/Client.cpp	2009-03-27 09:14:00.842709242 +0100
+++ zeroc-ice.new/cpp/src/IcePatch2/Client.cpp	2009-10-27 16:36:25.822302484 +0100
@@ -242,6 +242,7 @@
     opts.addOpt("h", "help");
     opts.addOpt("v", "version");
     opts.addOpt("t", "thorough");
+    opts.addOpt("p", "preserve");
     
     vector<string> args;
     try
@@ -272,6 +273,10 @@
     {
         properties->setProperty("IcePatch2.Thorough", "1");
     }
+    if(opts.isSet("preserve"))
+    {
+        properties->setProperty("IcePatch2.RemoveCompressed", "0");
+    }
 
     if(args.size() > 1)
     {
diff -Nur -x '*.orig' -x '*~' zeroc-ice/cpp/src/IcePatch2/ClientUtil.cpp zeroc-ice.new/cpp/src/IcePatch2/ClientUtil.cpp
--- zeroc-ice/cpp/src/IcePatch2/ClientUtil.cpp	2009-03-27 09:14:00.846558063 +0100
+++ zeroc-ice.new/cpp/src/IcePatch2/ClientUtil.cpp	2009-10-27 16:38:31.258250308 +0100
@@ -32,9 +32,10 @@
 {
 public:
 
-    Decompressor(const string& dataDir) :
+    Decompressor(const string& dataDir, bool removeCompressed = true) :
         _dataDir(dataDir),
-        _destroy(false)
+        _destroy(false),
+        _removeCompressed(removeCompressed)
     {
     }
 
@@ -124,7 +125,8 @@
             {
                 decompressFile(_dataDir + '/' + info.path);
                 setFileFlags(_dataDir + '/' + info.path, info);
-                remove(_dataDir + '/' + info.path + ".bz2");
+                if (_removeCompressed)
+                    remove(_dataDir + '/' + info.path + ".bz2");
             }
             catch(const string& ex)
             {
@@ -145,6 +147,7 @@
     FileInfoSeq _filesDone;
 
     bool _destroy;
+    bool _removeCompressed;
 };
 
 }
@@ -155,6 +158,7 @@
     _thorough(communicator->getProperties()->getPropertyAsInt("IcePatch2.Thorough") > 0),
     _chunkSize(communicator->getProperties()->getPropertyAsIntWithDefault("IcePatch2.ChunkSize", 100)),
     _remove(communicator->getProperties()->getPropertyAsIntWithDefault("IcePatch2.Remove", 1)),
+    _removeCompressed (communicator->getProperties()->getPropertyAsIntWithDefault("IcePatch2.RemoveCompressed", 1) > 0),
     _log(0)
 {
     PropertiesPtr properties = communicator->getProperties();
@@ -190,7 +194,8 @@
     _dataDir(simplify(dataDir)),
     _thorough(thorough),
     _chunkSize(chunkSize),
-    _remove(remove)
+    _remove(remove),
+    _removeCompressed(true)
 {
     init(server);
 }
@@ -682,7 +687,7 @@
 bool
 IcePatch2::Patcher::updateFiles(const FileInfoSeq& files)
 {
-    DecompressorPtr decompressor = new Decompressor(_dataDir);
+    DecompressorPtr decompressor = new Decompressor(_dataDir, _removeCompressed);
 #if defined(__hppa)
     //
     // The thread stack size is only 64KB only HP-UX and that's not