• R/O
  • HTTP
  • SSH
  • HTTPS

alterlinux-calamares: Commit

GitHubのミラーです
https://github.com/FascodeNet/alterlinux-calamares


Commit MetaInfo

Révision96aa5b45328a4c2f76a016aa2c5cf4fd141ed0d6 (tree)
l'heure2021-09-27 21:27:50
AuteurAdriaan de Groot <groot@kde....>
CommiterAdriaan de Groot

Message de Log

Merge branch 'improve-loadmodule' into calamares

Change Summary

Modification

--- a/src/calamares/testmain.cpp
+++ b/src/calamares/testmain.cpp
@@ -71,22 +71,20 @@ handle_args( QCoreApplication& a )
7171 {
7272 QCommandLineOption debugLevelOption(
7373 QStringLiteral( "D" ), "Verbose output for debugging purposes (0-8), ignored.", "level" );
74- QCommandLineOption globalOption( QStringList() << QStringLiteral( "g" ) << QStringLiteral( "global " ),
74+ QCommandLineOption globalOption( { QStringLiteral( "g" ), QStringLiteral( "global" ) },
7575 QStringLiteral( "Global settings document" ),
7676 "global.yaml" );
77- QCommandLineOption jobOption( QStringList() << QStringLiteral( "j" ) << QStringLiteral( "job" ),
78- QStringLiteral( "Job settings document" ),
79- "job.yaml" );
80- QCommandLineOption langOption( QStringList() << QStringLiteral( "l" ) << QStringLiteral( "language" ),
77+ QCommandLineOption jobOption(
78+ { QStringLiteral( "j" ), QStringLiteral( "job" ) }, QStringLiteral( "Job settings document" ), "job.yaml" );
79+ QCommandLineOption langOption( { QStringLiteral( "l" ), QStringLiteral( "language" ) },
8180 QStringLiteral( "Language (global)" ),
8281 "languagecode" );
83- QCommandLineOption brandOption( QStringList() << QStringLiteral( "b" ) << QStringLiteral( "branding" ),
82+ QCommandLineOption brandOption( { QStringLiteral( "b" ), QStringLiteral( "branding" ) },
8483 QStringLiteral( "Branding directory" ),
8584 "path/to/branding.desc",
8685 "src/branding/default/branding.desc" );
87- QCommandLineOption uiOption( QStringList() << QStringLiteral( "U" ) << QStringLiteral( "ui" ),
88- QStringLiteral( "Enable UI" ) );
89- QCommandLineOption slideshowOption( QStringList() << QStringLiteral( "s" ) << QStringLiteral( "slideshow" ),
86+ QCommandLineOption uiOption( { QStringLiteral( "U" ), QStringLiteral( "ui" ) }, QStringLiteral( "Enable UI" ) );
87+ QCommandLineOption slideshowOption( { QStringLiteral( "s" ), QStringLiteral( "slideshow" ) },
9088 QStringLiteral( "Run slideshow module" ) );
9189 QCommandLineParser parser;
9290 parser.setApplicationDescription( "Calamares module tester" );
@@ -101,7 +99,7 @@ handle_args( QCoreApplication& a )
10199 parser.addOption( uiOption );
102100 parser.addOption( slideshowOption );
103101 #ifdef WITH_PYTHON
104- QCommandLineOption pythonOption( QStringList() << QStringLiteral( "P" ) << QStringLiteral( "no-injected-python" ),
102+ QCommandLineOption pythonOption( { QStringLiteral( "P" ), QStringLiteral( "no-injected-python" ) },
105103 QStringLiteral( "Do not disable potentially-harmful Python commands" ) );
106104 parser.addOption( pythonOption );
107105 #endif
@@ -143,8 +141,7 @@ handle_args( QCoreApplication& a )
143141 parser.value( langOption ),
144142 parser.value( brandOption ),
145143 parser.isSet( slideshowOption ) || parser.isSet( uiOption ),
146- pythonInjection
147- };
144+ pythonInjection };
148145 }
149146 }
150147
@@ -299,7 +296,8 @@ load_module( const ModuleConfig& moduleConfig )
299296 bool ok = false;
300297 QVariantMap descriptor;
301298
302- for ( const QString& prefix : QStringList { "./", "src/modules/", "modules/" } )
299+ QStringList moduleDirectories { "./", "src/modules/", "modules/", CMAKE_INSTALL_FULL_LIBDIR "/calamares/modules/" };
300+ for ( const QString& prefix : qAsConst( moduleDirectories ) )
303301 {
304302 // Could be a complete path, eg. src/modules/dummycpp/module.desc
305303 fi = QFileInfo( prefix + moduleName );
@@ -325,12 +323,23 @@ load_module( const ModuleConfig& moduleConfig )
325323 {
326324 break;
327325 }
326+ else
327+ {
328+ if ( !fi.exists() )
329+ {
330+ cDebug() << "Expected a descriptor file" << fi.path();
331+ }
332+ else
333+ {
334+ cDebug() << "Read descriptor" << fi.path() << "and it was empty.";
335+ }
336+ }
328337 }
329338 }
330339
331340 if ( !ok )
332341 {
333- cWarning() << "No suitable module descriptor found.";
342+ cWarning() << "No suitable module descriptor found in" << Logger::DebugList( moduleDirectories );
334343 return nullptr;
335344 }
336345
@@ -461,7 +470,7 @@ main( int argc, char* argv[] )
461470 #ifdef WITH_PYTHON
462471 if ( module.m_pythonInjection )
463472 {
464- Calamares::PythonJob::setInjectedPreScript(pythonPreScript);
473+ Calamares::PythonJob::setInjectedPreScript( pythonPreScript );
465474 }
466475 #endif
467476 #ifdef WITH_QML
--- a/src/libcalamares/PythonJob.cpp
+++ b/src/libcalamares/PythonJob.cpp
@@ -330,7 +330,8 @@ void
330330 PythonJob::setInjectedPreScript( const char* preScript )
331331 {
332332 s_preScript = preScript;
333- cDebug() << "Python pre-script set to" << Logger::Pointer( preScript );
333+ cDebug() << "Python pre-script set to string" << Logger::Pointer( preScript ) << "length"
334+ << ( preScript ? strlen( preScript ) : 0 );
334335 }
335336
336337 } // namespace Calamares
Afficher sur ancien navigateur de dépôt.