[libcalamares] Extend packages service API
- convenience method to install a (string) list of packages (doesn't do the installation, but adds to GS the list, so that the packages module can handle it).
This commit is contained in:
parent
a7f983db5f
commit
35f4a81768
@ -12,11 +12,11 @@
|
|||||||
#include "GlobalStorage.h"
|
#include "GlobalStorage.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
|
|
||||||
bool
|
static bool
|
||||||
CalamaresUtils::Packages::setGSPackageAdditions( Calamares::GlobalStorage* gs,
|
additions( Calamares::GlobalStorage* gs,
|
||||||
const Calamares::ModuleSystem::InstanceKey& module,
|
const QString& key,
|
||||||
const QVariantList& installPackages,
|
const QVariantList& installPackages,
|
||||||
const QVariantList& tryInstallPackages )
|
const QVariantList& tryInstallPackages )
|
||||||
{
|
{
|
||||||
static const char PACKAGEOP[] = "packageOperations";
|
static const char PACKAGEOP[] = "packageOperations";
|
||||||
|
|
||||||
@ -25,8 +25,6 @@ CalamaresUtils::Packages::setGSPackageAdditions( Calamares::GlobalStorage* gs,
|
|||||||
QVariantList packageOperations = gs->contains( PACKAGEOP ) ? gs->value( PACKAGEOP ).toList() : QVariantList();
|
QVariantList packageOperations = gs->contains( PACKAGEOP ) ? gs->value( PACKAGEOP ).toList() : QVariantList();
|
||||||
cDebug() << "Existing package operations length" << packageOperations.length();
|
cDebug() << "Existing package operations length" << packageOperations.length();
|
||||||
|
|
||||||
const QString key = module.toString();
|
|
||||||
|
|
||||||
// Clear out existing operations for this module, going backwards:
|
// Clear out existing operations for this module, going backwards:
|
||||||
// Sometimes we remove an item, and we don't want the index to
|
// Sometimes we remove an item, and we don't want the index to
|
||||||
// fall off the end of the list.
|
// fall off the end of the list.
|
||||||
@ -66,3 +64,25 @@ CalamaresUtils::Packages::setGSPackageAdditions( Calamares::GlobalStorage* gs,
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
CalamaresUtils::Packages::setGSPackageAdditions( Calamares::GlobalStorage* gs,
|
||||||
|
const Calamares::ModuleSystem::InstanceKey& module,
|
||||||
|
const QVariantList& installPackages,
|
||||||
|
const QVariantList& tryInstallPackages )
|
||||||
|
{
|
||||||
|
return additions( gs, module.toString(), installPackages, tryInstallPackages );
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
CalamaresUtils::Packages::setGSPackageAdditions( Calamares::GlobalStorage* gs,
|
||||||
|
const Calamares::ModuleSystem::InstanceKey& module,
|
||||||
|
const QStringList& installPackages )
|
||||||
|
{
|
||||||
|
QVariantList l;
|
||||||
|
for ( const auto& s : installPackages )
|
||||||
|
{
|
||||||
|
l << s;
|
||||||
|
}
|
||||||
|
return additions( gs, module.toString(), l, QVariantList() );
|
||||||
|
}
|
||||||
|
@ -28,6 +28,14 @@ bool setGSPackageAdditions( Calamares::GlobalStorage* gs,
|
|||||||
const Calamares::ModuleSystem::InstanceKey& module,
|
const Calamares::ModuleSystem::InstanceKey& module,
|
||||||
const QVariantList& installPackages,
|
const QVariantList& installPackages,
|
||||||
const QVariantList& tryInstallPackages );
|
const QVariantList& tryInstallPackages );
|
||||||
|
/** @brief Sets the install-packages GS keys for the given module
|
||||||
|
*
|
||||||
|
* This replaces previously-set install-packages lists. Use this with
|
||||||
|
* plain lists of package names. It does not support try-install.
|
||||||
|
*/
|
||||||
|
bool setGSPackageAdditions( Calamares::GlobalStorage* gs,
|
||||||
|
const Calamares::ModuleSystem::InstanceKey& module,
|
||||||
|
const QStringList& installPackages );
|
||||||
// void setGSPackageRemovals( const Calamares::ModuleSystem::InstanceKey& key, const QVariantList& removePackages );
|
// void setGSPackageRemovals( const Calamares::ModuleSystem::InstanceKey& key, const QVariantList& removePackages );
|
||||||
} // namespace Packages
|
} // namespace Packages
|
||||||
} // namespace CalamaresUtils
|
} // namespace CalamaresUtils
|
||||||
|
Loading…
Reference in New Issue
Block a user