diff --git a/CHANGES b/CHANGES index dbdcb3523..00ea25223 100644 --- a/CHANGES +++ b/CHANGES @@ -13,6 +13,11 @@ This release contains contributions from (alphabetically by first name): has had a few updates and has now been consistently applied across the core codebase (e.g. libcalamares, libcalamaresui, calamares, but not the modules). +- *KCoreAddons* is now a required dependency. This lets us drop a chunk + of code that was copied from KCoreAddons years ago, and use the + (maintained!) upstream version instead. It also gives us KMacroExpander + everywhere, which will simplify code for handling substitutions + in configuration files. ## Modules ## diff --git a/CMakeLists.txt b/CMakeLists.txt index 36c09abf0..5461aa3c8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -261,6 +261,8 @@ if( Qt5_VERSION VERSION_GREATER 5.12.1 ) list( APPEND _tx_ok "eo" ) endif() endif() +# Optional Qt parts +find_package( Qt5DBus CONFIG ) find_package( YAMLCPP ${YAMLCPP_VERSION} REQUIRED ) if( INSTALL_POLKIT ) @@ -291,7 +293,14 @@ if( ECM_FOUND ) include(KDEInstallDirs) endif() -find_package( KF5 COMPONENTS CoreAddons Crash ) +find_package( KF5 QUIET COMPONENTS CoreAddons Crash ) +set_package_properties( + KF5::CoreAddons PROPERTIES + TYPE REQUIRED + DESCRIPTION "Classes built on QtCore for About Data" + URL "https://api.kde.org/frameworks/kcoreaddons/" + PURPOSE "About Calamares" +) if( NOT KF5Crash_FOUND ) set( WITH_KF5Crash OFF ) endif() @@ -590,10 +599,25 @@ add_custom_target( uninstall ### CMAKE SUMMARY REPORT # -feature_summary(WHAT ALL) - get_directory_property( SKIPPED_MODULES DIRECTORY src/modules DEFINITION LIST_SKIPPED_MODULES ) calamares_explain_skipped_modules( ${SKIPPED_MODULES} ) + +feature_summary( + WHAT DISABLED_FEATURES + DESCRIPTION "The following features have been disabled:" + QUIET_ON_EMPTY +) +feature_summary( + WHAT OPTIONAL_PACKAGES_NOT_FOUND + DESCRIPTION "The following OPTIONAL packages were not found:" + QUIET_ON_EMPTY +) +feature_summary( + WHAT REQUIRED_PACKAGES_NOT_FOUND + FATAL_ON_MISSING_REQUIRED_PACKAGES + DESCRIPTION "The following REQUIRED packages were not found:" + QUIET_ON_EMPTY +) diff --git a/README.md b/README.md index df4c02b66..e2e87fddf 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ Main: * Boost.Python >= 1.55.0 (required for some modules) * KDE extra-cmake-modules >= 5.18 (recommended; required for some modules; required for some tests) +* KDE Frameworks KCoreAddons (>= 5.58 recommended) * PythonQt (optional, deprecated) Modules: diff --git a/src/calamares/CMakeLists.txt b/src/calamares/CMakeLists.txt index 259e3bf56..a55e26b6d 100644 --- a/src/calamares/CMakeLists.txt +++ b/src/calamares/CMakeLists.txt @@ -46,11 +46,11 @@ target_link_libraries( calamares_bin calamaresui Qt5::Core Qt5::Widgets + KF5::CoreAddons ) if( WITH_KF5Crash ) target_link_libraries( calamares_bin PRIVATE - KF5::CoreAddons KF5::Crash ) target_compile_definitions( calamares_bin PRIVATE WITH_KF5Crash ) diff --git a/src/calamares/main.cpp b/src/calamares/main.cpp index 704c2bf59..caf1f6cfd 100644 --- a/src/calamares/main.cpp +++ b/src/calamares/main.cpp @@ -26,8 +26,8 @@ #include "3rdparty/kdsingleapplicationguard/kdsingleapplicationguard.h" -#ifdef WITH_KF5Crash #include +#ifdef WITH_KF5Crash #include #endif @@ -93,7 +93,6 @@ main( int argc, char* argv[] ) { CalamaresApplication a( argc, argv ); -#ifdef WITH_KF5Crash KAboutData aboutData( "calamares", "Calamares", a.applicationVersion(), @@ -104,12 +103,14 @@ main( int argc, char* argv[] ) "https://calamares.io", "https://github.com/calamares/calamares/issues" ); KAboutData::setApplicationData( aboutData ); + a.setApplicationDisplayName( QString() ); // To avoid putting an extra "Calamares/" into the log-file + +#ifdef WITH_KF5Crash KCrash::initialize(); // KCrash::setCrashHandler(); KCrash::setDrKonqiEnabled( true ); KCrash::setFlags( KCrash::SaferDialog | KCrash::AlwaysDirectly ); // TODO: umount anything in /tmp/calamares-... as an emergency save function - a.setApplicationDisplayName( QString() ); #endif handle_args( a ); diff --git a/src/libcalamares/CMakeLists.txt b/src/libcalamares/CMakeLists.txt index 790d4b6ac..f2063813c 100644 --- a/src/libcalamares/CMakeLists.txt +++ b/src/libcalamares/CMakeLists.txt @@ -120,6 +120,7 @@ target_link_libraries( calamares LINK_PUBLIC ${YAMLCPP_LIBRARY} Qt5::Core + KF5::CoreAddons ${OPTIONAL_PUBLIC_LIBRARIES} ) diff --git a/src/libcalamares/utils/PluginFactory.cpp b/src/libcalamares/utils/PluginFactory.cpp index 878182ea4..7e1b29921 100644 --- a/src/libcalamares/utils/PluginFactory.cpp +++ b/src/libcalamares/utils/PluginFactory.cpp @@ -1,127 +1,11 @@ /* === This file is part of Calamares - === * - * Copyright 2015, Teo Mrnjavac - * Copyright 2017-2018, Adriaan de Groot + * Copyright 2019, Adriaan de Groot * - * Based on KPluginFactory from KCoreAddons, KDE project - * Copyright 2007, Matthias Kretz - * Copyright 2007, Bernhard Loos - * - * Calamares is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Calamares is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Calamares. If not, see . */ #include "PluginFactory.h" -#include "PluginFactory_p.h" -#include -#include - -// *INDENT-OFF* -// clang-format off - -Q_GLOBAL_STATIC( QObjectCleanupHandler, factorycleanup ) - -namespace Calamares +CalamaresPluginFactory::~CalamaresPluginFactory() { - -PluginFactory::PluginFactory() - : pd_ptr( new PluginFactoryPrivate ) -{ - pd_ptr->q_ptr = this; - - factorycleanup()->add( this ); -} - -PluginFactory::PluginFactory( PluginFactoryPrivate& d ) - : pd_ptr( &d ) -{ - factorycleanup()->add( this ); -} - -PluginFactory::~PluginFactory() -{ - delete pd_ptr; -} - -void PluginFactory::doRegisterPlugin( const QString& keyword, const QMetaObject* metaObject, CreateInstanceFunction instanceFunction ) -{ - Q_ASSERT( metaObject ); - - // we allow different interfaces to be registered without keyword - if ( !keyword.isEmpty() ) - { - if ( pd_ptr->createInstanceHash.contains( keyword ) ) - qWarning() << "A plugin with the keyword" << keyword << "was already registered. A keyword must be unique!"; - pd_ptr->createInstanceHash.insert( keyword, PluginFactoryPrivate::Plugin( metaObject, instanceFunction ) ); - } - else - { - const QList clashes( pd_ptr->createInstanceHash.values( keyword ) ); - const QMetaObject* superClass = metaObject->superClass(); - if ( superClass ) - { - for ( const PluginFactoryPrivate::Plugin& plugin : clashes ) - { - for ( const QMetaObject* otherSuper = plugin.first->superClass(); otherSuper; - otherSuper = otherSuper->superClass() ) - { - if ( superClass == otherSuper ) - qWarning() << "Two plugins with the same interface(" << superClass->className() << ") were registered. Use keywords to identify the plugins."; - } - } - } - for ( const PluginFactoryPrivate::Plugin& plugin : clashes ) - { - superClass = plugin.first->superClass(); - if ( superClass ) - { - for ( const QMetaObject* otherSuper = metaObject->superClass(); otherSuper; - otherSuper = otherSuper->superClass() ) - { - if ( superClass == otherSuper ) - qWarning() << "Two plugins with the same interface(" << superClass->className() << ") were registered. Use keywords to identify the plugins."; - } - } - } - pd_ptr->createInstanceHash.insertMulti( keyword, PluginFactoryPrivate::Plugin( metaObject, instanceFunction ) ); - } -} - -QObject* PluginFactory::create( const char* iface, QWidget* parentWidget, QObject* parent, const QString& keyword ) -{ - QObject* obj = nullptr; - - const QList candidates( pd_ptr->createInstanceHash.values( keyword ) ); - // for !keyword.isEmpty() candidates.count() is 0 or 1 - - for ( const PluginFactoryPrivate::Plugin& plugin : candidates ) - { - for ( const QMetaObject* current = plugin.first; current; current = current->superClass() ) - { - if ( 0 == qstrcmp( iface, current->className() ) ) - { - if ( obj ) - qWarning() << "ambiguous interface requested from a DSO containing more than one plugin"; - obj = plugin.second( parentWidget, parent ); - break; - } - } - } - - if ( obj ) - emit objectCreated( obj ); - return obj; -} - } diff --git a/src/libcalamares/utils/PluginFactory.h b/src/libcalamares/utils/PluginFactory.h index f2481f10d..20c82c464 100644 --- a/src/libcalamares/utils/PluginFactory.h +++ b/src/libcalamares/utils/PluginFactory.h @@ -24,298 +24,80 @@ #ifndef UTILS_PLUGINFACTORY_H #define UTILS_PLUGINFACTORY_H -#include "DllMacro.h" - -#include -#include -#include - -// *INDENT-OFF* -// clang-format off - -namespace Calamares -{ -class PluginFactoryPrivate; -} +#include #define CalamaresPluginFactory_iid "io.calamares.PluginFactory" -/** - * \relates PluginFactory +/** @brief Plugin factory for Calamares * - * CALAMARES_PLUGIN_FACTORY_DECLARATION declares the PluginFactory subclass. This macro - * can be used in a header file. + * Try to re-use KPluginFactory as much as possible (since the + * old code for PluginFactory was a fork of an old version of + * exactly that). * - * \param name The name of the PluginFactory derived class. + * The current createInstance() method passes more arguments + * to the job and viewstep constructors than we want; chasing + * that change means modifying each Calamares module. This class + * implements a version of createInstance() with fewer arguments + * and overloads registerPlugin() to use that. + */ +class CalamaresPluginFactory : public KPluginFactory +{ + Q_OBJECT +public: + explicit CalamaresPluginFactory() : KPluginFactory() {} + ~CalamaresPluginFactory() override; + + /** @brief Create an object from the factory. + * + * Ignores all the @p args since they are not used. Calls + * Calamares constructors for the Jobs and ViewSteps. + */ + template + static QObject *createInstance(QWidget *parentWidget, QObject *parent, const QVariantList &args) + { + Q_UNUSED(parentWidget); + Q_UNUSED(args); + ParentType *p = nullptr; + if (parent) { + p = qobject_cast(parent); + Q_ASSERT(p); + } + return new impl(p); + } + + /** @brief register a plugin + * + * The Calamares version doesn't accept keywords, and uses + * the Calamares createInstance() version which ignores + * the QVariantList of arguments. + */ + template + void registerPlugin() + { + KPluginFactory::registerPlugin(QString(), &createInstance); + } +}; + +/** @brief declare a Calamares Plugin Factory * - * \see CALAMARES_PLUGIN_FACTORY - * \see CALAMARES_PLUGIN_FACTORY_DEFINITION + * This would be defined as K_PLUGIN_FACTORY_DECLARATION_WITH_BASEFACTORY, + * except that does not actually use the base factory class that is + * passed in. */ #define CALAMARES_PLUGIN_FACTORY_DECLARATION(name) \ - class name : public Calamares::PluginFactory \ + class name : public CalamaresPluginFactory \ { \ Q_OBJECT \ - Q_INTERFACES(Calamares::PluginFactory) \ + Q_INTERFACES(KPluginFactory) \ Q_PLUGIN_METADATA(IID CalamaresPluginFactory_iid) \ public: \ explicit name(); \ ~name(); \ - private: \ - void init(); \ }; - -/** - * \relates PluginFactory - * CALAMARES_PLUGIN_FACTORY_DEFINITION defines the PluginFactory subclass. This macro - * can not be used in a header file. - * - * \param name The name of the PluginFactory derived class. - * - * \param pluginRegistrations Code to be inserted into the constructor of the - * class. Usually a series of registerPlugin() calls. - * - * \see CALAMARES_PLUGIN_FACTORY - * \see CALAMARES_PLUGIN_FACTORY_DECLARATION - */ #define CALAMARES_PLUGIN_FACTORY_DEFINITION(name, pluginRegistrations) \ - name::name() \ - { \ - pluginRegistrations \ - } \ - name::~name() {} + K_PLUGIN_FACTORY_DEFINITION_WITH_BASEFACTORY(name,CalamaresPluginFactory,pluginRegistrations) -namespace Calamares -{ -/** - * \class PluginFactory PluginFactory.h - * - * PluginFactory provides a convenient way to provide factory-style plugins. - * Qt plugins provide a singleton object, but a common pattern is for plugins - * to generate as many objects of a particular type as the application requires. - * By using PluginFactory, you can avoid implementing the factory pattern - * yourself. - * - * PluginFactory also allows plugins to provide multiple different object - * types, indexed by keywords. - * - * The objects created by PluginFactory must inherit QObject, and must have a - * standard constructor pattern: - * \li if the object is a KPart::Part, it must be of the form - * \code - * T(QWidget *parentWidget, QObject *parent, const QVariantList &args) - * \endcode - * \li if it is a QWidget, it must be of the form - * \code - * T(QWidget *parent, const QVariantList &args) - * \endcode - * \li otherwise it must be of the form - * \code - * T(QObject *parent, const QVariantList &args) - * \endcode - * - * You should typically use CALAMARES_PLUGIN_FACTORY_DEFINITION() in your plugin code to - * create the factory. The pattern is - * - * \code - * #include "utils/PluginFactory.h" - * - * class MyPlugin : public PluginInterface - * { - * public: - * MyPlugin(QObject *parent, const QVariantList &args) - * : PluginInterface(parent) - * {} - * }; - * - * CALAMARES_PLUGIN_FACTORY_DEFINITION(MyPluginFactory, - * registerPlugin(); - * ) - * \endcode - * - * If you want to load a library use KPluginLoader. - * The application that wants to instantiate plugin classes can do the following: - * \code - * PluginFactory *factory = KPluginLoader("libraryname").factory(); - * if (factory) { - * PluginInterface *p1 = factory->create(parent); - * OtherInterface *p2 = factory->create(parent); - * NextInterface *p3 = factory->create("keyword1", parent); - * NextInterface *p3 = factory->create("keyword2", parent); - * } - * \endcode - * - * \author Matthias Kretz - * \author Bernhard Loos - */ -class DLLEXPORT PluginFactory : public QObject -{ - Q_OBJECT - friend class PluginFactoryPrivate; -public: - /** - * This constructor creates a factory for a plugin. - */ - explicit PluginFactory(); - - /** - * This destroys the PluginFactory. - */ - virtual ~PluginFactory(); - - /** - * Use this method to create an object. It will try to create an object which inherits - * \p T. If it has multiple choices, you will get a fatal error (kFatal()), so be careful - * to request a unique interface or use keywords. - * - * \tparam T The interface for which an object should be created. The object will inherit \p T. - * \param parent The parent of the object. If \p parent is a widget type, it will also passed - * to the parentWidget argument of the CreateInstanceFunction for the object. - * \returns A pointer to the created object is returned, or 0 if an error occurred. - */ - template - T* create( QObject* parent = nullptr ); - - /** - * Use this method to create an object. It will try to create an object which inherits - * \p T and was registered with \p keyword. - * - * \tparam T The interface for which an object should be created. The object will inherit \p T. - * \param keyword The keyword of the object. - * \param parent The parent of the object. If \p parent is a widget type, it will also passed - * to the parentWidget argument of the CreateInstanceFunction for the object. - * \returns A pointer to the created object is returned, or 0 if an error occurred. - */ - template - T* create( const QString& keyword, QObject* parent = nullptr ); - -Q_SIGNALS: - void objectCreated( QObject* object ); - -protected: - /** - * Function pointer type to a function that instantiates a plugin. - */ - typedef QObject* ( *CreateInstanceFunction )( QWidget*, QObject* ); - - /** - * This is used to detect the arguments need for the constructor of plugin classes. - * You can inherit it, if you want to add new classes and still keep support for the old ones. - */ - template - struct InheritanceChecker - { - CreateInstanceFunction createInstanceFunction( QWidget* ) - { - return &createInstance; - } - CreateInstanceFunction createInstanceFunction( ... ) - { - return &createInstance; - } - }; - - explicit PluginFactory( PluginFactoryPrivate& dd ); - - /** - * Registers a plugin with the factory. Call this function from the constructor of the - * PluginFactory subclass to make the create function able to instantiate the plugin when asked - * for an interface the plugin implements. - * - * \tparam T the name of the plugin class - * - * \param keyword An optional keyword as unique identifier for the plugin. This allows you to - * put more than one plugin with the same interface into the same library using the same - * factory. X-KDE-PluginKeyword is a convenient way to specify the keyword in a desktop file. - * - * \param instanceFunction A function pointer to a function that creates an instance of the - * plugin. The default function that will be used depends on the type of interface. If the - * interface inherits from - * \li \c KParts::Part the function will call - * \code - * new T(QWidget *parentWidget, QObject *parent) - * \endcode - * \li \c QWidget the function will call - * \code - * new T(QWidget *parent) - * \endcode - * \li else the function will call - * \code - * new T(QObject *parent) - * \endcode - */ - template - void registerPlugin( const QString& keyword = QString(), - CreateInstanceFunction instanceFunction - = InheritanceChecker().createInstanceFunction( reinterpret_cast( 0 ) ) ) - { - doRegisterPlugin( keyword, &T::staticMetaObject, instanceFunction ); - } - - PluginFactoryPrivate* const pd_ptr; - - /** - * This function is called when the factory asked to create an Object. - * - * You may reimplement it to provide a very flexible factory. This is especially useful to - * provide generic factories for plugins implemeted using a scripting language. - * - * \param iface The staticMetaObject::className() string identifying the plugin interface that - * was requested. E.g. for KCModule plugins this string will be "KCModule". - * \param parentWidget Only used if the requested plugin is a KPart. - * \param parent The parent object for the plugin object. - * \param keyword A string that uniquely identifies the plugin. If a KService is used this - * keyword is read from the X-KDE-PluginKeyword entry in the .desktop file. - */ - virtual QObject* create( const char* iface, QWidget* parentWidget, QObject* parent, const QString& keyword ); - - template - static QObject* createInstance( QWidget* parentWidget, QObject* parent ) - { - Q_UNUSED( parentWidget ) - ParentType* p = nullptr; - if ( parent ) - { - p = qobject_cast( parent ); - Q_ASSERT( p ); - } - return new impl( p ); - } - -private: - void doRegisterPlugin( const QString& keyword, const QMetaObject* metaObject, CreateInstanceFunction instanceFunction ); -}; - -template -inline T* PluginFactory::create( QObject* parent ) -{ - QObject* o = create( T::staticMetaObject.className(), - parent && parent->isWidgetType() ? reinterpret_cast( parent ) : nullptr, - parent, - QString() ); - - T* t = qobject_cast( o ); - if ( !t ) - delete o; - return t; -} - -template -inline T* PluginFactory::create( const QString& keyword, QObject* parent ) -{ - QObject* o = create( T::staticMetaObject.className(), - parent && parent->isWidgetType() ? reinterpret_cast( parent ) : nullptr, - parent, - keyword ); - - T* t = qobject_cast( o ); - if ( !t ) - delete o; - return t; -} - -} // namespace - -Q_DECLARE_INTERFACE( Calamares::PluginFactory, CalamaresPluginFactory_iid ) +// Q_DECLARE_INTERFACE( Calamares::PluginFactory, CalamaresPluginFactory_iid ) #endif diff --git a/src/libcalamares/utils/PluginFactory_p.h b/src/libcalamares/utils/PluginFactory_p.h deleted file mode 100644 index dc272f077..000000000 --- a/src/libcalamares/utils/PluginFactory_p.h +++ /dev/null @@ -1,55 +0,0 @@ -/* === This file is part of Calamares - === - * - * Copyright 2015, Teo Mrnjavac - * - * Based on KPluginFactory from KCoreAddons, KDE project - * Copyright 2007, Matthias Kretz - * Copyright 2007, Bernhard Loos - * - * Calamares is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Calamares is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Calamares. If not, see . - */ - -#ifndef UTILS_PLUGINFACTORY_P_H -#define UTILS_PLUGINFACTORY_P_H - -#include "PluginFactory.h" - -#include - -namespace Calamares -{ - -class PluginFactoryPrivate -{ - Q_DECLARE_PUBLIC( PluginFactory ) -protected: - typedef QPair< const QMetaObject*, PluginFactory::CreateInstanceFunction > Plugin; - - PluginFactoryPrivate() - : catalogInitialized( false ) - , q_ptr( nullptr ) - { - } - ~PluginFactoryPrivate() {} - - QHash< QString, Plugin > createInstanceHash; - QString catalogName; - bool catalogInitialized; - - PluginFactory* q_ptr; -}; - -} // namespace Calamares - -#endif diff --git a/src/libcalamaresui/CMakeLists.txt b/src/libcalamaresui/CMakeLists.txt index 111113a47..a9d31c2c3 100644 --- a/src/libcalamaresui/CMakeLists.txt +++ b/src/libcalamaresui/CMakeLists.txt @@ -75,8 +75,6 @@ calamares_add_library( calamaresui VERSION ${CALAMARES_VERSION_SHORT} ) -find_package( KF5CoreAddons 5.58 QUIET ) # If it's really new -if ( KF5CoreAddons_FOUND ) +if ( KF5CoreAddons_FOUND AND KF5CoreAddons_VERSION VERSION_GREATER_EQUAL 5.58 ) target_compile_definitions( calamaresui PRIVATE WITH_KOSRelease ) - target_link_libraries( calamaresui PRIVATE KF5::CoreAddons ) endif() diff --git a/src/libcalamaresui/modulesystem/CppJobModule.cpp b/src/libcalamaresui/modulesystem/CppJobModule.cpp index 17c191024..c6571dbf6 100644 --- a/src/libcalamaresui/modulesystem/CppJobModule.cpp +++ b/src/libcalamaresui/modulesystem/CppJobModule.cpp @@ -49,7 +49,7 @@ CppJobModule::loadSelf() { if ( m_loader ) { - PluginFactory* pf = qobject_cast< PluginFactory* >( m_loader->instance() ); + CalamaresPluginFactory* pf = qobject_cast< CalamaresPluginFactory* >( m_loader->instance() ); if ( !pf ) { cDebug() << Q_FUNC_INFO << m_loader->errorString(); diff --git a/src/libcalamaresui/modulesystem/ViewModule.cpp b/src/libcalamaresui/modulesystem/ViewModule.cpp index 5cd2fe7d9..7506e5348 100644 --- a/src/libcalamaresui/modulesystem/ViewModule.cpp +++ b/src/libcalamaresui/modulesystem/ViewModule.cpp @@ -50,7 +50,7 @@ ViewModule::loadSelf() { if ( m_loader ) { - PluginFactory* pf = qobject_cast< PluginFactory* >( m_loader->instance() ); + CalamaresPluginFactory* pf = qobject_cast< CalamaresPluginFactory* >( m_loader->instance() ); if ( !pf ) { cWarning() << Q_FUNC_INFO << "No factory:" << m_loader->errorString(); diff --git a/src/modules/fsresizer/CMakeLists.txt b/src/modules/fsresizer/CMakeLists.txt index ba9c81f4c..3d82489b7 100644 --- a/src/modules/fsresizer/CMakeLists.txt +++ b/src/modules/fsresizer/CMakeLists.txt @@ -1,11 +1,11 @@ find_package( KPMcore 3.3 ) +find_package( KF5Config CONFIG ) +find_package( KF5I18n CONFIG ) +find_package( KF5WidgetsAddons CONFIG ) set( _partition_defs "" ) -if ( KPMcore_FOUND ) - find_package( Qt5 REQUIRED DBus ) # Needed for KPMCore - find_package( KF5 REQUIRED I18n WidgetsAddons ) # Needed for KPMCore - +if ( KPMcore_FOUND AND Qt5DBus_FOUND AND KF5CoreAddons_FOUND AND KF5Config_FOUND ) include_directories( ${KPMCORE_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/src/modules/partition ) if ( KPMcore_VERSION VERSION_GREATER "3.3.0") @@ -48,5 +48,9 @@ if ( KPMcore_FOUND ) target_compile_definitions( fsresizertest PRIVATE ${_partition_defs} ) endif() else() - calamares_skip_module( "fsresizer (missing suitable KPMcore)" ) + if ( NOT KPMcore_FOUND ) + calamares_skip_module( "fsresizer (missing suitable KPMcore)" ) + else() + calamares_skip_module( "fsresizer (missing dependencies for KPMcore)" ) + endif() endif() diff --git a/src/modules/partition/CMakeLists.txt b/src/modules/partition/CMakeLists.txt index df1588cb2..f9c32b39e 100644 --- a/src/modules/partition/CMakeLists.txt +++ b/src/modules/partition/CMakeLists.txt @@ -22,11 +22,11 @@ set_package_properties( KPMcore PROPERTIES PURPOSE "For partitioning module" ) +find_package( KF5Config CONFIG ) +find_package( KF5I18n CONFIG ) +find_package( KF5WidgetsAddons CONFIG ) -if ( KPMcore_FOUND ) - find_package( Qt5 REQUIRED DBus ) - find_package( KF5 REQUIRED Config CoreAddons I18n WidgetsAddons ) - +if ( KPMcore_FOUND AND Qt5DBus_FOUND AND KF5CoreAddons_FOUND AND KF5Config_FOUND ) if ( KPMcore_VERSION VERSION_GREATER "3.3.0") list( APPEND _partition_defs WITH_KPMCORE331API) # kpmcore > 3.3.0 with deprecations endif() @@ -106,5 +106,9 @@ if ( KPMcore_FOUND ) SHARED_LIB ) else() - calamares_skip_module( "partition (missing suitable KPMcore)" ) + if ( NOT KPMcore_FOUND ) + calamares_skip_module( "partition (missing suitable KPMcore)" ) + else() + calamares_skip_module( "partition (missing dependencies for KPMcore)" ) + endif() endif()