2024-10-27 15:51:46 +08:00
|
|
|
#include "pack.h"
|
2024-10-29 12:42:11 +08:00
|
|
|
#include <iostream>
|
|
|
|
#include <boost/algorithm/string.hpp>
|
2024-10-27 15:51:46 +08:00
|
|
|
|
|
|
|
bool CPackBinary::startPack(const CmdResult& result)
|
|
|
|
{
|
|
|
|
return false;
|
2024-10-27 22:57:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
2024-10-29 12:42:11 +08:00
|
|
|
std::vector<std::string> split;
|
|
|
|
boost::split(split, output, boost::is_any_of("\t"));
|
|
|
|
for (const auto& item : split) {
|
|
|
|
std::cout << item << "\n";
|
2024-10-27 22:57:17 +08:00
|
|
|
}
|
|
|
|
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;
|
|
|
|
}
|