[med-svn] [mia] 01/03: remove dependency boost::regex
Gert Wollny
gert-guest at moszumanska.debian.org
Sun Jul 24 22:47:35 UTC 2016
This is an automated email from the git hooks/post-receive script.
gert-guest pushed a commit to branch master
in repository mia.
commit e80e04365f12d05e7889a209f92f214bfad73d77
Author: Gert Wollny <gw.fossdev at gmail.com>
Date: Sun Jul 24 21:42:10 2016 +0000
remove dependency boost::regex
---
debian/changelog | 3 +-
debian/control | 7 +-
debian/patches/mia_242_remove_boost_regex.patch | 245 ++++++++++++++++++++++++
debian/patches/series | 1 +
4 files changed, 250 insertions(+), 6 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 49ec56c..b37f16c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,7 +5,8 @@ mia (2.4.2-1) UNRELEASED; urgency=medium
- rename versioned package to to 2.4
- add dependency on libjs-mathjax
- remove dependency on libtbb-dev
- * Remove all patches and correct install files
+ * Remove patches that were applied upstream
+ * Add patch to replace boost::regex by std::regex
* Add conflict for dev package
-- Gert Wollny <gw.fossdev at gmail.com> Sat, 23 Jul 2016 14:40:04 +0000
diff --git a/debian/control b/debian/control
index dfe1581..5c1801f 100644
--- a/debian/control
+++ b/debian/control
@@ -7,7 +7,6 @@ Build-Depends: cmake,
debhelper (>= 9.0.0),
libblas-dev,
libboost-filesystem-dev,
- libboost-regex-dev,
libboost-serialization-dev,
libboost-system-dev,
libboost-test-dev,
@@ -28,11 +27,11 @@ Build-Depends: cmake,
libvistaio-dev,
libxml++2.6-dev,
python-lxml
-Build-Depends-Indep:
+Build-Depends-Indep:
docbook-xsl,
doxygen,
graphviz,
- libjs-mathjax,
+ libjs-mathjax,
xsltproc
Standards-Version: 3.9.8
Vcs-Browser: https://anonscm.debian.org/cgit/debian-med/mia.git
@@ -59,8 +58,6 @@ Section: libdevel
Depends: libmia-2.4-0 (= ${binary:Version}),
libitpp-dev (>= 4.2),
libgsl-dev,
- libboost-regex-dev,
- libboost-serialization-dev,
libboost-test-dev,
libfftw3-dev,
libblas-dev,
diff --git a/debian/patches/mia_242_remove_boost_regex.patch b/debian/patches/mia_242_remove_boost_regex.patch
new file mode 100644
index 0000000..120b45a
--- /dev/null
+++ b/debian/patches/mia_242_remove_boost_regex.patch
@@ -0,0 +1,245 @@
+commit 1bf22a5ff3e137c9bf205ae966a323c9b3cc82eb
+Author: Gert Wollny <gw.fossdev at gmail.com>
+Date: Sun Jul 24 22:58:16 2016 +0200
+
+ Enable use of std::regex
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 2bd89a3..4d8d5e2 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -82,6 +82,9 @@ OPTION(ENABLE_DEBUG_MESSAGES "Enable debug and trace outputs" TRUE)
+ OPTION(ENABLE_COVERAGE "Enable code coverage tests" FALSE)
+ OPTION(DISABLE_PROGRAMS "Don't build the programs nor documentation (only for testing purposes)" FALSE)
+ OPTION(MIA_CREATE_USERDOC "Enable creation of html user documentation" TRUE)
++OPTION(MIA_USE_BOOST_REGEX "Use the boost::regex library (instead of c++11 build in) " FALSE)
++
++
+
+ INCLUDE(GNUInstallDirs)
+
+@@ -216,7 +219,12 @@ MACRO(GET_BOOST_LINKERFLAG VAR LIBNAMES)
+ SET(${VAR} "${flags}")
+ ENDMACRO(GET_BOOST_LINKERFLAG)
+
+-SET(BOOST_COMPONENTS filesystem regex unit_test_framework serialization system)
++SET(BOOST_COMPONENTS filesystem unit_test_framework serialization system)
++
++IF (MIA_USE_BOOST_REGEX)
++ SET(BOOST_COMPONENTS ${BOOST_COMPONENTS} regex)
++ENDIF()
++
+ IF (WIN32)
+ SET(BOOST_COMPONENTS ${BOOST_COMPONENTS} date_time)
+ ENDIF(WIN32)
+@@ -231,7 +239,12 @@ LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
+ ADD_DEFINITIONS(-DBOOST_ALL_DYN_LINK)
+ ADD_DEFINITIONS(-DBOOST_FILESYSTEM_VERSION=3)
+
+-SET(BOOST_DEPS ${Boost_REGEX_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY})
++IF (MIA_USE_BOOST_REGEX)
++ SET(BOOST_DEPS ${Boost_REGEX_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY})
++ELSE()
++ SET(BOOST_DEPS ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY})
++ENDIF()
++
+ SET(BOOST_UNITTEST ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
+
+ IF (WIN32 AND NOT UNIX)
+diff --git a/addons/dicom/dcm3d.cc b/addons/dicom/dcm3d.cc
+index 33f1cf8..925831d 100644
+--- a/addons/dicom/dcm3d.cc
++++ b/addons/dicom/dcm3d.cc
+@@ -26,7 +26,17 @@
+ #include <map>
+ #include <queue>
+ #include <boost/filesystem.hpp>
++
++#if __cplusplus >= 201103
++#include <regex>
++using std::regex;
++using std::regex_match;
++#else
+ #include <boost/regex.hpp>
++using boost::regex;
++using boost::regex_match;
++#endif
++
+
+ #include <mia/core/errormacro.hh>
+ #include <mia/core/file.hh>
+@@ -231,12 +241,12 @@ static void add_images(const string& fname, const string& study_id, vector<P2DIm
+
+ stringstream pattern;
+ pattern << ".*\\" << ext;
+- boost::regex pat_expr(pattern.str());
++ regex pat_expr(pattern.str());
+
+ bfs::directory_iterator di(dir);
+ bfs::directory_iterator dend;
+ while (di != dend) {
+- if (boost::regex_match(di->path().filename().string(), pat_expr) &&
++ if (regex_match(di->path().filename().string(), pat_expr) &&
+ di->path().filename().string() != fname) {
+ bfs::path f = di->path();
+ cvdebug() << "read file '" << f << "'\n";
+diff --git a/mia/core/filetools.cc b/mia/core/filetools.cc
+index aae1e3b..85e0e81 100644
+--- a/mia/core/filetools.cc
++++ b/mia/core/filetools.cc
+@@ -25,7 +25,6 @@
+ #include <boost/filesystem/path.hpp>
+ #include <boost/filesystem/operations.hpp> // includes boost/filesystem/path.hpp
+ #include <boost/filesystem/fstream.hpp> // ditto
+-#include <boost/regex.hpp>
+
+ #include <mia/core/msgstream.hh>
+ #include <mia/core/filetools.hh>
+diff --git a/mia/core/handler.cxx b/mia/core/handler.cxx
+index 6ca3fc4..92c8fcf 100644
+--- a/mia/core/handler.cxx
++++ b/mia/core/handler.cxx
+@@ -28,7 +28,6 @@
+ #include <iterator>
+ #include <climits>
+
+-#include <boost/regex.hpp>
+ #include <boost/filesystem/operations.hpp>
+
+ #include <mia/core/module.hh>
+diff --git a/mia/core/searchpath.cc b/mia/core/searchpath.cc
+index 9ddb14f..def3102 100644
+--- a/mia/core/searchpath.cc
++++ b/mia/core/searchpath.cc
+@@ -17,15 +17,24 @@
+ * along with MIA; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
++#include <mia/core/searchpath.hh>
++#include <mia/core/msgstream.hh>
++
+
+ #include <stdexcept>
+ #include <sstream>
+ #include <cstdlib>
+
+-#include <mia/core/searchpath.hh>
+-#include <mia/core/msgstream.hh>
+-
++#if __cplusplus >= 201103
++#include <regex>
++using std::regex;
++using std::regex_match;
++#else
+ #include <boost/regex.hpp>
++using boost::regex;
++using boost::regex_match;
++#endif
++
+ #include <boost/filesystem/operations.hpp>
+
+ #include <config.h>
+@@ -115,7 +124,8 @@ std::vector<PPluginModule> CPluginSearchpath::find_modules(const std::string& da
+
+ std::stringstream pattern;
+ pattern << ".*\\."<< MIA_MODULE_SUFFIX << "$";
+- boost::regex pat_expr(pattern.str());
++
++ regex pat_expr(pattern.str());
+
+ std::vector<PPluginModule> result;
+
+@@ -138,7 +148,7 @@ std::vector<PPluginModule> CPluginSearchpath::find_modules(const std::string& da
+
+ while (di != dend) {
+ cvdebug() << " candidate:'" << di->path().string() << "'";
+- if (boost::regex_match(di->path().string(), pat_expr)) {
++ if (regex_match(di->path().string(), pat_expr)) {
+ candidates.push_back(*di);
+ cverb << " add\n";
+ }else
+diff --git a/mia/core/utils.cc b/mia/core/utils.cc
+index 6903f2a..53e6027 100644
+--- a/mia/core/utils.cc
++++ b/mia/core/utils.cc
+@@ -22,10 +22,7 @@
+ #include <unistd.h>
+ #endif
+
+-#ifndef WIN32
+-#include <regex.h>
+-#include <dirent.h>
+-#else
++#ifdef WIN32
+ #include <direct.h>
+ #define getcwd _getcwd
+ #define chdir _chdir
+@@ -64,68 +61,6 @@ CCWDSaver::~CCWDSaver()
+ delete[] cwd;
+ }
+
+-#if 0
+-static bool scan_dir(const std::string& path, const std::string& pattern, std::list<std::string>& list)
+-{
+- class TFindRegExp {
+- regex_t preg;
+- public:
+- TFindRegExp(const std::string& pattern) {
+- char buf[1024];
+- int status = regcomp (&preg, pattern.c_str(), REG_EXTENDED |REG_NOSUB);
+- if (status) {
+- regerror(status, &preg, buf, 1024);
+- std::cerr << buf << std::endl;
+- }
+- }
+-
+- ~TFindRegExp() {
+- regfree(&preg);
+- }
+- bool check(const char *s) {
+- return !regexec(&preg, s,0, NULL, 0);
+- }
+- };
+-
+-
+- CCWDSaver __saver;
+-
+- if (chdir(path.c_str())) {
+- //std::cerr << path << ":" << strerror(errno) << std::endl;
+- return false;
+- }
+-
+- struct dirent **namelist;
+- int nfiles = scandir(".", &namelist, NULL , NULL);
+-
+- TFindRegExp searcher(pattern);
+- for (int i = 0; i < nfiles; i++) {
+- if (searcher.check(namelist[i]->d_name))
+- list.push_back(path + std::string("/") + std::string(namelist[i]->d_name));
+- free(namelist[i]);
+-
+- }
+- free(namelist);
+-
+- return true;
+-}
+-
+-
+-FSearchFiles::FSearchFiles(std::list<std::string>& __result, const std::string& __pattern):
+- result(__result),
+- pattern(__pattern)
+-{
+-}
+-
+-void FSearchFiles::operator()(const std::string& path) {
+- try {
+- scan_dir(path, pattern, result);
+- }
+- catch (std::exception& e) {
+- std::cerr << e.what();
+- }
+-}
+-#endif
+
+ #ifndef _GNU_SOURCE
+ // there should be an intrinsic (at least on intel)
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..7523198
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+mia_242_remove_boost_regex.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/mia.git
More information about the debian-med-commit
mailing list