From f54bebf0497dbcf1d3063223c636fd884f7cf6c1 Mon Sep 17 00:00:00 2001 From: Leonardo Grasso Date: Mon, 28 Nov 2022 16:58:20 +0100 Subject: [PATCH 1/4] chore: remove not used dependency - string-view-lite Signed-off-by: Leonardo Grasso --- CMakeLists.txt | 3 --- userspace/engine/CMakeLists.txt | 1 - userspace/falco/CMakeLists.txt | 1 - 3 files changed, 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d3588eb4ca7..4fb79696d10 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -181,9 +181,6 @@ include(cxxopts) # One TBB include(tbb) -#string-view-lite -include(DownloadStringViewLite) - if(NOT MINIMAL_BUILD) include(zlib) include(cares) diff --git a/userspace/engine/CMakeLists.txt b/userspace/engine/CMakeLists.txt index 6042a4c3ffd..f4a333516dc 100644 --- a/userspace/engine/CMakeLists.txt +++ b/userspace/engine/CMakeLists.txt @@ -28,7 +28,6 @@ set(FALCO_ENGINE_SOURCE_FILES rule_loader_compiler.cpp) add_library(falco_engine STATIC ${FALCO_ENGINE_SOURCE_FILES}) -add_dependencies(falco_engine njson string-view-lite) if(USE_BUNDLED_DEPS) add_dependencies(falco_engine yamlcpp) diff --git a/userspace/falco/CMakeLists.txt b/userspace/falco/CMakeLists.txt index 8407f6767e0..1de6658bf36 100644 --- a/userspace/falco/CMakeLists.txt +++ b/userspace/falco/CMakeLists.txt @@ -73,7 +73,6 @@ list(APPEND FALCO_INCLUDE_DIRECTORIES "${FALCO_EXTRA_INCLUDE_DIRS}") set( FALCO_DEPENDENCIES - string-view-lite b64 cxxopts ) From 8e2bb1d18701d406c4a4839fa3bfc3ab6cc737f1 Mon Sep 17 00:00:00 2001 From: Leonardo Grasso Date: Mon, 28 Nov 2022 16:59:07 +0100 Subject: [PATCH 2/4] chore(cmake/modlule): cleanup DownloadStringViewLite Signed-off-by: Leonardo Grasso --- cmake/modules/DownloadStringViewLite.cmake | 30 ---------------------- 1 file changed, 30 deletions(-) delete mode 100644 cmake/modules/DownloadStringViewLite.cmake diff --git a/cmake/modules/DownloadStringViewLite.cmake b/cmake/modules/DownloadStringViewLite.cmake deleted file mode 100644 index 872da0b766f..00000000000 --- a/cmake/modules/DownloadStringViewLite.cmake +++ /dev/null @@ -1,30 +0,0 @@ -# -# Copyright (C) 2020 The Falco Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the -# specific language governing permissions and limitations under the License. -# - -include(ExternalProject) - -set(STRING_VIEW_LITE_PREFIX ${CMAKE_BINARY_DIR}/string-view-lite-prefix) -set(STRING_VIEW_LITE_INCLUDE ${STRING_VIEW_LITE_PREFIX}/include) -message(STATUS "Using bundled string-view-lite in ${STRING_VIEW_LITE_INCLUDE}") - -ExternalProject_Add( - string-view-lite - PREFIX ${STRING_VIEW_LITE_PREFIX} - GIT_REPOSITORY "https://github.com/martinmoene/string-view-lite.git" - GIT_TAG "v1.4.0" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - UPDATE_COMMAND "" - INSTALL_COMMAND - ${CMAKE_COMMAND} -E copy ${STRING_VIEW_LITE_PREFIX}/src/string-view-lite/include/nonstd/string_view.hpp - ${STRING_VIEW_LITE_INCLUDE}/nonstd/string_view.hpp) From 10f85031a5ce3f1318e7ba08f3837865a0c7722f Mon Sep 17 00:00:00 2001 From: Leonardo Grasso Date: Mon, 28 Nov 2022 17:02:02 +0100 Subject: [PATCH 3/4] fix(userspace/engine): no need to use external deps Co-authored-by: Jason Dellaluce Signed-off-by: Leonardo Grasso --- userspace/engine/falco_utils.cpp | 2 +- userspace/engine/falco_utils.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/userspace/engine/falco_utils.cpp b/userspace/engine/falco_utils.cpp index 6c1f9bc30e3..49b05a69e8b 100644 --- a/userspace/engine/falco_utils.cpp +++ b/userspace/engine/falco_utils.cpp @@ -75,7 +75,7 @@ void readfile(const std::string& filename, std::string& data) } namespace network { -bool is_unix_scheme(nonstd::string_view url) +bool is_unix_scheme(const std::string& url) { return url.starts_with(UNIX_SCHEME); } diff --git a/userspace/engine/falco_utils.h b/userspace/engine/falco_utils.h index 65b7980d79b..1619863ee24 100644 --- a/userspace/engine/falco_utils.h +++ b/userspace/engine/falco_utils.h @@ -49,7 +49,7 @@ uint32_t hardware_concurrency(); namespace network { static const std::string UNIX_SCHEME("unix://"); -bool is_unix_scheme(nonstd::string_view url); +bool is_unix_scheme(const std::string& url); } // namespace network } // namespace utils } // namespace falco From a2a4f650622d284467a500b380ff1554e7de627b Mon Sep 17 00:00:00 2001 From: Jason Dellaluce Date: Mon, 28 Nov 2022 17:18:33 +0000 Subject: [PATCH 4/4] fix: remove minor string view dependencies Signed-off-by: Jason Dellaluce --- tests/engine/test_falco_utils.cpp | 1 - userspace/engine/CMakeLists.txt | 2 -- userspace/engine/falco_utils.cpp | 3 ++- userspace/engine/falco_utils.h | 1 - userspace/falco/CMakeLists.txt | 1 - 5 files changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/engine/test_falco_utils.cpp b/tests/engine/test_falco_utils.cpp index 628b790d2a6..55da4b0dedd 100644 --- a/tests/engine/test_falco_utils.cpp +++ b/tests/engine/test_falco_utils.cpp @@ -14,7 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "falco_utils.h" -#include #include TEST_CASE("is_unix_scheme matches", "[utils]") diff --git a/userspace/engine/CMakeLists.txt b/userspace/engine/CMakeLists.txt index f4a333516dc..74944c57c2b 100644 --- a/userspace/engine/CMakeLists.txt +++ b/userspace/engine/CMakeLists.txt @@ -39,7 +39,6 @@ if(MINIMAL_BUILD) PUBLIC "${NJSON_INCLUDE}" "${TBB_INCLUDE_DIR}" - "${STRING_VIEW_LITE_INCLUDE}" "${LIBSCAP_INCLUDE_DIRS}" "${LIBSINSP_INCLUDE_DIRS}" "${YAMLCPP_INCLUDE_DIR}" @@ -50,7 +49,6 @@ else() PUBLIC "${NJSON_INCLUDE}" "${TBB_INCLUDE_DIR}" - "${STRING_VIEW_LITE_INCLUDE}" "${LIBSCAP_INCLUDE_DIRS}" "${LIBSINSP_INCLUDE_DIRS}" "${YAMLCPP_INCLUDE_DIR}" diff --git a/userspace/engine/falco_utils.cpp b/userspace/engine/falco_utils.cpp index 49b05a69e8b..53e71e42519 100644 --- a/userspace/engine/falco_utils.cpp +++ b/userspace/engine/falco_utils.cpp @@ -20,6 +20,7 @@ limitations under the License. #include #include "falco_utils.h" +#include "utils.h" #include "banned.h" // This raises a compilation error when certain functions are used namespace falco @@ -77,7 +78,7 @@ namespace network { bool is_unix_scheme(const std::string& url) { - return url.starts_with(UNIX_SCHEME); + return sinsp_utils::startswith(url, UNIX_SCHEME); } } // namespace network } // namespace utils diff --git a/userspace/engine/falco_utils.h b/userspace/engine/falco_utils.h index 1619863ee24..93cc33b94f5 100644 --- a/userspace/engine/falco_utils.h +++ b/userspace/engine/falco_utils.h @@ -24,7 +24,6 @@ limitations under the License. #include #include #include -#include #ifdef __GNUC__ #define likely(x) __builtin_expect(!!(x), 1) diff --git a/userspace/falco/CMakeLists.txt b/userspace/falco/CMakeLists.txt index 1de6658bf36..8db16d39f6e 100644 --- a/userspace/falco/CMakeLists.txt +++ b/userspace/falco/CMakeLists.txt @@ -62,7 +62,6 @@ set( "${PROJECT_SOURCE_DIR}/userspace/engine" "${PROJECT_BINARY_DIR}/userspace/falco" "${PROJECT_BINARY_DIR}/driver/src" - "${STRING_VIEW_LITE_INCLUDE}" "${CXXOPTS_INCLUDE_DIR}" "${YAMLCPP_INCLUDE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}"