Merge branch 'fix-kpmcore-use'

main
Adriaan de Groot 6 years ago
commit 4987dc31a1

@ -2,12 +2,17 @@ find_package( KPMcore 3.3 )
find_package( Qt5 REQUIRED DBus ) # Needed for KPMCore find_package( Qt5 REQUIRED DBus ) # Needed for KPMCore
find_package( KF5 REQUIRED I18n WidgetsAddons ) # Needed for KPMCore find_package( KF5 REQUIRED I18n WidgetsAddons ) # Needed for KPMCore
set( _partition_defs "" )
if ( KPMcore_FOUND ) if ( KPMcore_FOUND )
include_directories( ${KPMCORE_INCLUDE_DIR} ) include_directories( ${KPMCORE_INCLUDE_DIR} )
include_directories( ${PROJECT_BINARY_DIR}/src/libcalamares ) include_directories( ${PROJECT_BINARY_DIR}/src/libcalamares )
if ( KPMcore_VERSION VERSION_GREATER "3.3.0") if ( KPMcore_VERSION VERSION_GREATER "3.3.0")
add_definitions(-DWITH_KPMCOREGT33) # kpmcore greater than 3.3 list( APPEND _partition_defs WITH_KPMCORE331API) # kpmcore > 3.3.0 with deprecations
endif()
if ( KPMcore_VERSION VERSION_GREATER "3.90")
list( APPEND _partition_defs WITH_KPMCORE4API) # kpmcore 4 with new API
endif() endif()
# The PartitionIterator is a small class, and it's easiest -- but also a # The PartitionIterator is a small class, and it's easiest -- but also a
@ -21,6 +26,7 @@ if ( KPMcore_FOUND )
LINK_PRIVATE_LIBRARIES LINK_PRIVATE_LIBRARIES
kpmcore kpmcore
calamares calamares
COMPILE_DEFINITIONS ${_partition_defs}
SHARED_LIB SHARED_LIB
) )
@ -38,7 +44,8 @@ if ( KPMcore_FOUND )
Qt5::Test Qt5::Test
) )
set_target_properties( fsresizertest PROPERTIES AUTOMOC TRUE ) set_target_properties( fsresizertest PROPERTIES AUTOMOC TRUE )
target_include_directories(fsresizertest PRIVATE /usr/local/include ) target_include_directories( fsresizertest PRIVATE /usr/local/include )
target_compile_definitions( fsresizertest PRIVATE ${_partition_defs} )
endif() endif()
else() else()
calamares_skip_module( "fsresizer (missing suitable KPMcore)" ) calamares_skip_module( "fsresizer (missing suitable KPMcore)" )

