From 1e1f146c386b4220450b81eb752c0733a9a9b4e9 Mon Sep 17 00:00:00 2001 From: Tom Dewey Date: Thu, 25 Jul 2024 15:27:01 +0100 Subject: [PATCH 1/2] multiple deployers: Ignore .debug files This commit replicates a pattern from the TextToSpeechPluginsDeployer into the BasicPluginsDeployer - to affect all standard deployers. Essentially - it's extremely unlikely that composing an AppImage with debug symbols is what a user actually wants to do. I'm also not aware of a good story for connecting debug symbols to an AppImage at all. As a result, let's make a sensible choice - and not package them. Trust that developers will use their underlying build system for Debug, and that release tracking will allow developers to tie an AppImage back to a source control revision. Finally, note that this works around an interesting aarch64 bug - where the .debug files that are created are marked as x86_64 ELF binaries - even when you are _building on an aarch64 host_. --- src/deployers/BasicPluginsDeployer.cpp | 4 ++++ src/deployment.h | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/deployers/BasicPluginsDeployer.cpp b/src/deployers/BasicPluginsDeployer.cpp index f636fed..36d1299 100644 --- a/src/deployers/BasicPluginsDeployer.cpp +++ b/src/deployers/BasicPluginsDeployer.cpp @@ -39,6 +39,10 @@ bool BasicPluginsDeployer::deployStandardQtPlugins(const std::vectorpath().extension() == ".debug") { + ldLog() << LD_DEBUG << "skipping .debug file:" << i->path() << std::endl; + continue; + } // add a trailing slash, so pluginName is used as a destination directory, not a file. if (!appDir.deployLibrary(*i, appDir.path() / "usr/plugins" / pluginName / "")) return false; diff --git a/src/deployment.h b/src/deployment.h index 04df3a1..047941a 100644 --- a/src/deployment.h +++ b/src/deployment.h @@ -37,6 +37,10 @@ inline bool deployIntegrationPlugins(appdir::AppDir& appDir, const fs::path& qtP // otherwise, when the directory doesn't exist, it might just copy all files to files called like // destinationDir auto destinationDir = appDir.path() / "usr/plugins" / subDir / ""; + if (i->path().extension() == ".debug") { + ldLog() << LD_DEBUG << "skipping .debug file:" << i->path() << std::endl; + continue; + } if (!appDir.deployLibrary(*i, destinationDir)) return false; From f2c86e4f826fa4957242ccb3943a12795f0625cd Mon Sep 17 00:00:00 2001 From: Tom Dewey Date: Mon, 2 Sep 2024 15:38:17 +0100 Subject: [PATCH 2/2] deployers: Simplify TextToSpeechPluginsDeployer With the refactor of BasicPluginsDeployer, we can collapse the contents of the TextToSpeechPluginsDeployer to just a call into the base class, with the appropriate argument. --- src/deployers/TextToSpeechPluginsDeployer.cpp | 32 +------------------ 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/src/deployers/TextToSpeechPluginsDeployer.cpp b/src/deployers/TextToSpeechPluginsDeployer.cpp index 8b8e2c2..ddf5a3d 100644 --- a/src/deployers/TextToSpeechPluginsDeployer.cpp +++ b/src/deployers/TextToSpeechPluginsDeployer.cpp @@ -1,38 +1,8 @@ -// system headers -#include - -// library headers -#include - // local headers #include "TextToSpeechPluginsDeployer.h" using namespace linuxdeploy::plugin::qt; -using namespace linuxdeploy::core::log; - -namespace fs = std::filesystem; bool TextToSpeechPluginsDeployer::doDeploy() { - // calling the default code is optional, but it won't hurt for now - if (!BasicPluginsDeployer::deploy()) - return false; - - const std::string pluginsName = "texttospeech"; - - ldLog() << "Deploying" << pluginsName << "plugins" << std::endl; - - for (fs::directory_iterator i(qtPluginsPath / pluginsName); i != fs::directory_iterator(); ++i) { - if (i->path().extension() == ".debug") { - ldLog() << LD_DEBUG << "skipping .debug file:" << i->path() << std::endl; - continue; - } - - // terminate with a "/" to make sure the deployer will deploy the file into the target directory properly - // has to be cast to string, unfortunately, as std::filesystem doesn't allow for adding a terminating / - const auto targetPath = (appDir.path() / "usr/plugins/" / pluginsName).string() + "/"; - if (!appDir.deployLibrary(*i, targetPath)) - return false; - } - - return true; + return deployStandardQtPlugins({"texttospeech"}); }