deploy #50

Merged
peri4 merged 3 commits from deploy into master 2020-11-03 12:03:10 +03:00
4 changed files with 40 additions and 15 deletions

View File

@@ -3,8 +3,8 @@ cmake_policy(SET CMP0017 NEW) # need include() with .cmake
project(pip) project(pip)
set(pip_MAJOR 2) set(pip_MAJOR 2)
set(pip_MINOR 14) set(pip_MINOR 14)
set(pip_REVISION 0) set(pip_REVISION 1)
set(pip_SUFFIX beta) set(pip_SUFFIX )
set(pip_COMPANY SHS) set(pip_COMPANY SHS)
set(pip_DOMAIN org.SHS) set(pip_DOMAIN org.SHS)

View File

@@ -330,8 +330,10 @@ void PIEvaluator::makeOutput(PIString & string) {
void PIEvaluator::findUnknownVariables() { void PIEvaluator::findUnknownVariables() {
PIString cvar; PIString cvar;
unknownVars.clear(); unknownVars.clear();
usedVars.clear();
for (int i = 0; i < currentString.length(); i++) { for (int i = 0; i < currentString.length(); i++) {
if (elements[i].var_num == -666) cvar += currentString[i]; if (elements[i].var_num >= 0) usedVars << content.variable(elements[i].var_num).name;
else if (elements[i].var_num == -666) cvar += currentString[i];
else { else {
if (cvar.length() == 0) continue; if (cvar.length() == 0) continue;
unknownVars << cvar; unknownVars << cvar;
@@ -340,6 +342,7 @@ void PIEvaluator::findUnknownVariables() {
} }
if (cvar.length() > 0) unknownVars << cvar; if (cvar.length() > 0) unknownVars << cvar;
unknownVars.removeDuplicates(); unknownVars.removeDuplicates();
usedVars.removeDuplicates();
} }
@@ -1196,7 +1199,7 @@ complexd PIEvaluator::evaluate() {
PIByteArray PIEvaluator::save() const { PIByteArray PIEvaluator::save() const {
PIByteArray ret; PIByteArray ret;
ret << content << currentVariables << unknownVars << instructions << currentString << lastError << out << correct; ret << content << currentVariables << unknownVars << instructions << currentString << lastError << out << correct << usedVars;
return ret; return ret;
} }
@@ -1204,5 +1207,6 @@ PIByteArray PIEvaluator::save() const {
void PIEvaluator::load(PIByteArray ba) { void PIEvaluator::load(PIByteArray ba) {
if (ba.size() <= 4) return; if (ba.size() <= 4) return;
ba >> content >> currentVariables >> unknownVars >> instructions >> currentString >> lastError >> out >> correct; ba >> content >> currentVariables >> unknownVars >> instructions >> currentString >> lastError >> out >> correct;
if (ba.size() >= 4) ba >> usedVars;
variables = currentVariables; variables = currentVariables;
} }

View File

@@ -176,6 +176,9 @@ public:
//! Returns all unknown variables founded in last expression passed to \a check() function //! Returns all unknown variables founded in last expression passed to \a check() function
const PIStringList & unknownVariables() const {return unknownVars;} const PIStringList & unknownVariables() const {return unknownVars;}
//! Returns all used variables founded in last expression passed to \a check() function
const PIStringList & usedVariables() const {return usedVars;}
//! Returns processed last expression passed to \a check() function //! Returns processed last expression passed to \a check() function
const PIString & expression() const {return currentString;} const PIString & expression() const {return currentString;}
@@ -220,7 +223,7 @@ private:
PIDeque<PIEvaluatorTypes::Element> elements; PIDeque<PIEvaluatorTypes::Element> elements;
PIVector<PIEvaluatorTypes::Variable> currentVariables, variables, tmpvars, * kvars; PIVector<PIEvaluatorTypes::Variable> currentVariables, variables, tmpvars, * kvars;
PIVector<PIEvaluatorTypes::Instruction> instructions; PIVector<PIEvaluatorTypes::Instruction> instructions;
PIStringList unknownVars; PIStringList unknownVars, usedVars;
PIString currentString, lastError; PIString currentString, lastError;
complexd out; complexd out;
bool correct; bool correct;

View File

@@ -67,7 +67,7 @@ void usage() {
"[-p <qt_plugins>] [-s <search_path>] [--ignore <libs>] [-S <styles>] " "[-p <qt_plugins>] [-s <search_path>] [--ignore <libs>] [-S <styles>] "
"[-l <ldd>] [-D <dpkg>] [--dpkg-workdir <d>] [-L <readelf> | -W <objdump> | -M <otool>] " "[-l <ldd>] [-D <dpkg>] [--dpkg-workdir <d>] [-L <readelf> | -W <objdump> | -M <otool>] "
"[--name-tool <pathS>] [-d <depth>] [-q <qtdir>] [-a <add_libs>] [-S <styles>] " "[--name-tool <pathS>] [-d <depth>] [-q <qtdir>] [-a <add_libs>] [-S <styles>] "
"[-P <platforms>] [--qt-plugins <d>] -o <out_path> <file> [<file2> ...]\"" << NewLine; "[-P <platforms>] [--qt-plugins <d>] [--qt-modules <l>] -o <out_path> <file> [<file2> ...]\"" << NewLine;
piCout << Green << Bold << "Details:"; piCout << Green << Bold << "Details:";
piCout << Bold << "Debug control"; piCout << Bold << "Debug control";
piCout << "-h, --help " << Green << "- display this message and exit"; piCout << "-h, --help " << Green << "- display this message and exit";
@@ -92,10 +92,11 @@ void usage() {
piCout << "-S <styles> " << Green << "- set Qt styles (e.g. \"oxygen,breeze\"), default \"*\""; piCout << "-S <styles> " << Green << "- set Qt styles (e.g. \"oxygen,breeze\"), default \"*\"";
piCout << "-P <platforms> " << Green << "- set Qt platforms (e.g. \"win,mini\"), default by host system"; piCout << "-P <platforms> " << Green << "- set Qt platforms (e.g. \"win,mini\"), default by host system";
piCout << "--qt-plugins <d> " << Green << "- set Qt plugins description"; piCout << "--qt-plugins <d> " << Green << "- set Qt plugins description";
piCout << "--qt-modules <list>" << Green << "- additional Qt modules, may be separated by \"" DELIM "\" (e.g. \"Sql" DELIM "Xml\")";
piCout << ""; piCout << "";
piCout << Bold << "Output control"; piCout << Bold << "Output control";
piCout << "-o <out_path> " << Green << "- path for libraries copy to"; piCout << "-o <out_path> " << Green << "- path for libraries copy to";
piCout << "-p <qt_plugins> " << Green << "- path for Qt plugins, default \"<out_path>/plugins\""; piCout << "-p <qt_plugins> " << Green << "- path for Qt plugins, default \"<out_path>\"";
piCout << "--dependencies " << Green << "- search dependencies by <dpkg>, print them and copy missing libraries"; piCout << "--dependencies " << Green << "- search dependencies by <dpkg>, print them and copy missing libraries";
piCout << "--prefix <text> " << Green << "- print <text> before dependencies"; piCout << "--prefix <text> " << Green << "- print <text> before dependencies";
piCout << ""; piCout << "";
@@ -127,9 +128,10 @@ QtDep qt_deps[] = {
int depth = 8; int depth = 8;
bool fake = false, is_ldd = true, is_deps = false, need_qt = false; bool fake = false, is_ldd = true, is_deps = false, need_qt = false, make_qt_format = true;
PIString ldd, readelf, objdump, otool, dpkg, nametool, strip, out_dir, qt_dir, out_plugins_dir, dpkg_workdir; PIString ldd, readelf, objdump, otool, dpkg, nametool, strip, out_dir, qt_dir, out_plugins_dir, dpkg_workdir;
PIStringList styles, lib_dirs, add_libs, platforms, sqldrivers, input_files, plugin_libs; PIString qt_pref, qt_suff;
PIStringList styles, lib_dirs, add_libs, platforms, sqldrivers, input_files, plugin_libs, qt_add_libs;
PISet<PIString> all_libs, miss_libs, all_deps, frameworks, framework_libs, miss_frameworks, qt_plugins, ignore_libs; PISet<PIString> all_libs, miss_libs, all_deps, frameworks, framework_libs, miss_frameworks, qt_plugins, ignore_libs;
PIMap<PIString, PIStringList> qt_filters; PIMap<PIString, PIStringList> qt_filters;
@@ -181,17 +183,22 @@ PIString execute(const PIString & cmd) {
void checkQtLib(PIString lib) { void checkQtLib(PIString lib) {
if (lib.startsWith("lib")) lib.cutLeft(3); PIString pref, suff;
if (lib.startsWith("qt5")) lib.cutLeft(3); if (lib.startsWith("lib")) {pref += "lib"; lib.cutLeft(3);}
if (lib.startsWith("qt")) lib.cutLeft(2); if (lib.startsWith("qt5")) {pref += "Qt5"; lib.cutLeft(3);}
if (lib.find(".")) lib = lib.left(lib.find(".")); if (lib.startsWith("qt" )) {pref += "Qt" ; lib.cutLeft(2);}
//piCout << "checkQt" << lib; if (lib.find('.') >= 0) {suff = lib.right(lib.size_s() - lib.find('.')); lib = lib.left(lib.find('.'));}
for (int i = 0; ; ++i) { for (int i = 0; ; ++i) {
if (qt_deps[i].lib.isEmpty()) break; if (qt_deps[i].lib.isEmpty()) break;
if (qt_deps[i].lib == lib) { if (qt_deps[i].lib == lib) {
qt_plugins << qt_deps[i].plugins; qt_plugins << qt_deps[i].plugins;
//piCout << "add qt plugins" << qt_deps[i].plugins << "now" << qt_plugins; //piCout << "add qt plugins" << qt_deps[i].plugins << "now" << qt_plugins;
need_qt = true; need_qt = true;
if (make_qt_format) {
make_qt_format = false;
qt_pref = pref;
qt_suff = suff;
}
break; break;
} }
} }
@@ -484,6 +491,7 @@ int main(int argc, char * argv[]) {
cli.addArgument("Styles", true); cli.addArgument("Styles", true);
cli.addArgument("Platforms", true); cli.addArgument("Platforms", true);
cli.addArgument("qt-plugins", PIChar('\0'), true); cli.addArgument("qt-plugins", PIChar('\0'), true);
cli.addArgument("qt-modules", PIChar('\0'), true);
cli.addArgument("ldd", true); cli.addArgument("ldd", true);
cli.addArgument("Lreadelf", true); cli.addArgument("Lreadelf", true);
cli.addArgument("Wobjdump", true); cli.addArgument("Wobjdump", true);
@@ -590,6 +598,9 @@ int main(int argc, char * argv[]) {
qt_filters["platforms"] = platforms; qt_filters["platforms"] = platforms;
qt_filters["styles" ] = styles ; qt_filters["styles" ] = styles ;
qt_add_libs = cli.argumentValue("qt-modules").split(DELIM);
need_qt = !qt_add_libs.isEmpty();
auto it = qt_filters.makeIterator(); auto it = qt_filters.makeIterator();
while (it.next()) while (it.next())
it.valueRef().forEachInplace([](PIString i)->PIString{ it.valueRef().forEachInplace([](PIString i)->PIString{
@@ -616,8 +627,15 @@ int main(int argc, char * argv[]) {
} }
}); });
//piCout << files; //piCout << files;
if (depth > 0) if (depth > 0) {
input_files.forEach([&](const PIString & f){procLdd(f);}); input_files.forEach([&](const PIString & f){procLdd(f);});
qt_add_libs.forEach([&](const PIString & f){
PIString l = findLib(qt_pref + f + qt_suff);
if (l.isEmpty()) return;
procLdd(l, true);
checkQtLib(f.toLowerCase());
});
}
piForeach (PIString & s, add_libs) { piForeach (PIString & s, add_libs) {
if (s.isEmpty()) continue; if (s.isEmpty()) continue;
PIString alib = findLib(s); PIString alib = findLib(s);