Merge branch 'master' of https://github.com/calamares/calamares into development

This commit is contained in:
Philip Müller 2019-10-23 11:05:16 +02:00
commit ceb7663242
5 changed files with 54 additions and 29 deletions

12
CHANGES
View File

@ -3,6 +3,18 @@ contributors are listed. Note that Calamares does not have a historical
changelog -- this log starts with version 3.2.0. The release notes on the changelog -- this log starts with version 3.2.0. The release notes on the
website will have to do for older versions. website will have to do for older versions.
# 3.2.16 (unreleased) #
This release contains contributions from (alphabetically by first name):
- No other contributors this time around.
## Core ##
- No changes to core functionality
## Modules ##
- No changes to module functionality
# 3.2.15 (2019-10-11) # # 3.2.15 (2019-10-11) #
This release contains contributions from (alphabetically by first name): This release contains contributions from (alphabetically by first name):

View File

@ -40,10 +40,10 @@
cmake_minimum_required( VERSION 3.3 FATAL_ERROR ) cmake_minimum_required( VERSION 3.3 FATAL_ERROR )
project( CALAMARES project( CALAMARES
VERSION 3.2.15 VERSION 3.2.16
LANGUAGES C CXX ) LANGUAGES C CXX )
set( CALAMARES_VERSION_RC 0 ) # Set to 0 during release cycle, 1 during development set( CALAMARES_VERSION_RC 1 ) # Set to 0 during release cycle, 1 during development
### OPTIONS ### OPTIONS
# #

View File

