From 42e51ea7c7a572a0aa1a21fc47d0f80032809d9d Mon Sep 17 00:00:00 2001 From: tilya Date: Wed, 28 Aug 2019 07:40:52 +0200 Subject: [PATCH] Adds the option to pass custom update information (#389) If linuxdeployqt is called with the option -updateinformation=, it passes that update string to appimagetool. Otherwise it uses -g to guess (the original behavior). --- README.md | 1 + tools/linuxdeployqt/main.cpp | 6 ++++++ tools/linuxdeployqt/shared.cpp | 13 ++++++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9c9ce54..8190b62 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,7 @@ Options: -show-exclude-libs : Print exclude libraries list. -verbose=<0-3> : 0 = no output, 1 = error/warning (default), 2 = normal, 3 = debug. + -updateinformation= : Embed update information STRING; if zsyncmake is installed, generate zsync file -version : Print version statement and exit. linuxdeployqt takes an application as input and makes it diff --git a/tools/linuxdeployqt/main.cpp b/tools/linuxdeployqt/main.cpp index b74e311..00fbc96 100644 --- a/tools/linuxdeployqt/main.cpp +++ b/tools/linuxdeployqt/main.cpp @@ -73,6 +73,7 @@ int main(int argc, char **argv) extern QStringList excludeLibs; extern QStringList ignoreGlob; extern bool copyCopyrightFiles; + extern QString updateInformation; // Check arguments // Due to the structure of the argument parser, we have to check all arguments at first to check whether the user @@ -168,6 +169,10 @@ int main(int argc, char **argv) LogDebug() << "Argument found:" << argument; int index = argument.indexOf("="); ignoreGlob += argument.mid(index + 1); + } else if (argument.startsWith("-updateinformation=")) { + LogDebug() << "Argument found:" << argument; + int index = argument.indexOf("="); + updateInformation = QString(argument.mid(index+1)); } else if (argument.startsWith("--")) { LogError() << "Error: arguments must not start with --, only -:" << argument << "\n"; return 1; @@ -225,6 +230,7 @@ int main(int argc, char **argv) qInfo() << " -show-exclude-libs : Print exclude libraries list."; qInfo() << " -verbose=<0-3> : 0 = no output, 1 = error/warning (default),"; qInfo() << " 2 = normal, 3 = debug."; + qInfo() << " -updateinformation= : Embed update information STRING; if zsyncmake is installed, generate zsync file"; qInfo() << " -version : Print version statement and exit."; qInfo() << ""; qInfo() << "linuxdeployqt takes an application as input and makes it"; diff --git a/tools/linuxdeployqt/shared.cpp b/tools/linuxdeployqt/shared.cpp index 632ed8e..1cff203 100644 --- a/tools/linuxdeployqt/shared.cpp +++ b/tools/linuxdeployqt/shared.cpp @@ -63,6 +63,7 @@ QStringList extraQtPlugins; QStringList excludeLibs; QStringList ignoreGlob; bool copyCopyrightFiles = true; +QString updateInformation; using std::cout; using std::endl; @@ -1777,7 +1778,17 @@ bool checkAppImagePrerequisites(const QString &appDirPath) int createAppImage(const QString &appDirPath) { - QString appImageCommand = "appimagetool '" + appDirPath + "' -n -g"; // +"' '" + appImagePath + "'"; + QString updateInfoArgument; + + if (updateInformation.isEmpty()) { + // if there is no user-supplied update info, guess + updateInfoArgument = "-g"; + } else { + updateInfoArgument = QString("-u '%1'").arg(updateInformation); + } + + QString appImageCommand = "appimagetool -v '" + appDirPath + "' -n " + updateInfoArgument; // +"' '" + appImagePath + "'"; + LogNormal() << appImageCommand; int ret = system(appImageCommand.toUtf8().constData()); LogNormal() << "ret" << ret; LogNormal() << "WEXITSTATUS(ret)" << WEXITSTATUS(ret);