You've already forked linuxdeploy
mirror of
https://github.com/encounter/linuxdeploy.git
synced 2026-07-10 12:18:44 -07:00
Use std::regex library instead of boost one
Works equally fine for us, and allows for removing a dependency.
This commit is contained in:
@@ -7,9 +7,6 @@
|
||||
[submodule "lib/boost-filesystem"]
|
||||
path = lib/boost-filesystem
|
||||
url = https://github.com/boostorg/filesystem.git
|
||||
[submodule "lib/boost-regex"]
|
||||
path = lib/boost-regex
|
||||
url = https://github.com/boostorg/regex.git
|
||||
[submodule "lib/boost-system"]
|
||||
path = lib/boost-system
|
||||
url = https://github.com/boostorg/system.git
|
||||
|
||||
@@ -38,8 +38,8 @@ namespace linuxdeploy {
|
||||
apiLevel = getApiLevelFromExecutable();
|
||||
pluginType = getPluginTypeFromExecutable();
|
||||
|
||||
boost::cmatch res;
|
||||
boost::regex_match(path.filename().c_str(), res, PLUGIN_EXPR);
|
||||
std::smatch res;
|
||||
std::regex_match(path.filename().string(), res, PLUGIN_EXPR);
|
||||
name = res[1].str();
|
||||
};
|
||||
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
// system includes
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
// library includes
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/regex.hpp>
|
||||
#include <regex>
|
||||
|
||||
// local includes
|
||||
#include "linuxdeploy/core/log.h"
|
||||
@@ -22,7 +19,7 @@ namespace linuxdeploy {
|
||||
/*
|
||||
* Official regular expression to check filenames for plugins
|
||||
*/
|
||||
static const boost::regex PLUGIN_EXPR(R"(^linuxdeploy-plugin-([^\s\.-]+)(?:-[^\.]+)?(?:\..+)?$)");
|
||||
static const std::regex PLUGIN_EXPR(R"(^linuxdeploy-plugin-([^\s\.-]+)(?:-[^\.]+)?(?:\..+)?$)");
|
||||
|
||||
/*
|
||||
* Plugin interface.
|
||||
|
||||
@@ -94,14 +94,6 @@ if(NOT USE_SYSTEM_BOOST)
|
||||
target_include_directories(boost_filesystem PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/boost-filesystem/include)
|
||||
target_link_libraries(boost_filesystem PUBLIC boost_config boost_utility boost_system)
|
||||
|
||||
file(GLOB boost_regex_srcs ${CMAKE_CURRENT_SOURCE_DIR}/boost-regex/src/*.cpp)
|
||||
add_library(boost_regex STATIC ${boost_regex_srcs})
|
||||
target_include_directories(boost_regex PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/boost-regex/include)
|
||||
target_link_libraries(boost_regex PUBLIC
|
||||
boost_config boost_predef boost_assert boost_throw_exception boost_smart_ptr boost_core boost_mpl
|
||||
boost_type_traits boost_static_assert boost_integer boost_preprocessor boost_functional boost_detail
|
||||
)
|
||||
|
||||
add_library(boost_numeric_conversion INTERFACE)
|
||||
set_property(TARGET boost_numeric_conversion PROPERTY INTERFACE_INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/boost-numeric_conversion/include>")
|
||||
set_property(TARGET boost_numeric_conversion PROPERTY INTERFACE_LINK_LIBRARIES "boost_config")
|
||||
|
||||
Submodule lib/boost-regex deleted from a9fc8fb5de
+2
-2
@@ -7,10 +7,10 @@ include_directories(${PROJECT_SOURCE_DIR}/include)
|
||||
if(USE_SYSTEM_BOOST)
|
||||
set(Boost_USE_STATIC_LIBS ON)
|
||||
find_package(Boost REQUIRED COMPONENTS filesystem regex)
|
||||
set(BOOST_LIBS Boost::filesystem Boost::regex)
|
||||
set(BOOST_LIBS Boost::filesystem)
|
||||
else()
|
||||
# use custom built libs
|
||||
set(BOOST_LIBS boost_system boost_filesystem boost_regex boost_lexical_cast)
|
||||
set(BOOST_LIBS boost_system boost_filesystem boost_lexical_cast)
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
+4
-4
@@ -1,10 +1,10 @@
|
||||
// system includes
|
||||
#include <fstream>
|
||||
#include <memory>
|
||||
#include <regex>
|
||||
#include <utility>
|
||||
|
||||
// library includes
|
||||
#include <boost/regex.hpp>
|
||||
#include <subprocess.hpp>
|
||||
#include <sys/mman.h>
|
||||
|
||||
@@ -134,11 +134,11 @@ namespace linuxdeploy {
|
||||
|
||||
auto outputAndError = util::subprocess::check_output_error(lddProc);
|
||||
|
||||
const boost::regex expr(R"(\s*(.+)\s+\=>\s+(.+)\s+\((.+)\)\s*)");
|
||||
boost::smatch what;
|
||||
const std::regex expr(R"(\s*(.+)\s+\=>\s+(.+)\s+\((.+)\)\s*)");
|
||||
std::smatch what;
|
||||
|
||||
for (const auto& line : util::splitLines(outputAndError.first)) {
|
||||
if (boost::regex_search(line, what, expr)) {
|
||||
if (std::regex_search(line, what, expr)) {
|
||||
auto libraryPath = what[2].str();
|
||||
util::trim(libraryPath);
|
||||
paths.push_back(bf::absolute(libraryPath));
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
// system headers
|
||||
#include <regex>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
// library headers
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/regex.hpp>
|
||||
#include <fnmatch.h>
|
||||
#include <subprocess.hpp>
|
||||
|
||||
@@ -84,9 +84,9 @@ namespace linuxdeploy {
|
||||
}
|
||||
|
||||
// entry name must match regular expression
|
||||
boost::cmatch res;
|
||||
std::smatch res;
|
||||
|
||||
if (!boost::regex_match(i->path().filename().string().c_str(), res, PLUGIN_EXPR)) {
|
||||
if (!std::regex_match(i->path().filename().string(), res, PLUGIN_EXPR)) {
|
||||
ldLog() << LD_DEBUG << "Doesn't match plugin regex, skipping:" << i->path() << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user