Merge branch 'fix-kpmcore-use'

This commit is contained in:
Adriaan de Groot 2019-04-12 13:24:12 +02:00
commit 4987dc31a1
9 changed files with 28 additions and 14 deletions

View File

@ -2,12 +2,17 @@ find_package( KPMcore 3.3 )
find_package( Qt5 REQUIRED DBus ) # Needed for KPMCore
find_package( KF5 REQUIRED I18n WidgetsAddons ) # Needed for KPMCore
set( _partition_defs "" )
if ( KPMcore_FOUND )
include_directories( ${KPMCORE_INCLUDE_DIR} )
include_directories( ${PROJECT_BINARY_DIR}/src/libcalamares )
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()
# The PartitionIterator is a small class, and it's easiest -- but also a
@ -21,6 +26,7 @@ if ( KPMcore_FOUND )
LINK_PRIVATE_LIBRARIES
kpmcore
calamares
COMPILE_DEFINITIONS ${_partition_defs}
SHARED_LIB
)
@ -38,7 +44,8 @@ if ( KPMcore_FOUND )
Qt5::Test
)
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()
else()
calamares_skip_module( "fsresizer (missing suitable KPMcore)" )

View File

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

View File

@ -28,7 +28,10 @@ set_package_properties(
if ( KPMcore_FOUND )
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()
include_directories( ${KPMCORE_INCLUDE_DIR} )

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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