You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2022/01/27 17:18:32 UTC
[GitHub] [nifi-minifi-cpp] rustammendel opened a new pull request #1251: MINIFICPP-1636 - Use std::filesystem instead of boost and platform specific implementations
rustammendel opened a new pull request #1251:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1251
Thank you for submitting a contribution to Apache NiFi - MiNiFi C++.
In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:
### For all changes:
- [x] Is there a JIRA ticket associated with this PR? Is it referenced
in the commit message?
- [x] Does your PR title start with MINIFICPP-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
- [x] Has your PR been rebased against the latest commit within the target branch (typically main)?
- [] Is your initial contribution a single, squashed commit?
### For code changes:
- [x] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)?
- [ ] If applicable, have you updated the LICENSE file?
- [ ] If applicable, have you updated the NOTICE file?
### For documentation related changes:
- [ ] Have you ensured that format looks appropriate for the output in which it is rendered?
### Note:
Please ensure that once the PR is submitted, you check GitHub Actions CI results for build issues and submit an update to your PR as soon as possible.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nifi-minifi-cpp] szaszm closed pull request #1251: MINIFICPP-1636 - Use std::filesystem instead of boost and platform specific implementations
Posted by GitBox <gi...@apache.org>.
szaszm closed pull request #1251:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1251
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nifi-minifi-cpp] fgerlits commented on a change in pull request #1251: MINIFICPP-1636 - Use std::filesystem instead of boost and platform specific implementations
Posted by GitBox <gi...@apache.org>.
fgerlits commented on a change in pull request #1251:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1251#discussion_r798640195
##########
File path: extensions/script/python/PythonCreator.h
##########
@@ -121,41 +122,34 @@ class PythonCreator : public minifi::core::CoreComponent {
}
for (const auto &path : pathOrFiles) {
- utils::file::FileUtils::addFilesMatchingExtension(logger_, path, ".py", classpaths_);
+ utils::file::addFilesMatchingExtension(logger_, path, ".py", classpaths_);
}
}
- std::string getPackage(const std::string& basePath, const std::string& pythonscript) {
- const auto script_directory = getPath(pythonscript);
- const auto loc = script_directory.find_first_of(basePath);
- if (loc != 0 || script_directory.size() <= basePath.size()) {
+ std::string getPackage(const std::string &basePath, const std::string &pythonscript) {
+ if (!minifi::utils::StringUtils::startsWith(pythonscript, basePath)) {
return "";
}
- const auto python_dir = script_directory.substr(basePath.length() + 1);
- auto python_package = python_dir.substr(0, python_dir.find_last_of("/\\"));
- utils::StringUtils::replaceAll(python_package, "/", ".");
- utils::StringUtils::replaceAll(python_package, "\\", ".");
+ const auto python_package_path = std::filesystem::relative(pythonscript, basePath).parent_path();
+ std::vector<std::string> path_elements{python_package_path.begin(), python_package_path.end()};
+ std::string python_package = minifi::utils::StringUtils::join(".", path_elements);
if (python_package.length() > 1 && python_package.at(0) == '.') {
python_package = python_package.substr(1);
}
Review comment:
That is very strange; I get "h2o.h2o3.mojo". There is probably a bug somewhere, but it was most likely already there before this change, so we don't have to fix it now.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nifi-minifi-cpp] szaszm commented on a change in pull request #1251: MINIFICPP-1636 - Use std::filesystem instead of boost and platform specific implementations
Posted by GitBox <gi...@apache.org>.
szaszm commented on a change in pull request #1251:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1251#discussion_r793878534
##########
File path: libminifi/include/utils/file/FileUtils.h
##########
@@ -25,14 +25,7 @@
#include <utility>
#include <vector>
-#ifdef USE_BOOST
-#include <dirent.h>
-#include <boost/filesystem.hpp>
-#include <boost/system/error_code.hpp>
-#ifndef WIN32
-#include <sys/stat.h>
-#endif
-#else
+#ifndef USE_BOOST
Review comment:
We can now remove this check and just assume that it's not defined. We will eventually get rid of all boost code from libminifi.
##########
File path: docker/DockerVerify.sh
##########
@@ -44,11 +44,11 @@ echo "Installing test dependencies..." 1>&2
# hint include/library paths if homewbrew is in use
if brew list 2> /dev/null | grep openssl > /dev/null 2>&1; then
echo "Using homebrew paths for openssl" 1>&2
- LDFLAGS="-L$(brew --prefix openssl)/lib"
+ LDFLAGS="-L$(brew --prefix openssl@1.1)/lib"
export LDFLAGS
- CFLAGS="-I$(brew --prefix openssl)/include"
+ CFLAGS="-I$(brew --prefix openssl@1.1)/include"
export CFLAGS
- SWIG_FEATURES="-cpperraswarn -includeall -I$(brew --prefix openssl)/include"
+ SWIG_FEATURES="-cpperraswarn -includeall -I$(brew --prefix openssl@1.1)/include"
Review comment:
Why is this version pin? Was something not working on mac?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nifi-minifi-cpp] rustammendel commented on a change in pull request #1251: MINIFICPP-1636 - Use std::filesystem instead of boost and platform specific implementations
Posted by GitBox <gi...@apache.org>.
rustammendel commented on a change in pull request #1251:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1251#discussion_r794336569
##########
File path: docker/DockerVerify.sh
##########
@@ -44,11 +44,11 @@ echo "Installing test dependencies..." 1>&2
# hint include/library paths if homewbrew is in use
if brew list 2> /dev/null | grep openssl > /dev/null 2>&1; then
echo "Using homebrew paths for openssl" 1>&2
- LDFLAGS="-L$(brew --prefix openssl)/lib"
+ LDFLAGS="-L$(brew --prefix openssl@1.1)/lib"
export LDFLAGS
- CFLAGS="-I$(brew --prefix openssl)/include"
+ CFLAGS="-I$(brew --prefix openssl@1.1)/include"
export CFLAGS
- SWIG_FEATURES="-cpperraswarn -includeall -I$(brew --prefix openssl)/include"
+ SWIG_FEATURES="-cpperraswarn -includeall -I$(brew --prefix openssl@1.1)/include"
Review comment:
Yes SWIG libs have incompatibility with openssl@3, it was failing on local.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nifi-minifi-cpp] rustammendel commented on a change in pull request #1251: MINIFICPP-1636 - Use std::filesystem instead of boost and platform specific implementations
Posted by GitBox <gi...@apache.org>.
rustammendel commented on a change in pull request #1251:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1251#discussion_r798524205
##########
File path: extensions/script/python/PythonCreator.h
##########
@@ -121,41 +122,34 @@ class PythonCreator : public minifi::core::CoreComponent {
}
for (const auto &path : pathOrFiles) {
- utils::file::FileUtils::addFilesMatchingExtension(logger_, path, ".py", classpaths_);
+ utils::file::addFilesMatchingExtension(logger_, path, ".py", classpaths_);
}
}
- std::string getPackage(const std::string& basePath, const std::string& pythonscript) {
- const auto script_directory = getPath(pythonscript);
- const auto loc = script_directory.find_first_of(basePath);
- if (loc != 0 || script_directory.size() <= basePath.size()) {
+ std::string getPackage(const std::string &basePath, const std::string &pythonscript) {
+ if (!minifi::utils::StringUtils::startsWith(pythonscript, basePath)) {
return "";
}
- const auto python_dir = script_directory.substr(basePath.length() + 1);
- auto python_package = python_dir.substr(0, python_dir.find_last_of("/\\"));
- utils::StringUtils::replaceAll(python_package, "/", ".");
- utils::StringUtils::replaceAll(python_package, "\\", ".");
+ const auto python_package_path = std::filesystem::relative(pythonscript, basePath).parent_path();
+ std::vector<std::string> path_elements{python_package_path.begin(), python_package_path.end()};
+ std::string python_package = minifi::utils::StringUtils::join(".", path_elements);
if (python_package.length() > 1 && python_package.at(0) == '.') {
python_package = python_package.substr(1);
}
Review comment:
<img width="325" alt="image" src="https://user-images.githubusercontent.com/30227161/152344524-0b301617-53db-4b08-a947-d76fc88225a3.png">
on my local it does
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nifi-minifi-cpp] fgerlits commented on a change in pull request #1251: MINIFICPP-1636 - Use std::filesystem instead of boost and platform specific implementations
Posted by GitBox <gi...@apache.org>.
fgerlits commented on a change in pull request #1251:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1251#discussion_r795447490
##########
File path: extensions/script/python/PythonCreator.h
##########
@@ -143,19 +142,15 @@ class PythonCreator : public minifi::core::CoreComponent {
}
std::string getPath(const std::string &pythonscript) {
- std::string path = pythonscript.substr(0, pythonscript.find_last_of("/\\"));
- return path;
+ return std::filesystem::path(pythonscript).parent_path();
Review comment:
I think we need `.string()` at the end here for this to compile on Windows. (Also in `getScriptName()`.)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nifi-minifi-cpp] lordgamez commented on a change in pull request #1251: MINIFICPP-1636 - Use std::filesystem instead of boost and platform specific implementations
Posted by GitBox <gi...@apache.org>.
lordgamez commented on a change in pull request #1251:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1251#discussion_r795599349
##########
File path: extensions/sftp/tests/PutSFTPTests.cpp
##########
@@ -504,7 +504,9 @@ TEST_CASE_METHOD(PutSFTPTestsFixture, "PutSFTP set mtime", "[PutSFTP]") {
testController.runSession(plan, true);
testFile("nifi_test/tstFile1.ext", "content 1");
- testModificationTime("nifi_test/tstFile1.ext", 3000000000LL);
+ using namespace std::chrono; // NOLINT(build/namespaces)
Review comment:
nitpick: I would use `std::literals::chrono_literals` namespace here instead as we allow that in the linter and use the fully qualified namespaces for the type declaration.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nifi-minifi-cpp] fgerlits commented on a change in pull request #1251: MINIFICPP-1636 - Use std::filesystem instead of boost and platform specific implementations
Posted by GitBox <gi...@apache.org>.
fgerlits commented on a change in pull request #1251:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1251#discussion_r798376125
##########
File path: extensions/script/python/PythonCreator.h
##########
@@ -121,41 +122,34 @@ class PythonCreator : public minifi::core::CoreComponent {
}
for (const auto &path : pathOrFiles) {
- utils::file::FileUtils::addFilesMatchingExtension(logger_, path, ".py", classpaths_);
+ utils::file::addFilesMatchingExtension(logger_, path, ".py", classpaths_);
}
}
- std::string getPackage(const std::string& basePath, const std::string& pythonscript) {
- const auto script_directory = getPath(pythonscript);
- const auto loc = script_directory.find_first_of(basePath);
- if (loc != 0 || script_directory.size() <= basePath.size()) {
+ std::string getPackage(const std::string &basePath, const std::string &pythonscript) {
+ if (!minifi::utils::StringUtils::startsWith(pythonscript, basePath)) {
return "";
}
- const auto python_dir = script_directory.substr(basePath.length() + 1);
- auto python_package = python_dir.substr(0, python_dir.find_last_of("/\\"));
- utils::StringUtils::replaceAll(python_package, "/", ".");
- utils::StringUtils::replaceAll(python_package, "\\", ".");
+ const auto python_package_path = std::filesystem::relative(pythonscript, basePath).parent_path();
+ std::vector<std::string> path_elements{python_package_path.begin(), python_package_path.end()};
+ std::string python_package = minifi::utils::StringUtils::join(".", path_elements);
if (python_package.length() > 1 && python_package.at(0) == '.') {
python_package = python_package.substr(1);
}
Review comment:
I don't think this is needed any longer, as none of the path elements can be empty, and `StringUtils::join()` is not going to put a separator at the front.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nifi-minifi-cpp] szaszm commented on pull request #1251: MINIFICPP-1636 - Use std::filesystem instead of boost and platform specific implementations
Posted by GitBox <gi...@apache.org>.
szaszm commented on pull request #1251:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1251#issuecomment-1030169112
I copied the name and email address from the last commit on your branch when merging, but GitHub seems to associate it with a different account of yours. I hope it's not a problem.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nifi-minifi-cpp] rustammendel commented on a change in pull request #1251: MINIFICPP-1636 - Use std::filesystem instead of boost and platform specific implementations
Posted by GitBox <gi...@apache.org>.
rustammendel commented on a change in pull request #1251:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1251#discussion_r794338210
##########
File path: libminifi/include/utils/file/FileUtils.h
##########
@@ -25,14 +25,7 @@
#include <utility>
#include <vector>
-#ifdef USE_BOOST
-#include <dirent.h>
-#include <boost/filesystem.hpp>
-#include <boost/system/error_code.hpp>
-#ifndef WIN32
-#include <sys/stat.h>
-#endif
-#else
+#ifndef USE_BOOST
Review comment:
I have tried removing it but that failed windows build. I will try to optimize imports by moving relevant includes to ifdef WIN32 scope
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org