[partition] Introduce skipping-partitioning-jobs

Don't do the actual KPM work, but pretend that they were done.
This can be useful -- independently of the existing unsafe-
options and failing partitioning entirely -- for testing
partition layouts in modules following the *partition* one.
This commit is contained in:
Adriaan de Groot 2022-02-21 12:39:56 +01:00
parent 7129a2239c
commit 682ae24b7d
2 changed files with 19 additions and 0 deletions

View file

@ -11,8 +11,16 @@
# it will error out at runtime unless you **also** switch **off**
# DEBUG_PARTITION_BAIL_OUT, at which point you are welcome to shoot
# yourself in the foot.
#
# Independently, DEBUG_PARTITION_SKIP will not do the actual partitioning
# through KPMCore, but it **will** save the global storage setup as if
# it has done the partitioning. This is going to confuse subsequent
# modules since the partitions on disk won't match GS, but it can be
# useful for debugging simulated installations that don't need to
# mount the target filesystems.
option( DEBUG_PARTITION_UNSAFE "Allow unsafe partitioning choices." OFF )
option( DEBUG_PARTITION_BAIL_OUT "Unsafe partitioning will error out on exec." ON )
option( DEBUG_PARTITION_SKIP "Don't actually do any partitioning." OFF)
# This is very chatty, useful mostly if you don't know what KPMCore offers.
option( DEBUG_FILESYSTEMS "Log all available Filesystems from KPMCore." OFF )
@ -29,6 +37,9 @@ endif()
if ( DEBUG_FILESYSTEMS )
list( APPEND _partition_defs DEBUG_FILESYSTEMS )
endif()
if( DEBUG_PARTITION_SKIP )
list( APPEND _partition_defs DEBUG_PARTITION_SKIP )
endif()
find_package(ECM ${ECM_VERSION} REQUIRED NO_MODULE)

View file

@ -639,6 +639,9 @@ PartitionCoreModule::jobs( const Config* config ) const
lst << automountControl;
lst << Calamares::job_ptr( new ClearTempMountsJob() );
#ifdef DEBUG_PARTITION_SKIP
cWarning() << "Partitioning actions are skipped.";
#else
const QStringList doNotClose = findEssentialLVs( m_deviceInfos );
for ( const auto* info : m_deviceInfos )
@ -650,10 +653,15 @@ PartitionCoreModule::jobs( const Config* config ) const
lst << Calamares::job_ptr( job );
}
}
#endif
for ( const auto* info : m_deviceInfos )
{
#ifdef DEBUG_PARTITION_SKIP
cWarning() << Logger::SubEntry << "Skipping jobs for" << info->device.data()->deviceNode();
#else
lst << info->jobs();
#endif
devices << info->device.data();
}
lst << Calamares::job_ptr( new FillGlobalStorageJob( config, devices, m_bootLoaderInstallPath ) );