[packagechooser] Be more clear on the resulting GS keys
- in legacy mode, *id* can have an effect and leads to "packagechooser_<id>"; if unset, uses the the module instance id instead, still as "packagechooser_<instanceid>". - in packages mode, *id* is not used and only the whole module Id (generally, "packagechooser@<instanceid>") is used, but in packages mode there's no need for other packages to mess with GS settings for this packagechooser.
This commit is contained in:
parent
aa3633e43a
commit
f4fe0881b9
@ -90,20 +90,16 @@ Config::introductionPackage() const
|
|||||||
void
|
void
|
||||||
Config::updateGlobalStorage( const QStringList& selected ) const
|
Config::updateGlobalStorage( const QStringList& selected ) const
|
||||||
{
|
{
|
||||||
const QString& key = m_id;
|
|
||||||
cDebug() << "Writing to GS" << key;
|
|
||||||
|
|
||||||
if ( m_method == PackageChooserMethod::Legacy )
|
if ( m_method == PackageChooserMethod::Legacy )
|
||||||
{
|
{
|
||||||
QString value = selected.join( ',' );
|
QString value = selected.join( ',' );
|
||||||
Calamares::JobQueue::instance()->globalStorage()->insert( key, value );
|
Calamares::JobQueue::instance()->globalStorage()->insert( m_id, value );
|
||||||
|
cDebug() << m_id<< "selected" << value;
|
||||||
cDebug() << Logger::SubEntry << "PackageChooser" << key << "selected" << value;
|
|
||||||
}
|
}
|
||||||
else if ( m_method == PackageChooserMethod::Packages )
|
else if ( m_method == PackageChooserMethod::Packages )
|
||||||
{
|
{
|
||||||
QStringList packageNames = m_model->getInstallPackagesForNames( selected );
|
QStringList packageNames = m_model->getInstallPackagesForNames( selected );
|
||||||
cDebug() << Logger::SubEntry << "Got packages" << packageNames;
|
cDebug() << m_defaultId << "packages to install" << packageNames;
|
||||||
CalamaresUtils::Packages::setGSPackageAdditions(
|
CalamaresUtils::Packages::setGSPackageAdditions(
|
||||||
Calamares::JobQueue::instance()->globalStorage(), m_defaultId, packageNames );
|
Calamares::JobQueue::instance()->globalStorage(), m_defaultId, packageNames );
|
||||||
}
|
}
|
||||||
@ -181,20 +177,27 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
|
|||||||
m_method = PackageChooserMethodNames().find( CalamaresUtils::getString( configurationMap, "method" ),
|
m_method = PackageChooserMethodNames().find( CalamaresUtils::getString( configurationMap, "method" ),
|
||||||
PackageChooserMethod::Legacy );
|
PackageChooserMethod::Legacy );
|
||||||
|
|
||||||
|
if ( m_method == PackageChooserMethod::Legacy )
|
||||||
{
|
{
|
||||||
const QString configId = CalamaresUtils::getString( configurationMap, "id" );
|
const QString configId = CalamaresUtils::getString( configurationMap, "id" );
|
||||||
|
const QString base = QStringLiteral( "packagechooser_" );
|
||||||
if ( configId.isEmpty() )
|
if ( configId.isEmpty() )
|
||||||
{
|
{
|
||||||
m_id = m_defaultId.toString();
|
if ( m_defaultId.id().isEmpty() )
|
||||||
if ( m_id.isEmpty() )
|
|
||||||
{
|
{
|
||||||
m_id = QString( "packagechooser" );
|
// We got nothing to work with
|
||||||
|
m_id = base;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_id = base + m_defaultId.id();
|
||||||
}
|
}
|
||||||
cDebug() << "Using default ID" << m_id << "from" << m_defaultId.toString();
|
cDebug() << "Using default ID" << m_id << "from" << m_defaultId.toString();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_id = QStringLiteral( "packagechooser_" ) + configId;
|
m_id = base + configId;
|
||||||
|
cDebug() << "Using configured ID" << m_id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,8 +18,8 @@ mode: required
|
|||||||
# has been made. The key is *packagechooser_<id>*. Normally, the module's
|
# has been made. The key is *packagechooser_<id>*. Normally, the module's
|
||||||
# instance name is used; see the *instances* section of `settings.conf`.
|
# instance name is used; see the *instances* section of `settings.conf`.
|
||||||
# If there is just one packagechooser module, and no special instance is set,
|
# If there is just one packagechooser module, and no special instance is set,
|
||||||
# resulting GS key is probably *packagechooser_packagechooser*.
|
# resulting GS key is probably *packagechooser@packagechooser*.
|
||||||
# You can set "id" to change that, but it is not recommended.
|
# You can set *id* to change that, but it is not recommended.
|
||||||
#
|
#
|
||||||
# The GS value is a comma-separated list of the IDs of the selected
|
# The GS value is a comma-separated list of the IDs of the selected
|
||||||
# packages, or an empty string if none is selected.
|
# packages, or an empty string if none is selected.
|
||||||
@ -33,12 +33,14 @@ mode: required
|
|||||||
# consumption by the *packages* module (which should appear later
|
# consumption by the *packages* module (which should appear later
|
||||||
# in the `exec` section. These package settings will then be handed
|
# in the `exec` section. These package settings will then be handed
|
||||||
# off to whatever package manager is configured there.
|
# off to whatever package manager is configured there.
|
||||||
|
# The *id* key is not used.
|
||||||
#
|
#
|
||||||
# There is no need to put this module in the `exec` section. There
|
# There is no need to put this module in the `exec` section. There
|
||||||
# are no jobs that this module provides. You should put **other**
|
# are no jobs that this module provides. You should put **other**
|
||||||
# modules, either *contextualprocess* or *packages* or some custom
|
# modules, either *contextualprocess* or *packages* or some custom
|
||||||
# module, in the `exec` section to do the actual work.
|
# module, in the `exec` section to do the actual work.
|
||||||
method: legacy
|
method: legacy
|
||||||
|
# The *id* key is used only in "legacy" mode
|
||||||
# id: ""
|
# id: ""
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user