From 8286bff95fe945604aeebd40f9eee8274c2e260c Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 18 Feb 2020 11:28:42 +0100 Subject: [PATCH] [netinstall] Shuffle code around a bit - introduce char const for key name (consistency, it's used lots) - polish debugging a bit - add some inline code-docs --- src/modules/netinstall/NetInstallViewStep.cpp | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/modules/netinstall/NetInstallViewStep.cpp b/src/modules/netinstall/NetInstallViewStep.cpp index 94efb5f86..be163a422 100644 --- a/src/modules/netinstall/NetInstallViewStep.cpp +++ b/src/modules/netinstall/NetInstallViewStep.cpp @@ -115,15 +115,21 @@ NetInstallViewStep::onActivate() void NetInstallViewStep::onLeave() { - cDebug() << "Leaving netinstall, adding packages to be installed" - << "to global storage"; - PackageModel::PackageItemDataList packages = m_widget->selectedPackages(); + cDebug() << "Netinstall: Processing" << packages.length() << "packages."; + + static const char PACKAGEOP[] = "packageOperations"; + + // Check if there's already a PACAKGEOP entry in GS, and if so we'll + // extend that one (overwriting the value in GS at the end of this method) + Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage(); + QVariantList packageOperations = gs->contains( PACKAGEOP ) ? gs->value( PACKAGEOP ).toList() : QVariantList(); + cDebug() << Logger::SubEntry << "Existing package operations length" << packageOperations.length(); + + // This netinstall module may add two sub-steps to the packageOperations, + // one for installing and one for try-installing. QVariantList installPackages; QVariantList tryInstallPackages; - QVariantList packageOperations; - - cDebug() << "Processing" << packages.length() << "packages from netinstall."; for ( auto package : packages ) { @@ -165,8 +171,7 @@ NetInstallViewStep::onLeave() if ( !packageOperations.isEmpty() ) { - Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage(); - gs->insert( "packageOperations", QVariant( packageOperations ) ); + gs->insert( PACKAGEOP, packageOperations ); } }