From 58414666c87aac8aae685323bc8585cdf1f1089b Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 23 Oct 2017 11:15:19 -0400 Subject: [PATCH] Netinstall: optimize structure for packages - If there's no scripts involved in a package for netinstall, just name it without the scripts; this lets the packages module optimize to fewer package manager calls. --- src/modules/netinstall/NetInstallViewStep.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/modules/netinstall/NetInstallViewStep.cpp b/src/modules/netinstall/NetInstallViewStep.cpp index 2909af79a..63f1bb6f6 100644 --- a/src/modules/netinstall/NetInstallViewStep.cpp +++ b/src/modules/netinstall/NetInstallViewStep.cpp @@ -135,10 +135,17 @@ NetInstallViewStep::onLeave() for ( auto package : packages ) { - QMap details; - details.insert( "pre-script", package.preScript ); - details.insert( "package", package.packageName ); - details.insert( "post-script", package.postScript ); + QVariant details( package.packageName ); + // If it's a package with a pre- or post-script, replace + // with the more complicated datastructure. + if (!package.preScript.isEmpty() || !package.postScript.isEmpty()) + { + QMap sdetails; + sdetails.insert( "pre-script", package.preScript ); + sdetails.insert( "package", package.packageName ); + sdetails.insert( "post-script", package.postScript ); + details = sdetails; + } if ( package.isCritical ) installPackages.append( details ); else