@ -86,9 +86,11 @@ setButtonIcon( QPushButton* button, const QString& name )
* to worry about as well as state. * to worry about as well as state.
*/ */
static inline QPushButton* static inline QPushButton*
makeButton( QWidget* parent, const QString& name ) makeButton( QWidget* parent, const QString& name, const QString& label )
{ {
QPushButton* button = new QPushButton( parent ); QPushButton* button = new QPushButton( parent );
button->setObjectName( name );
button->setText( label );
setButtonIcon( button, name ); setButtonIcon( button, name );
return button; return button;
} }
@ -108,9 +110,9 @@ ViewManager::ViewManager( QObject* parent )
mainLayout->addWidget( m_stack ); mainLayout->addWidget( m_stack );
// Create buttons and sets an initial icon; the icons may change // Create buttons and sets an initial icon; the icons may change
m_back = makeButton( m_widget, "go-previous" ); m_back = makeButton( m_widget, QStringLiteral( "go-previous" ), tr( "&Back" ) );
m_next = makeButton( m_widget, "go-next" ); m_next = makeButton( m_widget, QStringLiteral( "go-next" ), tr( "&Next" ) );
m_quit = makeButton( m_widget, "dialog-cancel" ); m_quit = makeButton( m_widget, QStringLiteral( "dialog-cancel" ), tr( "&Cancel" ) );
CALAMARES_RETRANSLATE_SLOT( &ViewManager::updateButtonLabels ) CALAMARES_RETRANSLATE_SLOT( &ViewManager::updateButtonLabels )

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 );
@ -128,8 +131,11 @@ ModuleManager::doInit()
cDebug() << "ModuleManager module search path does not exist:" << path; cDebug() << "ModuleManager module search path does not exist:" << path;
} }
} }
// At this point m_availableModules is filled with whatever was found in the // At this point m_availableDescriptorsByModuleName is filled with
// search paths. // the modules that were found in the search paths.
cDebug() << "Found"
<< m_availableDescriptorsByModuleName.count() << "modules"
<< m_moduleDirectoriesByModuleName.count() << "names";
emit initDone(); emit initDone();
} }
@ -182,11 +188,15 @@ findCustomInstance( const Settings::InstanceDescriptionList& customInstances, co
void void
ModuleManager::loadModules() ModuleManager::loadModules()
{ {
QStringList failedModules = checkDependencies(); if (checkDependencies())
{
cWarning() << "Some installed modules have unmet dependencies.";
}
Settings::InstanceDescriptionList customInstances = Settings::instance()->customModuleInstances(); Settings::InstanceDescriptionList customInstances = Settings::instance()->customModuleInstances();
QStringList failedModules;
const auto modulesSequence const auto modulesSequence
= failedModules.isEmpty() ? Settings::instance()->modulesSequence() : Settings::ModuleSequence(); = Settings::instance()->modulesSequence() ;
for ( const auto& modulePhase : modulesSequence ) for ( const auto& modulePhase : modulesSequence )
{ {
ModuleSystem::Action currentAction = modulePhase.first; ModuleSystem::Action currentAction = modulePhase.first;
@ -264,7 +274,7 @@ ModuleManager::loadModules()
continue; continue;
} }
if ( !checkDependencies( *thisModule ) ) if ( !checkModuleDependencies( *thisModule ) )
{ {
// Error message is already printed // Error message is already printed
failedModules.append( instanceKey.toString() ); failedModules.append( instanceKey.toString() );
@ -345,10 +355,10 @@ missingRequiredModules( const QStringList& required, const QMap< QString, QVaria
return l; return l;
} }
QStringList size_t
ModuleManager::checkDependencies() ModuleManager::checkDependencies()
{ {
QStringList failed; size_t numberRemoved = 0;
bool somethingWasRemovedBecauseOfUnmetDependencies = false; bool somethingWasRemovedBecauseOfUnmetDependencies = false;
// This goes through the map of available modules, and deletes those whose // This goes through the map of available modules, and deletes those whose
@ -367,19 +377,18 @@ ModuleManager::checkDependencies()
QString moduleName = it->value( "name" ).toString(); QString moduleName = it->value( "name" ).toString();
somethingWasRemovedBecauseOfUnmetDependencies = true; somethingWasRemovedBecauseOfUnmetDependencies = true;
m_availableDescriptorsByModuleName.erase( it ); m_availableDescriptorsByModuleName.erase( it );
failed << moduleName; numberRemoved++;
cWarning() << "Module" << moduleName << "requires modules" << Logger::DebugList( unmet ); cWarning() << "Module" << moduleName << "requires missing modules" << Logger::DebugList( unmet );
cWarning() << Logger::SubEntry << "but these are not available (listed in settings, or installed).";
break; break;
} }
} }
} while ( somethingWasRemovedBecauseOfUnmetDependencies ); } while ( somethingWasRemovedBecauseOfUnmetDependencies );
return failed; return numberRemoved;
} }
bool bool
ModuleManager::checkDependencies( const Module& m ) ModuleManager::checkModuleDependencies( const Module& m )
{ {
bool allRequirementsFound = true; bool allRequirementsFound = true;
QStringList requiredModules QStringList requiredModules

View File

@ -106,15 +106,17 @@ private slots:
private: private:
/** /**
* Check in a general sense whether the dependencies between * Check in a general sense whether the dependencies between
* modules are valid. Returns a list of module names that * modules are valid. Returns the number of modules that
* do **not** have their requirements met. * have missing dependencies -- this is **not** a problem
* unless any of those modules are actually used.
* *
* Returns an empty list on success. * Returns 0 on success.
* *
* Also modifies m_availableDescriptorsByModuleName to remove * Also modifies m_availableDescriptorsByModuleName to remove
* all the entries that fail. * all the entries that (so that later, when we try to look
* them up, they are not found).
*/ */
QStringList checkDependencies(); size_t checkDependencies();
/** /**
* Check for this specific module if its required modules have * Check for this specific module if its required modules have
@ -122,7 +124,7 @@ private:
* *
* Returns true if the requirements are met. * Returns true if the requirements are met.
*/ */
bool checkDependencies( const Module& ); bool checkModuleDependencies( const Module& );
QMap< QString, QVariantMap > m_availableDescriptorsByModuleName; QMap< QString, QVariantMap > m_availableDescriptorsByModuleName;
QMap< QString, QString > m_moduleDirectoriesByModuleName; QMap< QString, QString > m_moduleDirectoriesByModuleName;