@ -120,7 +120,7 @@ ResizeFSJob::PartitionMatch
ResizeFSJob::findPartition( CoreBackend* backend ) ResizeFSJob::findPartition( CoreBackend* backend )
{ {
using DeviceList = QList< Device* >; using DeviceList = QList< Device* >;
#ifdef WITH_KPMCOREGT33 #ifdef WITH_KPMCORE331API
DeviceList devices = backend->scanDevices( /* not includeReadOnly, not includeLoopback */ ScanFlag(0) ); DeviceList devices = backend->scanDevices( /* not includeReadOnly, not includeLoopback */ ScanFlag(0) );
#else #else
DeviceList devices = backend->scanDevices( /* excludeReadOnly */ true ); DeviceList devices = backend->scanDevices( /* excludeReadOnly */ true );

@ -28,7 +28,10 @@ set_package_properties(
if ( KPMcore_FOUND ) if ( KPMcore_FOUND )
if ( KPMcore_VERSION VERSION_GREATER "3.3.0") if ( KPMcore_VERSION VERSION_GREATER "3.3.0")
add_definitions(-DWITH_KPMCOREGT33) # kpmcore greater than 3.3 list( APPEND _partition_defs WITH_KPMCORE331API) # kpmcore > 3.3.0 with deprecations
endif()
if ( KPMcore_VERSION VERSION_GREATER "3.90")
list( APPEND _partition_defs WITH_KPMCORE4API) # kpmcore 4 with new API
endif() endif()
include_directories( ${KPMCORE_INCLUDE_DIR} ) include_directories( ${KPMCORE_INCLUDE_DIR} )

@ -107,7 +107,7 @@ QList< Device* > getDevices( DeviceType which, qint64 minimumSize )
bool writableOnly = (which == DeviceType::WritableOnly); bool writableOnly = (which == DeviceType::WritableOnly);
CoreBackend* backend = CoreBackendManager::self()->backend(); CoreBackend* backend = CoreBackendManager::self()->backend();
#ifdef WITH_KPMCOREGT33 #ifdef WITH_KPMCORE331API
DeviceList devices = backend->scanDevices( /* not includeReadOnly, not includeLoopback */ ScanFlag(0) ); DeviceList devices = backend->scanDevices( /* not includeReadOnly, not includeLoopback */ ScanFlag(0) );
#else #else
DeviceList devices = backend->scanDevices( /* excludeReadOnly */ true ); DeviceList devices = backend->scanDevices( /* excludeReadOnly */ true );

@ -33,7 +33,7 @@ class Partition;
class PartitionNode; class PartitionNode;
class PartitionRole; class PartitionRole;
#ifdef WITH_KPMCOREGT33 #ifdef WITH_KPMCORE331API
#define KPM_PARTITION_FLAG(x) PartitionTable::Flag::x #define KPM_PARTITION_FLAG(x) PartitionTable::Flag::x
#define KPM_PARTITION_STATE(x) Partition::State::x #define KPM_PARTITION_STATE(x) Partition::State::x
#define KPM_PARTITION_FLAG_ESP PartitionTable::Flag::Boot #define KPM_PARTITION_FLAG_ESP PartitionTable::Flag::Boot

@ -683,14 +683,17 @@ PartitionCoreModule::scanForLVMPVs()
} }
} }
#ifdef WITH_KPMCOREGT33 #if defined( WITH_KPMCORE4API )
VolumeManagerDevice::scanDevices( physicalDevices ); VolumeManagerDevice::scanDevices( physicalDevices );
for ( auto p : LVM::pvList::list() )
#else
#if defined( WITH_KPMCORE331API )
LvmDevice::scanSystemLVM( physicalDevices );
for ( auto p : LVM::pvList::list() ) for ( auto p : LVM::pvList::list() )
#else #else
LvmDevice::scanSystemLVM( physicalDevices ); LvmDevice::scanSystemLVM( physicalDevices );
for ( auto p : LVM::pvList ) for ( auto p : LVM::pvList )
#endif
#endif #endif
{ {
m_lvmPVs << p.partition().data(); m_lvmPVs << p.partition().data();
@ -724,7 +727,7 @@ PartitionCoreModule::scanForLVMPVs()
if ( innerFS && innerFS->type() == FileSystem::Type::Lvm2_PV ) if ( innerFS && innerFS->type() == FileSystem::Type::Lvm2_PV )
m_lvmPVs << p; m_lvmPVs << p;
} }
#ifdef WITH_KPMCOREGT33 #ifdef WITH_KPMCORE4API
else if ( p->fileSystem().type() == FileSystem::Type::Luks2 ) else if ( p->fileSystem().type() == FileSystem::Type::Luks2 )
{ {
// Encrypted LVM PVs // Encrypted LVM PVs

@ -51,7 +51,7 @@
#include <kpmcore/core/device.h> #include <kpmcore/core/device.h>
#include <kpmcore/core/partition.h> #include <kpmcore/core/partition.h>
#ifdef WITH_KPMCOREGT33 #ifdef WITH_KPMCORE4API
#include <kpmcore/core/softwareraid.h> #include <kpmcore/core/softwareraid.h>
#endif #endif
@ -1224,7 +1224,7 @@ ChoicePage::setupActions()
bool atLeastOneIsMounted = false; // Suppress 'erase' if so bool atLeastOneIsMounted = false; // Suppress 'erase' if so
bool isInactiveRAID = false; bool isInactiveRAID = false;
#ifdef WITH_KPMCOREGT33 #ifdef WITH_KPMCORE4API
if ( currentDevice->type() == Device::Type::SoftwareRAID_Device && if ( currentDevice->type() == Device::Type::SoftwareRAID_Device &&
static_cast< SoftwareRAID* >(currentDevice)->status() == SoftwareRAID::Status::Inactive ) static_cast< SoftwareRAID* >(currentDevice)->status() == SoftwareRAID::Status::Inactive )
{ {

@ -49,7 +49,7 @@
// KPMcore // KPMcore
#include <kpmcore/core/device.h> #include <kpmcore/core/device.h>
#include <kpmcore/core/partition.h> #include <kpmcore/core/partition.h>
#ifdef WITH_KPMCOREGT33 #ifdef WITH_KPMCORE4API
#include <kpmcore/core/softwareraid.h> #include <kpmcore/core/softwareraid.h>
#endif #endif
#include <kpmcore/ops/deactivatevolumegroupoperation.h> #include <kpmcore/ops/deactivatevolumegroupoperation.h>
@ -162,7 +162,7 @@ PartitionPage::updateButtons()
{ {
createTable = true; createTable = true;
#ifdef WITH_KPMCOREGT33 #ifdef WITH_KPMCORE4API
if ( device->type() == Device::Type::SoftwareRAID_Device && if ( device->type() == Device::Type::SoftwareRAID_Device &&
static_cast< SoftwareRAID* >(device)->status() == SoftwareRAID::Status::Inactive ) static_cast< SoftwareRAID* >(device)->status() == SoftwareRAID::Status::Inactive )
{ {

@ -32,4 +32,5 @@ if( ECM_FOUND AND BUILD_TESTING )
) )
set_target_properties( partitionjobtests PROPERTIES AUTOMOC TRUE ) set_target_properties( partitionjobtests PROPERTIES AUTOMOC TRUE )
target_compile_definitions( partitionjobtests PRIVATE ${_partition_defs} )
endif() endif()

Loading…
Cancel
Save