51 lines
1.1 KiB
C++
51 lines
1.1 KiB
C++
#include "pack.h"
|
|
#include <Poco/StringTokenizer.h>
|
|
|
|
bool CPackBinary::startPack(const CmdResult& result)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
std::vector<std::string>
|
|
CPackBinary::getDepends(const std::string& path,
|
|
const std::vector<std::string>& dirs)
|
|
{
|
|
std::vector<std::string> result;
|
|
std::string cmds;
|
|
cmds.append("export LD_LIBRARY_PATH=$LD_LIBRARY_PATH");
|
|
for (const auto& item : dirs) {
|
|
cmds.append(":" + item);
|
|
}
|
|
cmds.append(" && ldd " + path);
|
|
|
|
auto* pf = popen(cmds.c_str(), "r");
|
|
if (pf != nullptr) {
|
|
return result;
|
|
}
|
|
char buffer[1024]{};
|
|
std::string output{};
|
|
while (std::fgets(buffer, sizeof(buffer), pf)) {
|
|
output.append(buffer);
|
|
}
|
|
fclose(pf);
|
|
|
|
Poco::StringTokenizer token(output, "\t");
|
|
for (const auto& item : token) {
|
|
std::cout << item << std::endl;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
std::list<std::string>
|
|
CPackBinary::parseResult(const std::vector<std::string>& result)
|
|
{
|
|
std::list<std::string> ret;
|
|
|
|
return ret;
|
|
}
|
|
|
|
bool CPackBinary::handleAndCopy(const std::list<std::string>& libs)
|
|
{
|
|
return false;
|
|
}
|