This is an automated email from the git hooks/post-receive script.

paulnovo-guest pushed a commit to branch master
in repository opensurgsim.

commit 74ece8b3293cb5f2126c5685126e70d73c877682
Author: Paul Novotny <[email protected]>
Date:   Thu Feb 19 17:09:35 2015 -0500

    Use packaged yaml-cpp
    
    Instead of downloading and building a patched version of yaml-cpp during
    the build process, add yaml-cpp as a build-dep and use the version in
    the repository.
    
    This required a couple of patches, one to use yaml-cpp enum for flow
    style, instead of the one introduced by OpenSurgSim's forked version of
    yaml-cpp. Also, backport a commit from OpenSurgSim to fix unit tests
    that were failing with this version of yaml-cpp.
---
 CMakeLists.txt                          |  2 +-
 debian/control                          |  3 +-
 debian/patches/backport-03c10f32d.patch | 95 +++++++++++++++++++++++++++++++++
 debian/patches/series                   |  2 +
 debian/patches/yaml-flow.patch          | 20 +++++++
 debian/rules                            |  3 +-
 6 files changed, 122 insertions(+), 3 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 875d89d..9a99c9e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -87,7 +87,7 @@ endif()
 
 option(USE_SYSTEM_YAMLCPP "Should we use the system yaml-cpp?" OFF)
 if(USE_SYSTEM_YAMLCPP)
-       find_package(yaml-cpp 0.5.1.2 EXACT REQUIRED)
+       find_package(yaml-cpp 0.5.1 EXACT REQUIRED)
 else(USE_SYSTEM_YAMLCPP)
        include(External_yamlcpp)
 endif(USE_SYSTEM_YAMLCPP)
diff --git a/debian/control b/debian/control
index 2356bfb..4b381a8 100644
--- a/debian/control
+++ b/debian/control
@@ -5,7 +5,8 @@ Maintainer: Debian Med Packaging Team 
<[email protected].
 Uploaders: Paul Novotny <[email protected]>
 Build-Depends: debhelper (>= 9), libboost-chrono-dev, libboost-date-time-dev,
  libboost-filesystem-dev, libboost-system-dev, libboost-thread-dev, cmake,
- doxygen, libeigen3-dev, google-mock, libjs-mathjax, libopenscenegraph-dev
+ doxygen, libeigen3-dev, google-mock, libjs-mathjax, libopenscenegraph-dev,
+ libyaml-cpp-dev (>= 0.5.1+hg20150210-1)
 Standards-Version: 3.9.6
 Homepage: http://www.opensurgsim.org/
 Vcs-Browser: http://anonscm.debian.org/gitweb/?p=debian-med/opensurgsim.git
