[libcalamaresui] Improve debug message for bad dirs

- Calamares scans **all** subdirs of the module-directory
   for a module.desc and complains about those that don't have
   a module.desc.
 - For ./calamares -d runs from the build-directory, this
   leads to a few complaints when some plugins have been
   ignored (and so no module.desc is generated for them).
This commit is contained in:
Adriaan de Groot 2019-10-21 18:08:16 +02:00
parent 300ebaaa03
commit c4b0511f8d

View File

@ -91,17 +91,20 @@ ModuleManager::doInit()
bool success = currentDir.cd( subdir ); bool success = currentDir.cd( subdir );
if ( success ) if ( success )
{ {
static const char bad_descriptor[] = "ModuleManager potential module descriptor is bad";
QFileInfo descriptorFileInfo( currentDir.absoluteFilePath( QLatin1String( "module.desc" ) ) ); QFileInfo descriptorFileInfo( currentDir.absoluteFilePath( QLatin1String( "module.desc" ) ) );
if ( !descriptorFileInfo.exists() ) if ( !descriptorFileInfo.exists() )
{ {
cDebug() << "ModuleManager expected descriptor is missing:" cDebug() << bad_descriptor
<< descriptorFileInfo.absoluteFilePath(); << descriptorFileInfo.absoluteFilePath()
<< "(missing)";
continue; continue;
} }
if ( !descriptorFileInfo.isReadable() ) if ( !descriptorFileInfo.isReadable() )
{ {
cDebug() << "ModuleManager descriptor file is unreadable:" cDebug() << bad_descriptor
<< descriptorFileInfo.absoluteFilePath(); << descriptorFileInfo.absoluteFilePath()
<< "(unreadable)";
continue; continue;
} }
@ -109,7 +112,7 @@ ModuleManager::doInit()
QVariantMap moduleDescriptorMap = CalamaresUtils::loadYaml( descriptorFileInfo, &ok ); QVariantMap moduleDescriptorMap = CalamaresUtils::loadYaml( descriptorFileInfo, &ok );
QString moduleName = ok ? moduleDescriptorMap.value( "name" ).toString() : QString(); QString moduleName = ok ? moduleDescriptorMap.value( "name" ).toString() : QString();
if ( ok && ( moduleName == currentDir.dirName() ) if ( ok && !moduleName.isEmpty() && ( moduleName == currentDir.dirName() )
&& !m_availableDescriptorsByModuleName.contains( moduleName ) ) && !m_availableDescriptorsByModuleName.contains( moduleName ) )
{ {
m_availableDescriptorsByModuleName.insert( moduleName, moduleDescriptorMap ); m_availableDescriptorsByModuleName.insert( moduleName, moduleDescriptorMap );