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
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) #
This release contains contributions from (alphabetically by first name):

View File

@ -40,10 +40,10 @@
cmake_minimum_required( VERSION 3.3 FATAL_ERROR )
project( CALAMARES
VERSION 3.2.15
VERSION 3.2.16
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
#

View File

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

View File

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

View File

@ -106,15 +106,17 @@ private slots:
private:
/**
* Check in a general sense whether the dependencies between
* modules are valid. Returns a list of module names that
* do **not** have their requirements met.
* modules are valid. Returns the number of modules that
* 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
* 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
@ -122,7 +124,7 @@ private:
*
* Returns true if the requirements are met.
*/
bool checkDependencies( const Module& );
bool checkModuleDependencies( const Module& );
QMap< QString, QVariantMap > m_availableDescriptorsByModuleName;
QMap< QString, QString > m_moduleDirectoriesByModuleName;