libcalamares: use namespace Calamares::Packages consistently
This commit is contained in:
parent
a9ef587705
commit
641e186b7c
@ -66,18 +66,18 @@ additions( Calamares::GlobalStorage* gs,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CalamaresUtils::Packages::setGSPackageAdditions( Calamares::GlobalStorage* gs,
|
Calamares::Packages::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 )
|
||||||
{
|
{
|
||||||
return additions( gs, module.toString(), installPackages, tryInstallPackages );
|
return additions( gs, module.toString(), installPackages, tryInstallPackages );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CalamaresUtils::Packages::setGSPackageAdditions( Calamares::GlobalStorage* gs,
|
Calamares::Packages::setGSPackageAdditions( Calamares::GlobalStorage* gs,
|
||||||
const Calamares::ModuleSystem::InstanceKey& module,
|
const Calamares::ModuleSystem::InstanceKey& module,
|
||||||
const QStringList& installPackages )
|
const QStringList& installPackages )
|
||||||
{
|
{
|
||||||
QVariantList l;
|
QVariantList l;
|
||||||
for ( const auto& s : installPackages )
|
for ( const auto& s : installPackages )
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
#include "GlobalStorage.h"
|
#include "GlobalStorage.h"
|
||||||
#include "modulesystem/InstanceKey.h"
|
#include "modulesystem/InstanceKey.h"
|
||||||
|
|
||||||
namespace CalamaresUtils
|
namespace Calamares
|
||||||
{
|
{
|
||||||
namespace Packages
|
namespace Packages
|
||||||
{
|
{
|
||||||
@ -38,7 +38,7 @@ bool setGSPackageAdditions( Calamares::GlobalStorage* gs,
|
|||||||
const QStringList& installPackages );
|
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 Calamares
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -52,10 +52,10 @@ PackagesTests::testEmpty()
|
|||||||
QCOMPARE( k.toString(), "this@that" );
|
QCOMPARE( k.toString(), "this@that" );
|
||||||
|
|
||||||
// Adding nothing at all does nothing
|
// Adding nothing at all does nothing
|
||||||
QVERIFY( !CalamaresUtils::Packages::setGSPackageAdditions( &gs, k, QVariantList(), QVariantList() ) );
|
QVERIFY( !Calamares::Packages::setGSPackageAdditions( &gs, k, QVariantList(), QVariantList() ) );
|
||||||
QVERIFY( !gs.contains( topKey ) );
|
QVERIFY( !gs.contains( topKey ) );
|
||||||
|
|
||||||
QVERIFY( !CalamaresUtils::Packages::setGSPackageAdditions( &gs, k, QStringList() ) );
|
QVERIFY( !Calamares::Packages::setGSPackageAdditions( &gs, k, QStringList() ) );
|
||||||
QVERIFY( !gs.contains( topKey ) );
|
QVERIFY( !gs.contains( topKey ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,8 +88,7 @@ PackagesTests::testAdd()
|
|||||||
|
|
||||||
{
|
{
|
||||||
QVERIFY( !gs.contains( topKey ) );
|
QVERIFY( !gs.contains( topKey ) );
|
||||||
QVERIFY(
|
QVERIFY( Calamares::Packages::setGSPackageAdditions( &gs, k, QVariant( packages ).toList(), QVariantList() ) );
|
||||||
CalamaresUtils::Packages::setGSPackageAdditions( &gs, k, QVariant( packages ).toList(), QVariantList() ) );
|
|
||||||
QVERIFY( gs.contains( topKey ) );
|
QVERIFY( gs.contains( topKey ) );
|
||||||
auto actionList = gs.value( topKey ).toList();
|
auto actionList = gs.value( topKey ).toList();
|
||||||
QCOMPARE( actionList.length(), 1 );
|
QCOMPARE( actionList.length(), 1 );
|
||||||
@ -104,7 +103,7 @@ PackagesTests::testAdd()
|
|||||||
cDebug() << op;
|
cDebug() << op;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
QVERIFY( CalamaresUtils::Packages::setGSPackageAdditions( &gs, otherInstance, packages ) );
|
QVERIFY( Calamares::Packages::setGSPackageAdditions( &gs, otherInstance, packages ) );
|
||||||
QVERIFY( gs.contains( topKey ) );
|
QVERIFY( gs.contains( topKey ) );
|
||||||
auto actionList = gs.value( topKey ).toList();
|
auto actionList = gs.value( topKey ).toList();
|
||||||
QCOMPARE( actionList.length(), 2 ); // One for each instance key!
|
QCOMPARE( actionList.length(), 2 ); // One for each instance key!
|
||||||
@ -118,7 +117,7 @@ PackagesTests::testAdd()
|
|||||||
{
|
{
|
||||||
// Replace one and expect differences
|
// Replace one and expect differences
|
||||||
packages << extraEditor;
|
packages << extraEditor;
|
||||||
QVERIFY( CalamaresUtils::Packages::setGSPackageAdditions( &gs, otherInstance, packages ) );
|
QVERIFY( Calamares::Packages::setGSPackageAdditions( &gs, otherInstance, packages ) );
|
||||||
QVERIFY( gs.contains( topKey ) );
|
QVERIFY( gs.contains( topKey ) );
|
||||||
auto actionList = gs.value( topKey ).toList();
|
auto actionList = gs.value( topKey ).toList();
|
||||||
QCOMPARE( actionList.length(), 2 ); // One for each instance key!
|
QCOMPARE( actionList.length(), 2 ); // One for each instance key!
|
||||||
@ -160,8 +159,8 @@ PackagesTests::testAddMixed()
|
|||||||
// Just one
|
// Just one
|
||||||
{
|
{
|
||||||
QVERIFY( !gs.contains( topKey ) );
|
QVERIFY( !gs.contains( topKey ) );
|
||||||
QVERIFY( CalamaresUtils::Packages::setGSPackageAdditions(
|
QVERIFY(
|
||||||
&gs, k, QVariantList { QString( "vim" ) }, QVariantList() ) );
|
Calamares::Packages::setGSPackageAdditions( &gs, k, QVariantList { QString( "vim" ) }, QVariantList() ) );
|
||||||
QVERIFY( gs.contains( topKey ) );
|
QVERIFY( gs.contains( topKey ) );
|
||||||
auto actionList = gs.value( topKey ).toList();
|
auto actionList = gs.value( topKey ).toList();
|
||||||
QCOMPARE( actionList.length(), 1 );
|
QCOMPARE( actionList.length(), 1 );
|
||||||
@ -175,7 +174,7 @@ PackagesTests::testAddMixed()
|
|||||||
|
|
||||||
// Replace with two packages
|
// Replace with two packages
|
||||||
{
|
{
|
||||||
QVERIFY( CalamaresUtils::Packages::setGSPackageAdditions(
|
QVERIFY( Calamares::Packages::setGSPackageAdditions(
|
||||||
&gs, k, QVariantList { QString( "vim" ), QString( "emacs" ) }, QVariantList() ) );
|
&gs, k, QVariantList { QString( "vim" ), QString( "emacs" ) }, QVariantList() ) );
|
||||||
QVERIFY( gs.contains( topKey ) );
|
QVERIFY( gs.contains( topKey ) );
|
||||||
auto actionList = gs.value( topKey ).toList();
|
auto actionList = gs.value( topKey ).toList();
|
||||||
@ -192,8 +191,8 @@ PackagesTests::testAddMixed()
|
|||||||
|
|
||||||
// Replace with one (different) package
|
// Replace with one (different) package
|
||||||
{
|
{
|
||||||
QVERIFY( CalamaresUtils::Packages::setGSPackageAdditions(
|
QVERIFY(
|
||||||
&gs, k, QVariantList { QString( "nano" ) }, QVariantList() ) );
|
Calamares::Packages::setGSPackageAdditions( &gs, k, QVariantList { QString( "nano" ) }, QVariantList() ) );
|
||||||
QVERIFY( gs.contains( topKey ) );
|
QVERIFY( gs.contains( topKey ) );
|
||||||
auto actionList = gs.value( topKey ).toList();
|
auto actionList = gs.value( topKey ).toList();
|
||||||
QCOMPARE( actionList.length(), 1 );
|
QCOMPARE( actionList.length(), 1 );
|
||||||
@ -208,7 +207,7 @@ PackagesTests::testAddMixed()
|
|||||||
|
|
||||||
// Now we have two sources
|
// Now we have two sources
|
||||||
{
|
{
|
||||||
QVERIFY( CalamaresUtils::Packages::setGSPackageAdditions( &gs, otherInstance, QStringList( extraEditor ) ) );
|
QVERIFY( Calamares::Packages::setGSPackageAdditions( &gs, otherInstance, QStringList( extraEditor ) ) );
|
||||||
QVERIFY( gs.contains( topKey ) );
|
QVERIFY( gs.contains( topKey ) );
|
||||||
auto actionList = gs.value( topKey ).toList();
|
auto actionList = gs.value( topKey ).toList();
|
||||||
QCOMPARE( actionList.length(), 2 );
|
QCOMPARE( actionList.length(), 2 );
|
||||||
|
@ -178,6 +178,6 @@ Config::finalizeGlobalStorage( const Calamares::ModuleSystem::InstanceKey& key )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CalamaresUtils::Packages::setGSPackageAdditions(
|
Calamares::Packages::setGSPackageAdditions(
|
||||||
Calamares::JobQueue::instance()->globalStorage(), key, installPackages, tryInstallPackages );
|
Calamares::JobQueue::instance()->globalStorage(), key, installPackages, tryInstallPackages );
|
||||||
}
|
}
|
||||||
|
@ -144,7 +144,7 @@ Config::updateGlobalStorage( const QStringList& selected ) const
|
|||||||
{
|
{
|
||||||
QStringList packageNames = m_model->getInstallPackagesForNames( selected );
|
QStringList packageNames = m_model->getInstallPackagesForNames( selected );
|
||||||
cDebug() << m_defaultId << "packages to install" << packageNames;
|
cDebug() << m_defaultId << "packages to install" << packageNames;
|
||||||
CalamaresUtils::Packages::setGSPackageAdditions(
|
Calamares::Packages::setGSPackageAdditions(
|
||||||
Calamares::JobQueue::instance()->globalStorage(), m_defaultId, packageNames );
|
Calamares::JobQueue::instance()->globalStorage(), m_defaultId, packageNames );
|
||||||
}
|
}
|
||||||
else if ( m_method == PackageChooserMethod::NetAdd )
|
else if ( m_method == PackageChooserMethod::NetAdd )
|
||||||
|
Loading…
Reference in New Issue
Block a user