diff --git a/.github/workflows/remaken-actions.yml b/.github/workflows/remaken-actions.yml index ac4af0c..27419c6 100644 --- a/.github/workflows/remaken-actions.yml +++ b/.github/workflows/remaken-actions.yml @@ -10,7 +10,7 @@ on: - '[0-9]+\.[0-9]+\.[0-9]+' env: - tag_version: ${{ github.ref_name == 'develop' && '1.10.0' || github.ref_name }} + tag_version: ${{ github.ref_name == 'develop' && '1.10.1' || github.ref_name }} jobs: windows-ci: diff --git a/.gitmodules b/.gitmodules index f726986..5bc2981 100644 --- a/.gitmodules +++ b/.gitmodules @@ -6,4 +6,5 @@ url = https://github.com/nlohmann/json.git [submodule "libs/CLI11"] path = libs/CLI11 -url=https://github.com/Firefly35/CLI11.git +url=https://github.com/b-com-software-basis/CLI11.git + diff --git a/libs/CLI11 b/libs/CLI11 index cb113f8..d7020d0 160000 --- a/libs/CLI11 +++ b/libs/CLI11 @@ -1 +1 @@ -Subproject commit cb113f8a2cace3fd85fdf7489dffe54701ab7b62 +Subproject commit d7020d0869847a09d877bf793baee6f8033cb4af diff --git a/remaken.pro b/remaken.pro index 281a549..e848d2e 100755 --- a/remaken.pro +++ b/remaken.pro @@ -1,5 +1,5 @@ TARGET = remaken -VERSION=1.10.0 +VERSION=1.10.1 CONFIG += c++1z CONFIG += console diff --git a/src/CmdOptions.cpp b/src/CmdOptions.cpp index 17d84fc..606da4b 100755 --- a/src/CmdOptions.cpp +++ b/src/CmdOptions.cpp @@ -121,7 +121,7 @@ std::string CmdOptions::getOptionString(const std::string & optionName) CmdOptions::CmdOptions() { fs::detail::utf8_codecvt_facet utf8; - fs::path remakenRootPath = PathBuilder::getHomePath() / Constants::REMAKEN_FOLDER; + fs::path remakenRootPath = PathBuilder::getHomePath(*this) / Constants::REMAKEN_FOLDER; remakenRootPath /= "packages"; char * rootDirectoryVar = getenv(Constants::REMAKENPKGROOT); if (rootDirectoryVar != nullptr) { @@ -144,13 +144,13 @@ CmdOptions::CmdOptions() remakenRootPath = pkgPath; } - fs::path remakenProfileFolder = PathBuilder::getHomePath() / Constants::REMAKEN_FOLDER / Constants::REMAKEN_PROFILES_FOLDER ; + fs::path remakenProfileFolder = PathBuilder::getHomePath(*this) / Constants::REMAKEN_FOLDER / Constants::REMAKEN_PROFILES_FOLDER ; std::string profileName = "default"; m_cliApp.require_subcommand(1); m_cliApp.fallthrough(true); m_cliApp.option_defaults()->always_capture_default(); - m_cliApp.set_config("--profile",profileName,"remaken profile file to read",remakenProfileFolder.generic_string(utf8)); - + m_cliApp.set_config("--profile",profileName,"remaken profile file to read",remakenProfileFolder.generic_string(utf8), false); + m_config = "release"; m_cliApp.add_option("--config,-c", m_config, "Config: " + getOptionString("--config")); // ,true); m_cppVersion = "11"; @@ -537,15 +537,18 @@ CmdOptions::OptionResult CmdOptions::parseArguments(int argc, char** argv) void CmdOptions::writeConfigurationFile() const { fs::detail::utf8_codecvt_facet utf8; - fs::path remakenRootPath = PathBuilder::getHomePath() / Constants::REMAKEN_FOLDER; + fs::path remakenRootPath = PathBuilder::getHomePath(*this) / Constants::REMAKEN_FOLDER; fs::path remakenProfilesPath = remakenRootPath / Constants::REMAKEN_PROFILES_FOLDER; + if (!fs::exists(remakenProfilesPath)) { + fs::create_directories(remakenProfilesPath); } fs::path remakenProfilePath = remakenProfilesPath/m_profileName; ofstream fos; fos.open(remakenProfilePath.generic_string(utf8),ios::out|ios::trunc); // workaround for CLI11 issue #648 and also waiting for issue #685 + std::string conf = m_cliApp.config_to_str(m_defaultProfileOptions,true); // comment all run arguments, as run command doesn't need to maintain options in configuration boost::replace_all(conf,"run.","#run."); @@ -555,7 +558,7 @@ void CmdOptions::writeConfigurationFile() const void CmdOptions::displayConfigurationSettings() const { - std::cout<= 2) { - separator = "/*"; - } boost::split(options, dependency.getToolOptions(), [](char c){return c == '#';}); for (const auto & option: options) { std::vector optionInfos; @@ -191,8 +187,18 @@ void ConanSystemTool::install(const Dependency & dependency) std::string conanOptionPrefix = optionInfos.front(); optionInfos.erase(optionInfos.begin()); if (optionInfos.empty()) { - optionsArgs.push_back("-o " + option); + if (m_conanVersion >= 2) { + optionsArgs.push_back("-o *:" + option); + } + else + { + optionsArgs.push_back("-o " + option); // conan v1 + } } else { + std::string separator = ""; + if (m_conanVersion >= 2) { + separator = "/*"; + } if (conanOptionPrefix.find(separator) != std::string::npos) { optionsArgs.push_back("-o " + conanOptionPrefix + ":" + optionInfos.front()); } else { @@ -226,11 +232,16 @@ void ConanSystemTool::install(const Dependency & dependency) result = bp::system(command.c_str()); } else { - std::string buildMode = "shared=True"; + std::string buildMode = ""; + if (m_conanVersion >= 2) { + buildMode = dependency.getName() + "/*:"; + } if (dependency.getMode() == "static") { - buildMode = "shared=False"; + buildMode += "shared=False"; + } + else { + buildMode += "shared=True"; } - std::string command = m_systemInstallerPath.generic_string(utf8) + " install " + "-o " + buildMode + " " + boost::algorithm::join(settingsArgs, " ") + " -s " + buildType + " -s " + cppStd + " -pr " + profileName + " " + buildForceDep + " " + boost::algorithm::join(optionsArgs, " ") + " " + source; if (m_options.getVerbose()) { std::cout << command.c_str() << std::endl; @@ -690,7 +701,12 @@ std::vector ConanSystemTool::retrievePaths(const Dependency & dependen if (dependency.hasOptions()) { boost::split(options, dependency.getToolOptions(), [](char c){return c == '#';}); for (const auto & option: options) { - optionsArgs.push_back("-o " + option); + if (m_conanVersion >= 2) { + optionsArgs.push_back("-o *:" + option); + } + else { + optionsArgs.push_back("-o " + option); + } } } std::string profileName = m_options.getConanProfile(); @@ -717,7 +733,7 @@ std::vector ConanSystemTool::retrievePaths(const Dependency & dependen } } else { - std::string buildMode = "";//dependency.getName() + ":"; + std::string buildMode = ""; if (dependency.getMode() == "static") { buildMode += "shared=False"; } @@ -769,11 +785,10 @@ std::vector ConanSystemTool::retrievePaths(const Dependency & dependen if (m_options.getVerbose()) { std::cout << command.c_str() << std::endl; } - // SLETODO : issue with : bp::std_out > bp::null => use std::system (ok with it) result = std::system(command.c_str()); } else { - std::string buildMode = "";//dependency.getName() + ":"; + std::string buildMode = dependency.getName() + "/*:"; if (dependency.getMode() == "static") { buildMode += "shared=False"; } @@ -787,7 +802,6 @@ std::vector ConanSystemTool::retrievePaths(const Dependency & dependen if (m_options.getVerbose()) { std::cout << command.c_str() << std::endl; } - // SLETODO : issue with redirect : bp::std_out > bp::null => use std::system (ok with it) result = std::system(command.c_str()); } if (result != 0) { diff --git a/src/utils/PathBuilder.cpp b/src/utils/PathBuilder.cpp index 8b8ad4f..631689a 100755 --- a/src/utils/PathBuilder.cpp +++ b/src/utils/PathBuilder.cpp @@ -24,6 +24,7 @@ #include #include #include "Constants.h" +#include #ifdef WIN32 #include @@ -113,7 +114,7 @@ fs::path PathBuilder::buildModuleFilePath(const std::string & moduleName, const return filePath; } -fs::path PathBuilder::getHomePath() +fs::path PathBuilder::getHomePath(const CmdOptions & options) { char * homePathStr; fs::path homePath; @@ -129,23 +130,30 @@ fs::path PathBuilder::getHomePath() else { homePath = getUTF8PathObserver(homePathStr); } -#else - struct passwd* pwd = getpwuid(getuid()); - if (pwd) { - homePathStr = pwd->pw_dir; +#else \ + // try first with the $HOME environment variable + homePathStr = getenv("HOME"); + if (homePathStr == NULL) + { + struct passwd* pwd = getpwuid(getuid()); + if (pwd) { + homePathStr = pwd->pw_dir; + if (options.getVerbose()) { + BOOST_LOG_TRIVIAL(info)<<"remaken getHomePath with getpwuid(getuid()) method "<