From bde16402743aa8b03157c76e017d6e9b484a0b04 Mon Sep 17 00:00:00 2001 From: Vaclav Blazek Date: Fri, 31 Mar 2023 16:23:53 +0200 Subject: [PATCH 1/2] jammy build --- externals/vts-libs | 2 +- mapproxy/debian/compat | 2 +- mapproxy/debian/jammy/control | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 mapproxy/debian/jammy/control diff --git a/externals/vts-libs b/externals/vts-libs index 8e19c4a..d4a3754 160000 --- a/externals/vts-libs +++ b/externals/vts-libs @@ -1 +1 @@ -Subproject commit 8e19c4ab995effe8f3c03af183f23328c4c4faa5 +Subproject commit d4a37541420fb2149c038a0ff1a1f3012ba0799e diff --git a/mapproxy/debian/compat b/mapproxy/debian/compat index 7f8f011..48082f7 100644 --- a/mapproxy/debian/compat +++ b/mapproxy/debian/compat @@ -1 +1 @@ -7 +12 diff --git a/mapproxy/debian/jammy/control b/mapproxy/debian/jammy/control new file mode 100644 index 0000000..e00e2f0 --- /dev/null +++ b/mapproxy/debian/jammy/control @@ -0,0 +1,19 @@ +m4_dnl ############################################################### +m4_dnl ## Build dependencies +m4_dnl ############################################################### +m4_dnl +m4_define({{{VAR_BuildDepends}}},{{{debhelper (>= 9.20160115ubuntu3), libboost-all-dev + , libopencv-core-dev (>= 4.2) + , libopencv-highgui-dev (>= 4.2) + , libopencv-photo-dev (>= 4.2) + , libopencv-imgproc-dev (>= 4.2) + , libeigen3-dev (>= 3.1.0-1) + , libgdal-dev (>= 3.0), libproj-dev (>= 6.0) + , libopenmesh-dev (>= 8.0) + , libgeographic-dev (>= 1.45-2) + , libjsoncpp-dev (>= 1.7.2-1) + , libprotobuf-dev (>= 2.6.1) + , protobuf-compiler + , libprocps-dev (>= 3.3.12) + , libmagic-dev (>= 5.25) + , gawk}}})m4_dnl From 7cc654ba4576dea3d29839d545c5026f172a3ccb Mon Sep 17 00:00:00 2001 From: Vaclav Blazek Date: Thu, 6 Apr 2023 13:10:36 +0200 Subject: [PATCH 2/2] resource loading: reporting include (+glob) error --- externals/libutility | 2 +- mapproxy/src/mapproxy/CMakeLists.txt | 1 - mapproxy/src/mapproxy/resource.cpp | 19 +++--- mapproxy/src/mapproxy/support/glob.cpp | 83 -------------------------- mapproxy/src/mapproxy/support/glob.hpp | 46 -------------- 5 files changed, 13 insertions(+), 138 deletions(-) delete mode 100644 mapproxy/src/mapproxy/support/glob.cpp delete mode 100644 mapproxy/src/mapproxy/support/glob.hpp diff --git a/externals/libutility b/externals/libutility index 8c1b1d9..18308fe 160000 --- a/externals/libutility +++ b/externals/libutility @@ -1 +1 @@ -Subproject commit 8c1b1d9e835c8b45f5bd6c6d9e3aca8e2a8d69b7 +Subproject commit 18308fe77fde62dfcfe26b348f83b99cf026db5f diff --git a/mapproxy/src/mapproxy/CMakeLists.txt b/mapproxy/src/mapproxy/CMakeLists.txt index 4ab7b38..8778a27 100644 --- a/mapproxy/src/mapproxy/CMakeLists.txt +++ b/mapproxy/src/mapproxy/CMakeLists.txt @@ -12,7 +12,6 @@ set(mapproxy-core_SOURCES support/introspection.hpp support/introspection.cpp support/serialization.cpp support/aborter.hpp - support/glob.hpp support/glob.cpp support/tilejson.hpp support/tilejson.cpp support/cesiumconf.hpp support/cesiumconf.cpp support/wmts.hpp support/wmts.cpp diff --git a/mapproxy/src/mapproxy/resource.cpp b/mapproxy/src/mapproxy/resource.cpp index bafe95f..b5e70c6 100644 --- a/mapproxy/src/mapproxy/resource.cpp +++ b/mapproxy/src/mapproxy/resource.cpp @@ -28,6 +28,8 @@ #include "dbglog/dbglog.hpp" +#include "utility/glob.hpp" + #include "jsoncpp/json.hpp" #include "jsoncpp/as.hpp" #include "jsoncpp/io.hpp" @@ -35,8 +37,6 @@ #include "vts-libs/registry/json.hpp" #include "vts-libs/vts/tileop.hpp" -#include "support/glob.hpp" - #include "error.hpp" #include "resource.hpp" #include "generator.hpp" @@ -254,11 +254,16 @@ void parseResources(Resource::map &resources, const Json::Value &value { const auto includePath(fs::absolute(value, dir)); - auto paths(globPath(includePath)); - for (const auto &path : paths) { - // ignore directories - if (path.filename() == ".") { continue; } - includeLoad(path); + try { + for (const auto &path : utility::globPath(includePath)) { + // ignore directories + if (path.filename() == ".") { continue; } + includeLoad(path); + } + } catch (const std::exception &e) { + LOGTHROW(err3, std::runtime_error) + << "Failed to include file(s) from " << path + << ": " << e.what() << "."; } }); diff --git a/mapproxy/src/mapproxy/support/glob.cpp b/mapproxy/src/mapproxy/support/glob.cpp deleted file mode 100644 index 9f10b84..0000000 --- a/mapproxy/src/mapproxy/support/glob.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/** - * Copyright (c) 2017 Melown Technologies SE - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -#include - -#include "dbglog/dbglog.hpp" - -#include "glob.hpp" - -std::vector -globPath(const boost::filesystem::path &pattern) -{ - struct Glob { - ::glob_t g; - - Glob() { std::memset(&g, 0, sizeof(g)); } - ~Glob() { ::globfree(&g); } - - typedef char** const_iterator; - - const_iterator begin() const { return g.gl_pathv; } - const_iterator end() const { return g.gl_pathv + g.gl_pathc; } - } g; - - const int flags(GLOB_ERR | GLOB_MARK | GLOB_BRACE | GLOB_NOMAGIC); - - const auto res(::glob(pattern.c_str(), flags, nullptr, &g.g)); - - if (res) { - switch (res) { - case GLOB_NOSPACE: - LOGTHROW(err1, GlobError) << "Glob: out of memory."; - break; - - case GLOB_ABORTED: - LOGTHROW(err1, GlobError) << "Glob: read error."; - break; - - case GLOB_NOMATCH: - return {}; - - default: - LOGTHROW(err1, GlobError) - << "Glob: unknown return status " << res << "."; - } - } - - // copy result - std::vector paths; - - // we have some data here - for (const auto &path : g) { - paths.push_back(path); - } - - return paths; -} - diff --git a/mapproxy/src/mapproxy/support/glob.hpp b/mapproxy/src/mapproxy/support/glob.hpp deleted file mode 100644 index d18519c..0000000 --- a/mapproxy/src/mapproxy/support/glob.hpp +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Copyright (c) 2017 Melown Technologies SE - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef mapproxy_support_glob_hpp_included_ -#define mapproxy_support_glob_hpp_included_ - -#include -#include -#include - -struct GlobError : std::runtime_error { - GlobError(const std::string &msg) : std::runtime_error(msg) {} -}; - -/** Returns list of files that match given path. Returns empty list if nothing - * matches except when pattern is actually not a pattern. - * - * Throws GlobError on any error. - */ -std::vector -globPath(const boost::filesystem::path &pattern); - -#endif // mapproxy_support_glob_hpp_included_