From 657a36310bb8e7199ad5ac897160469c5df16f13 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 27 Sep 2021 13:18:12 +0200 Subject: [PATCH 1/5] [libcalamares] Log the Python pre-script a little better - Make clear that the @ is a string-location, and how long the pre-script is (although in practice, it will be either null and 0, or the values set in the loadmodule executable). --- src/libcalamares/PythonJob.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libcalamares/PythonJob.cpp b/src/libcalamares/PythonJob.cpp index 1a4683c29..201f56a15 100644 --- a/src/libcalamares/PythonJob.cpp +++ b/src/libcalamares/PythonJob.cpp @@ -330,7 +330,8 @@ void PythonJob::setInjectedPreScript( const char* preScript ) { s_preScript = preScript; - cDebug() << "Python pre-script set to" << Logger::Pointer( preScript ); + cDebug() << "Python pre-script set to string" << Logger::Pointer( preScript ) << "length" + << ( preScript ? strlen( preScript ) : 0 ); } } // namespace Calamares From de9e6a7d7086b2d4859ac6fa869afd19ab337969 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 27 Sep 2021 13:27:36 +0200 Subject: [PATCH 2/5] [calamares] Log module-searching in the test-application --- src/calamares/testmain.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/calamares/testmain.cpp b/src/calamares/testmain.cpp index 6d75a4fbb..35cddfce8 100644 --- a/src/calamares/testmain.cpp +++ b/src/calamares/testmain.cpp @@ -143,8 +143,7 @@ handle_args( QCoreApplication& a ) parser.value( langOption ), parser.value( brandOption ), parser.isSet( slideshowOption ) || parser.isSet( uiOption ), - pythonInjection - }; + pythonInjection }; } } @@ -299,7 +298,8 @@ load_module( const ModuleConfig& moduleConfig ) bool ok = false; QVariantMap descriptor; - for ( const QString& prefix : QStringList { "./", "src/modules/", "modules/" } ) + QStringList moduleDirectories { "./", "src/modules/", "modules/" }; + for ( const QString& prefix : qAsConst( moduleDirectories ) ) { // Could be a complete path, eg. src/modules/dummycpp/module.desc fi = QFileInfo( prefix + moduleName ); @@ -330,7 +330,7 @@ load_module( const ModuleConfig& moduleConfig ) if ( !ok ) { - cWarning() << "No suitable module descriptor found."; + cWarning() << "No suitable module descriptor found in" << Logger::DebugList( moduleDirectories ); return nullptr; } @@ -461,7 +461,7 @@ main( int argc, char* argv[] ) #ifdef WITH_PYTHON if ( module.m_pythonInjection ) { - Calamares::PythonJob::setInjectedPreScript(pythonPreScript); + Calamares::PythonJob::setInjectedPreScript( pythonPreScript ); } #endif #ifdef WITH_QML From 058e6cbcda1104455c7e0f777e0170f9eedd483a Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 27 Sep 2021 13:34:08 +0200 Subject: [PATCH 3/5] [calamares] Log failed module-load in test-application --- src/calamares/testmain.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/calamares/testmain.cpp b/src/calamares/testmain.cpp index 35cddfce8..c0258eb54 100644 --- a/src/calamares/testmain.cpp +++ b/src/calamares/testmain.cpp @@ -325,6 +325,17 @@ load_module( const ModuleConfig& moduleConfig ) { break; } + else + { + if ( !fi.exists() ) + { + cDebug() << "Expected a descriptor file" << fi.path(); + } + else + { + cDebug() << "Read descriptor" << fi.path() << "and it was empty."; + } + } } } From 7cda1d2edde0e3e0e4c682adf8028588b2aee23c Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 27 Sep 2021 13:39:27 +0200 Subject: [PATCH 4/5] [calamares] Test-loader tries loading from install-dir, too --- src/calamares/testmain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calamares/testmain.cpp b/src/calamares/testmain.cpp index c0258eb54..1d6971e80 100644 --- a/src/calamares/testmain.cpp +++ b/src/calamares/testmain.cpp @@ -298,7 +298,7 @@ load_module( const ModuleConfig& moduleConfig ) bool ok = false; QVariantMap descriptor; - QStringList moduleDirectories { "./", "src/modules/", "modules/" }; + QStringList moduleDirectories { "./", "src/modules/", "modules/", CMAKE_INSTALL_FULL_LIBDIR "/calamares/modules/" }; for ( const QString& prefix : qAsConst( moduleDirectories ) ) { // Could be a complete path, eg. src/modules/dummycpp/module.desc From 815bb62ae520d24923b6cc1aed8c1340117f508f Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 27 Sep 2021 14:26:43 +0200 Subject: [PATCH 5/5] [calamares] Fix test-application command-line-args - use C++11 uniform-initialization - while here, remove space from name of --global option --- src/calamares/testmain.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/calamares/testmain.cpp b/src/calamares/testmain.cpp index 1d6971e80..9d0189031 100644 --- a/src/calamares/testmain.cpp +++ b/src/calamares/testmain.cpp @@ -71,22 +71,20 @@ handle_args( QCoreApplication& a ) { QCommandLineOption debugLevelOption( QStringLiteral( "D" ), "Verbose output for debugging purposes (0-8), ignored.", "level" ); - QCommandLineOption globalOption( QStringList() << QStringLiteral( "g" ) << QStringLiteral( "global " ), + QCommandLineOption globalOption( { QStringLiteral( "g" ), QStringLiteral( "global" ) }, QStringLiteral( "Global settings document" ), "global.yaml" ); - QCommandLineOption jobOption( QStringList() << QStringLiteral( "j" ) << QStringLiteral( "job" ), - QStringLiteral( "Job settings document" ), - "job.yaml" ); - QCommandLineOption langOption( QStringList() << QStringLiteral( "l" ) << QStringLiteral( "language" ), + QCommandLineOption jobOption( + { QStringLiteral( "j" ), QStringLiteral( "job" ) }, QStringLiteral( "Job settings document" ), "job.yaml" ); + QCommandLineOption langOption( { QStringLiteral( "l" ), QStringLiteral( "language" ) }, QStringLiteral( "Language (global)" ), "languagecode" ); - QCommandLineOption brandOption( QStringList() << QStringLiteral( "b" ) << QStringLiteral( "branding" ), + QCommandLineOption brandOption( { QStringLiteral( "b" ), QStringLiteral( "branding" ) }, QStringLiteral( "Branding directory" ), "path/to/branding.desc", "src/branding/default/branding.desc" ); - QCommandLineOption uiOption( QStringList() << QStringLiteral( "U" ) << QStringLiteral( "ui" ), - QStringLiteral( "Enable UI" ) ); - QCommandLineOption slideshowOption( QStringList() << QStringLiteral( "s" ) << QStringLiteral( "slideshow" ), + QCommandLineOption uiOption( { QStringLiteral( "U" ), QStringLiteral( "ui" ) }, QStringLiteral( "Enable UI" ) ); + QCommandLineOption slideshowOption( { QStringLiteral( "s" ), QStringLiteral( "slideshow" ) }, QStringLiteral( "Run slideshow module" ) ); QCommandLineParser parser; parser.setApplicationDescription( "Calamares module tester" ); @@ -101,7 +99,7 @@ handle_args( QCoreApplication& a ) parser.addOption( uiOption ); parser.addOption( slideshowOption ); #ifdef WITH_PYTHON - QCommandLineOption pythonOption( QStringList() << QStringLiteral( "P" ) << QStringLiteral( "no-injected-python" ), + QCommandLineOption pythonOption( { QStringLiteral( "P" ), QStringLiteral( "no-injected-python" ) }, QStringLiteral( "Do not disable potentially-harmful Python commands" ) ); parser.addOption( pythonOption ); #endif