diff --git a/debian/patches/backport-03c10f32d.patch 
b/debian/patches/backport-03c10f32d.patch
new file mode 100644
index 0000000..106ccf4
--- /dev/null
+++ b/debian/patches/backport-03c10f32d.patch
@@ -0,0 +1,95 @@
+--- a/SurgSim/Framework/Accessible.cpp
++++ b/SurgSim/Framework/Accessible.cpp
+@@ -13,7 +13,9 @@
+ // See the License for the specific language governing permissions and
+ // limitations under the License.
+ 
++#include <algorithm>
+ #include "SurgSim/Framework/Accessible.h"
++#include "SurgSim/Framework/Log.h"
+ #include "SurgSim/Math/Matrix.h"
+ 
+ namespace SurgSim
+@@ -136,26 +138,43 @@
+       return result;
+ }
+ 
+-void  Accessible::decode(const YAML::Node& node)
++void Accessible::decode(const YAML::Node& node, const 
std::vector<std::string>& ignoredProperties)
+ {
+-      SURGSIM_ASSERT(node.IsMap()) << "Node to decode accessible has to be 
map.";
+-      for (auto functors = m_functors.cbegin(); functors != 
m_functors.cend(); ++functors)
++      SURGSIM_ASSERT(node.IsMap()) << "Node to be decoded has to be map.";
++
++      for (auto data = node.begin(); data != node.end(); ++data)
+       {
+-              auto decoder = functors->second.decoder;
+-              if (decoder != nullptr)
++              std::string name = data->first.as<std::string>();
++              if (std::find(std::begin(ignoredProperties), 
std::end(ignoredProperties), name) != std::end(ignoredProperties))
++              {
++                      continue;
++              }
++
++              auto functors = m_functors.find(name);
++              if (functors == std::end(m_functors) || 
!functors->second.decoder)
+               {
+-                      YAML::Node temporary = node[functors->first];
++                      
SURGSIM_LOG_WARNING(SurgSim::Framework::Logger::getLogger("Framework/Accessible"))
++                              << "No decoder registered for the property " << 
name;
++              }
++              else
++              {
++                      YAML::Node temporary = data->second;
+                       if (!temporary.IsNull() && temporary.IsDefined())
+                       {
+                               try
+                               {
+-                                      decoder(&temporary);
++                                      functors->second.decoder(&temporary);
+                               }
+                               catch (std::exception e)
+                               {
+                                       SURGSIM_FAILURE() << e.what();
+                               }
+                       }
++                      else
++                      {
++                              
SURGSIM_LOG_INFO(SurgSim::Framework::Logger::getLogger("Framework/Accessible"))
++                                      << "No value associated with property " 
<< name;
++                      }
+               }
+       }
+ }
+--- a/SurgSim/Framework/Accessible.h
++++ b/SurgSim/Framework/Accessible.h
+@@ -140,9 +140,10 @@
+       /// Decode this Accessible from a YAML::Node, will throw an exception 
if the data type cannot
+       /// be converted.
+       /// \throws SurgSim::Framework::AssertionFailure if node is not of 
YAML::NodeType::Map.
+-      /// \param node The node that carries the data to be, properties with 
names that don't
+-      ///             match up with properties in the Accessible are ignored
+-      void decode(const YAML::Node& node);
++      /// \param node The node that carries the data to be decoded, 
properties with names that don't
++      ///             match up with properties in the Accessible will be 
reported.
++      /// \param ignoredProperties Properties that will be ignored.
++      void decode(const YAML::Node& node, const std::vector<std::string>& 
ignoredProperties = std::vector<std::string>());
+ 
+ private:
+ 
+--- a/SurgSim/Framework/FrameworkConvert.cpp
++++ b/SurgSim/Framework/FrameworkConvert.cpp
+@@ -91,7 +91,12 @@
+                               }
+                       }
+               }
+-              rhs->decode(data);
++
++              std::vector<std::string> ignoredProperties;
++              ignoredProperties.push_back(NamePropertyName);
++              ignoredProperties.push_back(IdPropertyName);
++
++              rhs->decode(data, ignoredProperties);
+               result = true;
+       }
+       return result;
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..dd2ebfb
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,2 @@
+yaml-flow.patch
+backport-03c10f32d.patch
diff --git a/debian/patches/yaml-flow.patch b/debian/patches/yaml-flow.patch
new file mode 100644
index 0000000..4a14d85
--- /dev/null
+++ b/debian/patches/yaml-flow.patch
@@ -0,0 +1,20 @@
+--- opensurgsim.orig/SurgSim/Math/MathConvert-inl.h
++++ opensurgsim/SurgSim/Math/MathConvert-inl.h
+@@ -33,7 +33,7 @@
+       const typename Eigen::Matrix<Type, Rows, 1, MOpt>& rhs)
+ {
+       Node node;
+-      node.SetStyle(YAML::FlowStyle);
++      node.SetStyle(YAML::EmitterStyle::Flow);
+       for (int i = 0; i < rhs.size(); ++i)
+       {
+               node.push_back(rhs[i]);
+@@ -75,7 +75,7 @@
+       const typename Eigen::Matrix<Type, Rows, Cols, MOpt>& rhs)
+ {
+       YAML::Node node;
+-      node.SetStyle(YAML::FlowStyle);
++      node.SetStyle(YAML::EmitterStyle::Flow);
+       for (int row = 0; row < Rows; ++row)
+       {
+               YAML::Node rowNode;
diff --git a/debian/rules b/debian/rules
index 1e142f9..b42a7c5 100755
--- a/debian/rules
+++ b/debian/rules
@@ -19,7 +19,8 @@ override_dh_auto_configure:
        -DBUILD_DOCUMENTATION:BOOL=ON \
        -DBUILD_EXAMPLES:BOOL=OFF \
        -DBUILD_SHARED_LIBS:BOOL=ON \
-       -DCTEST_CUSTOM_TESTS_IGNORE="MultiAxisDeviceTest"
+       -DCTEST_CUSTOM_TESTS_IGNORE="MultiAxisDeviceTest" \
+       -DUSE_SYSTEM_YAMLCPP:BOOL=ON
 
 override_dh_install:
        dh_install -p$(pkg_dev) --autodest usr/include/*

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/debian-med/opensurgsim.git

_______________________________________________
debian-med-commit mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-med-commit

Reply via email to