added basic hpsh filepath and structure

This commit is contained in:
supunvindula
2023-10-12 13:03:50 +05:30
parent 41d2f5a447
commit 5bdda39a7b
5 changed files with 15 additions and 5 deletions

View File

@@ -77,7 +77,7 @@ target_link_libraries(hpcore
add_custom_command(TARGET hpcore POST_BUILD
# COMMAND strip ./build/hpcore
COMMAND cp ./test/bin/hpws ./test/bin/hpfs ./build/
COMMAND cp ./test/bin/hpws ./test/bin/hpfs ./test/bin/hpsh ./build/
)
target_precompile_headers(hpcore PUBLIC src/pchheader.hpp)
@@ -87,7 +87,7 @@ target_precompile_headers(hpcore PUBLIC src/pchheader.hpp)
add_custom_target(docker
COMMAND mkdir -p ./test/local-cluster/bin
COMMAND cp ./build/hpcore ./test/local-cluster/bin/
COMMAND cp ./test/bin/libblake3.so ./test/bin/hpws ./test/bin/hpfs ./test/local-cluster/bin/
COMMAND cp ./test/bin/libblake3.so ./test/bin/hpws ./test/bin/hpfs ./test/bin/hpsh ./test/local-cluster/bin/
COMMAND docker build -t hpcore:latest -t hpcore:0.6.4 -f ./test/local-cluster/Dockerfile ./test/local-cluster/bin/
)
set_target_properties(docker PROPERTIES EXCLUDE_FROM_ALL TRUE)

View File

@@ -242,6 +242,7 @@ namespace conf
ctx.hpws_exe_path = ctx.exe_dir + "/" + "hpws";
ctx.hpfs_exe_path = ctx.exe_dir + "/" + "hpfs";
ctx.hpsh_exe_path = ctx.exe_dir + "/" + "hpsh";
ctx.contract_dir = basedir;
ctx.config_dir = basedir + "/cfg";
@@ -709,7 +710,7 @@ namespace conf
*/
int validate_contract_dir_paths()
{
const std::string paths[8] = {
const std::string paths[9] = {
ctx.contract_dir,
ctx.config_file,
ctx.contract_hpfs_dir,
@@ -717,7 +718,8 @@ namespace conf
ctx.tls_key_file,
ctx.tls_cert_file,
ctx.hpfs_exe_path,
ctx.hpws_exe_path};
ctx.hpws_exe_path,
ctx.hpsh_exe_path};
for (const std::string &path : paths)
{
@@ -729,7 +731,7 @@ namespace conf
<< "openssl req -newkey rsa:2048 -new -nodes -x509 -days 365 -keyout tlskey.pem -out tlscert.pem\n"
<< "and add it to " + ctx.config_dir << std::endl;
}
else if (path == ctx.hpfs_exe_path || path == ctx.hpws_exe_path)
else if (path == ctx.hpfs_exe_path || path == ctx.hpws_exe_path || path == ctx.hpsh_exe_path)
{
std::cerr << path << " binary does not exist.\n";
}

View File

@@ -263,6 +263,7 @@ namespace conf
std::string exe_dir; // HotPocket executable dir.
std::string hpws_exe_path; // hpws executable file path.
std::string hpfs_exe_path; // hpfs executable file path.
std::string hpsh_exe_path; // hpsh executable path file
std::string contract_dir; // Contract base directory full path.
std::string contract_hpfs_dir; // Contract hpfs metadata dir (The location of hpfs log file).

View File

@@ -274,12 +274,19 @@ namespace usr
}
else if (msg_type == msg::usrmsg::MSGTYPE_CONTRACT_SHELL_INPUT)
{
// char const **argv_pass = NULL;
// argv_pass[0] = "./" + conf::ctx.hpsh_exe_path.data();
// // argv_pass[1] = conf::ctx.hpsh_exe_path.data();
char *args[] = { conf::ctx.hpsh_exe_path.data(), NULL };
std::string id, content;
if (parser.extract_shell_input(id, content) != -1){
LOG_INFO << "Received Shell Input.";
LOG_INFO << "User PubKey:" << user.pubkey;
LOG_INFO << "ID:" << id;
LOG_INFO << "Content:" << content;
execv(conf::ctx.hpsh_exe_path.data(),args);
return 0;
}
else

BIN
test/bin/hpsh Executable file

Binary file not shown.