From 428929b64f1059ed44fba3fb470ddbb8dc9e03f0 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sat, 22 Sep 2018 11:11:19 -0400 Subject: [PATCH] [fsresizer] Tiny step towards getting data from KPMcore --- src/modules/fsresizer/ResizeFSJob.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/modules/fsresizer/ResizeFSJob.cpp b/src/modules/fsresizer/ResizeFSJob.cpp index 925301e42..490010e0c 100644 --- a/src/modules/fsresizer/ResizeFSJob.cpp +++ b/src/modules/fsresizer/ResizeFSJob.cpp @@ -22,6 +22,9 @@ #include #include +#include +#include + #include "CalamaresVersion.h" #include "JobQueue.h" #include "GlobalStorage.h" @@ -36,8 +39,8 @@ ResizeFSJob::RelativeSize::RelativeSize() template -void matchUnitSuffix( - const QString& s, +void matchUnitSuffix( + const QString& s, const char (&suffix)[N], ResizeFSJob::RelativeSize::Unit matchedUnit, int& value, @@ -50,15 +53,15 @@ void matchUnitSuffix( unit = matchedUnit; } } - - + + ResizeFSJob::RelativeSize::RelativeSize( const QString& s) : m_value( 0 ) , m_unit( None ) { matchUnitSuffix( s, "%", Percent, m_value, m_unit ); matchUnitSuffix( s, "MiB", Absolute, m_value, m_unit ); - + if ( !m_value ) m_unit = None; } @@ -85,11 +88,18 @@ ResizeFSJob::prettyName() const Calamares::JobResult ResizeFSJob::exec() { + auto backend_p = CoreBackendManager::self()->backend(); + if ( backend_p ) + cDebug() << "KPMCore backend @" << (void *)backend_p << backend_p->id() << backend_p->version(); + else + cDebug() << "No KPMCore backend"; + if ( !isValid() ) return Calamares::JobResult::error( tr( "Invalid configuration" ), tr( "The file-system resize job has an invalid configuration " "and will not run." ) ); + return Calamares::JobResult::ok(); }