add rpm support for deploy_tool
This commit is contained in:
@@ -88,6 +88,8 @@ void usage() {
|
|||||||
piCout << "-M <otool> " << Green << "- \"otool\" path, overrides \"ldd\"";
|
piCout << "-M <otool> " << Green << "- \"otool\" path, overrides \"ldd\"";
|
||||||
piCout << "-D <dpkg> " << Green << "- \"dpkg\" path, default \"/usr/bin/dpkg\"";
|
piCout << "-D <dpkg> " << Green << "- \"dpkg\" path, default \"/usr/bin/dpkg\"";
|
||||||
piCout << "--dpkg-workdir <d> " << Green << "- dpkg \"admindir\" path, default \"\"";
|
piCout << "--dpkg-workdir <d> " << Green << "- dpkg \"admindir\" path, default \"\"";
|
||||||
|
piCout << "-R <rpm> " << Green << "- \"rpm\" path, overrides \"dpkg\" for dependency queries";
|
||||||
|
piCout << "--rpm-rootdir <d> " << Green << "- rpm \"--root\" path, default \"\"";
|
||||||
piCout << "--name-tool <path> " << Green << "- \"install_name_tool\" path, default \"install_name_tool\"";
|
piCout << "--name-tool <path> " << Green << "- \"install_name_tool\" path, default \"install_name_tool\"";
|
||||||
piCout << "--strip <path> " << Green << "- \"strip\" path, default \"strip\"";
|
piCout << "--strip <path> " << Green << "- \"strip\" path, default \"strip\"";
|
||||||
piCout << "--no-strip " << Green << "- disable strip (save debug info)";
|
piCout << "--no-strip " << Green << "- disable strip (save debug info)";
|
||||||
@@ -108,7 +110,7 @@ void usage() {
|
|||||||
piCout << "--qt-plugins-dir <d> " << Green << "- dir where place Qt plugins, default \"<out_path>\"";
|
piCout << "--qt-plugins-dir <d> " << Green << "- dir where place Qt plugins, default \"<out_path>\"";
|
||||||
piCout << "--qt-qml-dir <d> " << Green << "- dir where place Qt QML modules, default \"<out_path>\"";
|
piCout << "--qt-qml-dir <d> " << Green << "- dir where place Qt QML modules, default \"<out_path>\"";
|
||||||
piCout << "--qt-conf-dir <dir> " << Green << "- dir where place \"qt.conf\", default \"<out_path>\"";
|
piCout << "--qt-conf-dir <dir> " << Green << "- dir where place \"qt.conf\", default \"<out_path>\"";
|
||||||
piCout << "--dependencies " << Green << "- search dependencies by <dpkg>, print them and copy missing libraries";
|
piCout << "--dependencies " << Green << "- search dependencies by <dpkg> or <rpm>, print them and copy missing libraries";
|
||||||
piCout << "--prefix <text> " << Green << "- print <text> before dependencies";
|
piCout << "--prefix <text> " << Green << "- print <text> before dependencies";
|
||||||
piCout << "";
|
piCout << "";
|
||||||
piCout << Bold << "Input control";
|
piCout << Bold << "Input control";
|
||||||
@@ -143,8 +145,9 @@ QtDep qt_deps[] = {QtDep("core", PIStringList() << "platforms"),
|
|||||||
|
|
||||||
|
|
||||||
int depth = 8;
|
int depth = 8;
|
||||||
bool fake = false, is_ldd = true, is_deps = false, need_qt = false, make_qt_format = true, rpath = false, win_target = false;
|
bool fake = false, is_ldd = true, is_deps = false, need_qt = false, make_qt_format = true, rpath = false, win_target = false,
|
||||||
PIString ldd, readelf, objdump, otool, dpkg, nametool, strip, out_dir, qt_dir, dpkg_workdir;
|
use_rpm = false;
|
||||||
|
PIString ldd, readelf, objdump, otool, dpkg, rpm_tool, nametool, strip, out_dir, qt_dir, dpkg_workdir, rpm_rootdir;
|
||||||
PIString qt_pref, qt_suff, qt_conf_dir, qt_plugins_dir, qt_qml_dir, target_dir;
|
PIString qt_pref, qt_suff, qt_conf_dir, qt_plugins_dir, qt_qml_dir, target_dir;
|
||||||
PIStringList styles, lib_dirs, add_libs, platforms, sqldrivers, input_files, plugin_libs, qt_add_libs, qml_list;
|
PIStringList styles, lib_dirs, add_libs, platforms, sqldrivers, input_files, plugin_libs, qt_add_libs, qml_list;
|
||||||
PISet<PIString> all_libs, miss_libs, all_deps, frameworks, framework_libs, miss_frameworks, qt_plugins, ignore_libs, qt_libs;
|
PISet<PIString> all_libs, miss_libs, all_deps, frameworks, framework_libs, miss_frameworks, qt_plugins, ignore_libs, qt_libs;
|
||||||
@@ -488,6 +491,43 @@ bool procDpkg(const PIString & l) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool procRpm(const PIString & l) {
|
||||||
|
PIString rpmdir;
|
||||||
|
if (!rpm_rootdir.isEmpty()) rpmdir = " --root " + rpm_rootdir;
|
||||||
|
PIFile::FileInfo fi;
|
||||||
|
fi.path = l;
|
||||||
|
PIString cmd = rpm_tool + rpmdir + " -qf " + fi.path + ign_err_suffix;
|
||||||
|
// PICout(true) << "** rpm:" << cmd;
|
||||||
|
PIString vs = execute(cmd).trim();
|
||||||
|
if (!vs.isEmpty()) {
|
||||||
|
PIStringList lines = vs.split('\n');
|
||||||
|
for (auto line: lines) {
|
||||||
|
line.trim();
|
||||||
|
if (line.isEmpty()) continue;
|
||||||
|
// Filter out -devel, -debuginfo, -static packages
|
||||||
|
if (line.contains("-devel") || line.contains("-debuginfo") || line.contains("-static")) continue;
|
||||||
|
// Extract package name: "name-version-release.arch" → "name"
|
||||||
|
// Find first hyphen that's not part of version
|
||||||
|
int verStart = -1;
|
||||||
|
for (int i = 0; i < line.size_s(); ++i) {
|
||||||
|
if (line[i] == '-' && i + 1 < line.size_s() && line[i + 1].isDigit()) {
|
||||||
|
verStart = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (verStart > 0) {
|
||||||
|
PIString pkgName = line.left(verStart);
|
||||||
|
// PICout(true) << "** found \"" << pkgName << "\" for \"" << l << "\"";
|
||||||
|
all_deps << pkgName;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// piCout << "No rpm dep on" << l;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void patchNameTool() {
|
void patchNameTool() {
|
||||||
if (nametool.isEmpty()) return;
|
if (nametool.isEmpty()) return;
|
||||||
PIStringList clibs = all_libs.toVector(), flibs = framework_libs.toVector(), patch_list;
|
PIStringList clibs = all_libs.toVector(), flibs = framework_libs.toVector(), patch_list;
|
||||||
@@ -616,6 +656,8 @@ int main(int argc, char * argv[]) {
|
|||||||
cli.addArgument("no-strip", PIChar('\0'), false);
|
cli.addArgument("no-strip", PIChar('\0'), false);
|
||||||
cli.addArgument("Dpkg", true);
|
cli.addArgument("Dpkg", true);
|
||||||
cli.addArgument("dpkg-workdir", PIChar('\0'), true);
|
cli.addArgument("dpkg-workdir", PIChar('\0'), true);
|
||||||
|
cli.addArgument("Rpm", true);
|
||||||
|
cli.addArgument("rpm-rootdir", PIChar('\0'), true);
|
||||||
cli.addArgument("depth", true);
|
cli.addArgument("depth", true);
|
||||||
cli.addArgument("qtdir", true);
|
cli.addArgument("qtdir", true);
|
||||||
cli.addArgument("add_libs", true);
|
cli.addArgument("add_libs", true);
|
||||||
@@ -645,14 +687,19 @@ int main(int argc, char * argv[]) {
|
|||||||
if (cli.hasArgument("no-strip")) strip.clear();
|
if (cli.hasArgument("no-strip")) strip.clear();
|
||||||
dpkg = cli.argumentValue("Dpkg");
|
dpkg = cli.argumentValue("Dpkg");
|
||||||
dpkg_workdir = cli.argumentValue("dpkg-workdir");
|
dpkg_workdir = cli.argumentValue("dpkg-workdir");
|
||||||
|
rpm_tool = cli.argumentValue("Rpm");
|
||||||
|
rpm_rootdir = cli.argumentValue("rpm-rootdir");
|
||||||
|
if (!rpm_tool.isEmpty()) use_rpm = true;
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
readelf.replaceAll("/", "\\");
|
readelf.replaceAll("/", "\\");
|
||||||
objdump.replaceAll("/", "\\");
|
objdump.replaceAll("/", "\\");
|
||||||
otool.replaceAll("/", "\\");
|
otool.replaceAll("/", "\\");
|
||||||
nametool.replaceAll("/", "\\");
|
nametool.replaceAll("/", "\\");
|
||||||
dpkg.replaceAll("/", "\\");
|
dpkg.replaceAll("/", "\\");
|
||||||
|
rpm_tool.replaceAll("/", "\\");
|
||||||
#endif
|
#endif
|
||||||
if (dpkg.isEmpty()) dpkg = "/usr/bin/dpkg";
|
if (dpkg.isEmpty()) dpkg = "/usr/bin/dpkg";
|
||||||
|
if (rpm_tool.isEmpty()) rpm_tool = "/usr/bin/rpm";
|
||||||
int etcnt = 0;
|
int etcnt = 0;
|
||||||
if (!readelf.isEmpty()) ++etcnt;
|
if (!readelf.isEmpty()) ++etcnt;
|
||||||
if (!objdump.isEmpty()) ++etcnt;
|
if (!objdump.isEmpty()) ++etcnt;
|
||||||
@@ -771,7 +818,7 @@ int main(int argc, char * argv[]) {
|
|||||||
PIVector<PIString> qlibs = qt_libs.toVector();
|
PIVector<PIString> qlibs = qt_libs.toVector();
|
||||||
piCout << "check for installed Qt" << qlibs;
|
piCout << "check for installed Qt" << qlibs;
|
||||||
for (const auto & l: qlibs) {
|
for (const auto & l: qlibs) {
|
||||||
if (procDpkg(l)) {
|
if (use_rpm ? procRpm(l) : procDpkg(l)) {
|
||||||
piCout << "system Qt found!";
|
piCout << "system Qt found!";
|
||||||
need_qt_plugins = false;
|
need_qt_plugins = false;
|
||||||
break;
|
break;
|
||||||
@@ -817,7 +864,7 @@ int main(int argc, char * argv[]) {
|
|||||||
l.replaceAll("/", "\\");
|
l.replaceAll("/", "\\");
|
||||||
#endif
|
#endif
|
||||||
bool need_cp = true;
|
bool need_cp = true;
|
||||||
if (is_deps) need_cp = !procDpkg(l);
|
if (is_deps) need_cp = !(use_rpm ? procRpm(l) : procDpkg(l));
|
||||||
if (need_cp) {
|
if (need_cp) {
|
||||||
piCout << "copy" << l;
|
piCout << "copy" << l;
|
||||||
if (!fake) {
|
if (!fake) {
|
||||||
|
|||||||
Reference in New Issue
Block a user