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