Queue module jobs in the order they are listed in the "install" section of settings.conf
This commit is contained in:
parent
1b64917385
commit
b5b72855c3
@ -25,10 +25,10 @@ prepare:
|
||||
# View modules are not shown. Only the view modules shown in the previous phase are
|
||||
# allowed, their names should be added here as placeholders to specify the order in
|
||||
# which view module jobs should be enqueued. Job modules are also allowed.
|
||||
install: #TODO: actually use this
|
||||
install:
|
||||
- dummyprocess
|
||||
- dummypython
|
||||
#- partition
|
||||
- partition
|
||||
#- unsquashfs
|
||||
- locale
|
||||
- keyboard
|
||||
|
@ -165,14 +165,10 @@ CalamaresApplication::initPlugins()
|
||||
Calamares::ViewManager* vm = Calamares::ViewManager::instance();
|
||||
Calamares::JobQueue* queue = Calamares::JobQueue::instance();
|
||||
|
||||
//FIXME: we should enqueue viewmodule jobs in the order from settings.conf,
|
||||
// not in the order they show up in the UI
|
||||
// Ideally, if a module is a viewmodule and isLoaded we should ask
|
||||
// for jobs, else if it's a viewmodule and not isLoaded we bail with
|
||||
// error, else if jobmodule and not isLoaded, just loadSelf.
|
||||
for( Calamares::ViewStep* step : vm->prepareSteps() )
|
||||
for( const QString& name : Calamares::Settings::instance()->modules( Calamares::Install ) )
|
||||
{
|
||||
queue->enqueue( step->jobs() );
|
||||
Calamares::Module* module = m_moduleManager->module( name );
|
||||
queue->enqueue( module->jobs() );
|
||||
}
|
||||
connect( queue, &Calamares::JobQueue::failed,
|
||||
vm, &Calamares::ViewManager::onInstallationFailed );
|
||||
|
@ -21,6 +21,8 @@
|
||||
|
||||
#include "UiDllMacro.h"
|
||||
|
||||
#include <Typedefs.h>
|
||||
|
||||
#include <QStringList>
|
||||
#include <QVariant>
|
||||
|
||||
@ -69,6 +71,8 @@ public:
|
||||
|
||||
virtual void loadSelf() = 0;
|
||||
|
||||
virtual QList< job_ptr > jobs() const = 0;
|
||||
|
||||
protected:
|
||||
explicit Module();
|
||||
virtual void initFrom( const YAML::Node& node );
|
||||
|
@ -18,7 +18,6 @@
|
||||
|
||||
#include "ProcessJobModule.h"
|
||||
|
||||
#include "JobQueue.h"
|
||||
#include "ProcessJob.h"
|
||||
|
||||
#include <QDir>
|
||||
@ -48,14 +47,20 @@ ProcessJobModule::loadSelf()
|
||||
if ( m_loaded )
|
||||
return;
|
||||
|
||||
Calamares::job_ptr j = Calamares::job_ptr( new ProcessJob( m_command,
|
||||
m_workingPath,
|
||||
m_secondsTimeout ) );
|
||||
JobQueue::instance()->enqueue( j );
|
||||
m_job = Calamares::job_ptr( new ProcessJob( m_command,
|
||||
m_workingPath,
|
||||
m_secondsTimeout ) );
|
||||
m_loaded = true;
|
||||
}
|
||||
|
||||
|
||||
QList< job_ptr >
|
||||
ProcessJobModule::jobs() const
|
||||
{
|
||||
return QList< job_ptr >() << m_job;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ProcessJobModule::initFrom( const YAML::Node& node )
|
||||
{
|
||||
|
@ -32,6 +32,7 @@ public:
|
||||
Interface interface() const override;
|
||||
|
||||
void loadSelf() override;
|
||||
QList< job_ptr > jobs() const override;
|
||||
|
||||
protected:
|
||||
void initFrom( const YAML::Node &node ) override;
|
||||
@ -44,6 +45,7 @@ private:
|
||||
QString m_command;
|
||||
QString m_workingPath;
|
||||
int m_secondsTimeout;
|
||||
job_ptr m_job;
|
||||
};
|
||||
|
||||
} // namespace Calamares
|
||||
|
@ -18,7 +18,6 @@
|
||||
|
||||
#include "PythonJobModule.h"
|
||||
|
||||
#include "JobQueue.h"
|
||||
#include "PythonJob.h"
|
||||
|
||||
#include <yaml-cpp/yaml.h>
|
||||
@ -49,14 +48,20 @@ PythonJobModule::loadSelf()
|
||||
if ( m_loaded )
|
||||
return;
|
||||
|
||||
Calamares::job_ptr j = Calamares::job_ptr( new PythonJob( m_scriptFileName,
|
||||
m_workingPath,
|
||||
m_configurationMap ) );
|
||||
JobQueue::instance()->enqueue( j );
|
||||
m_job = Calamares::job_ptr( new PythonJob( m_scriptFileName,
|
||||
m_workingPath,
|
||||
m_configurationMap ) );
|
||||
m_loaded = true;
|
||||
}
|
||||
|
||||
|
||||
QList< job_ptr >
|
||||
PythonJobModule::jobs() const
|
||||
{
|
||||
return QList< job_ptr >() << m_job;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PythonJobModule::initFrom( const YAML::Node& node )
|
||||
{
|
||||
|
@ -32,6 +32,7 @@ public:
|
||||
Interface interface() const override;
|
||||
|
||||
void loadSelf() override;
|
||||
QList< job_ptr > jobs() const override;
|
||||
|
||||
protected:
|
||||
void initFrom( const YAML::Node &node ) override;
|
||||
@ -43,6 +44,7 @@ private:
|
||||
|
||||
QString m_scriptFileName;
|
||||
QString m_workingPath;
|
||||
job_ptr m_job;
|
||||
};
|
||||
|
||||
} // namespace Calamares
|
||||
|
@ -50,11 +50,11 @@ ViewModule::loadSelf()
|
||||
cDebug() << Q_FUNC_INFO << "for module" << name();
|
||||
if ( m_loader )
|
||||
{
|
||||
ViewStep *vs = qobject_cast< ViewStep* >( m_loader->instance() );
|
||||
vs->setConfigurationMap( m_configurationMap );
|
||||
if ( vs )
|
||||
m_viewStep = qobject_cast< ViewStep* >( m_loader->instance() );
|
||||
m_viewStep->setConfigurationMap( m_configurationMap );
|
||||
if ( m_viewStep )
|
||||
{
|
||||
ViewManager::instance()->addViewStep( vs );
|
||||
ViewManager::instance()->addViewStep( m_viewStep );
|
||||
m_loaded = true;
|
||||
}
|
||||
else
|
||||
@ -65,6 +65,13 @@ ViewModule::loadSelf()
|
||||
}
|
||||
|
||||
|
||||
QList< job_ptr >
|
||||
ViewModule::jobs() const
|
||||
{
|
||||
return m_viewStep->jobs();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ViewModule::initFrom( const YAML::Node& node )
|
||||
{
|
||||
|
@ -26,6 +26,8 @@ class QPluginLoader;
|
||||
|
||||
namespace Calamares {
|
||||
|
||||
class ViewStep;
|
||||
|
||||
class UIDLLEXPORT ViewModule : public Module
|
||||
{
|
||||
public:
|
||||
@ -33,6 +35,7 @@ public:
|
||||
Interface interface() const override;
|
||||
|
||||
void loadSelf() override;
|
||||
QList< job_ptr > jobs() const override;
|
||||
|
||||
protected:
|
||||
void initFrom( const YAML::Node &node ) override;
|
||||
@ -43,6 +46,7 @@ private:
|
||||
virtual ~ViewModule();
|
||||
|
||||
QPluginLoader *m_loader;
|
||||
ViewStep* m_viewStep = nullptr;
|
||||
};
|
||||
|
||||
} // namespace Calamares
|
||||
|
Loading…
Reference in New Issue
Block a user