diff --git a/CMakeLists.txt b/CMakeLists.txt
index dd46148d8..9d841d284 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -75,7 +75,7 @@ option( BUILD_SCHEMA_TESTING "Enable schema-validation-tests" ON )
# - DEBUG_FILESYSTEMS does extra logging and checking when looking at
# partition configuration. Lists known KPMCore FS types.
# - DEBUG_PARTITION_UNSAFE (see partition/CMakeLists.txt)
-# - DEBUG_PARTITION_LAME (see partition/CMakeLists.txt)
+# - DEBUG_PARTITION_BAIL_OUT (see partition/CMakeLists.txt)
### USE_*
diff --git a/ci/calamaresstyle b/ci/calamaresstyle
index f5bcd2bb9..52fe30737 100755
--- a/ci/calamaresstyle
+++ b/ci/calamaresstyle
@@ -24,7 +24,7 @@ test -f "$TOPDIR/.clang-format" || { echo "! No .clang-format support files in $
AS=$( which astyle )
# Allow specifying CF_VERSIONS outside already
-CF_VERSIONS="$CF_VERSIONS clang-format13 clang-format12 clang-format"
+CF_VERSIONS="$CF_VERSIONS clang-format13 clang-format-13 clang-format12 clang-format-12 clang-format"
for _cf in $CF_VERSIONS
do
# Not an error if this particular clang-format isn't found
diff --git a/src/modules/fstab/main.py b/src/modules/fstab/main.py
index 6a771a24b..07a00c14d 100644
--- a/src/modules/fstab/main.py
+++ b/src/modules/fstab/main.py
@@ -92,7 +92,8 @@ def disk_name_for_partition(partition):
"""
name = os.path.basename(partition["device"])
- if name.startswith("/dev/mmcblk") or name.startswith("/dev/nvme"):
+ if name.startswith("mmcblk") or name.startswith("nvme"):
+ # Typical mmc device is mmcblk0p1, nvme looks like nvme0n1p2
return re.sub("p[0-9]+$", "", name)
return re.sub("[0-9]+$", "", name)
diff --git a/src/modules/partition/CMakeLists.txt b/src/modules/partition/CMakeLists.txt
index 96378d98d..940aacdd8 100644
--- a/src/modules/partition/CMakeLists.txt
+++ b/src/modules/partition/CMakeLists.txt
@@ -9,10 +9,18 @@
# current disk). Set DEBUG_PARTITION_UNSAFE to allow that (it turns off
# some filtering of devices). If you **do** allow unsafe partitioning,
# it will error out at runtime unless you **also** switch **off**
-# DEBUG_PARTITION_LAME, at which point you are welcome to shoot
+# 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_LAME "Unsafe partitioning will error out on exec." ON )
+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 )
@@ -21,14 +29,17 @@ include_directories( ${CMAKE_SOURCE_DIR} ) # For 3rdparty
set( _partition_defs )
if( DEBUG_PARTITION_UNSAFE )
- if( DEBUG_PARTITION_LAME )
- list( APPEND _partition_defs DEBUG_PARTITION_LAME )
+ if( DEBUG_PARTITION_BAIL_OUT )
+ list( APPEND _partition_defs DEBUG_PARTITION_BAIL_OUT )
endif()
list( APPEND _partition_defs DEBUG_PARTITION_UNSAFE )
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)
diff --git a/src/modules/partition/PartitionViewStep.cpp b/src/modules/partition/PartitionViewStep.cpp
index 5e8bf2ef0..f3d4fc8ac 100644
--- a/src/modules/partition/PartitionViewStep.cpp
+++ b/src/modules/partition/PartitionViewStep.cpp
@@ -52,8 +52,8 @@ PartitionViewStep::PartitionViewStep( QObject* parent )
m_waitingWidget = new WaitingWidget( QString() );
m_widget->addWidget( m_waitingWidget );
- CALAMARES_RETRANSLATE(
- if ( m_waitingWidget ) { m_waitingWidget->setText( tr( "Gathering system information..." ) ); } );
+ CALAMARES_RETRANSLATE( if ( m_waitingWidget )
+ { m_waitingWidget->setText( tr( "Gathering system information..." ) ); } );
m_core = new PartitionCoreModule( this ); // Unusable before init is complete!
// We're not done loading, but we need the configuration map first.
@@ -216,29 +216,14 @@ diskDescription( int listLength, const PartitionCoreModule::SummaryInfo& info, C
QString
PartitionViewStep::prettyStatus() const
{
- QString jobsLabel, modeText, diskInfoLabel;
-
const Config::InstallChoice choice = m_config->installChoice();
const QList< PartitionCoreModule::SummaryInfo > list = m_core->createSummaryInfo();
cDebug() << "Summary for Partition" << list.length() << choice;
- if ( list.length() > 1 ) // There are changes on more than one disk
- {
- modeText = modeDescription( choice );
- }
-
- for ( const auto& info : list )
- {
- // TODO: this overwrites each iteration
- diskInfoLabel = diskDescription( list.length(), info, choice );
- }
-
- const QStringList jobsLines = jobDescriptions( jobs() );
- if ( !jobsLines.isEmpty() )
- {
- jobsLabel = jobsLines.join( "
" );
- }
-
+ auto joinDiskInfo = [ choice = choice ]( QString& s, const PartitionCoreModule::SummaryInfo& i )
+ { return s + diskDescription( 1, i, choice ); };
+ const QString diskInfoLabel = std::accumulate( list.begin(), list.end(), QString(), joinDiskInfo );
+ const QString jobsLabel = jobDescriptions( jobs() ).join( QStringLiteral( "
" ) );
return diskInfoLabel + "
" + jobsLabel;
}
@@ -257,6 +242,24 @@ PartitionViewStep::createSummaryWidget() const
formLayout->setContentsMargins( MARGIN, 0, MARGIN, MARGIN );
mainLayout->addLayout( formLayout );
+#if defined( DEBUG_PARTITION_UNSAFE ) || defined( DEBUG_PARTITION_BAIL_OUT ) || defined( DEBUG_PARTITION_SKIP )
+ auto specialRow = [ = ]( CalamaresUtils::ImageType t, const QString& s )
+ {
+ QLabel* icon = new QLabel;
+ icon->setPixmap( CalamaresUtils::defaultPixmap( t ) );
+ formLayout->addRow( icon, new QLabel( s ) );
+ };
+#endif
+#if defined( DEBUG_PARTITION_UNSAFE )
+ specialRow( CalamaresUtils::ImageType::StatusWarning, tr( "Unsafe partition actions are enabled." ) );
+#endif
+#if defined( DEBUG_PARTITION_BAIL_OUT )
+ specialRow( CalamaresUtils::ImageType::Information, tr( "Partitioning is configured to always fail." ) );
+#endif
+#if defined( DEBUG_PARTITION_SKIP )
+ specialRow( CalamaresUtils::ImageType::Information, tr( "No partitions will be changed." ) );
+#endif
+
const QList< PartitionCoreModule::SummaryInfo > list = m_core->createSummaryInfo();
if ( list.length() > 1 ) // There are changes on more than one disk
{
diff --git a/src/modules/partition/core/DeviceList.cpp b/src/modules/partition/core/DeviceList.cpp
index adbbddd68..b3a10dde7 100644
--- a/src/modules/partition/core/DeviceList.cpp
+++ b/src/modules/partition/core/DeviceList.cpp
@@ -143,7 +143,7 @@ getDevices( DeviceType which )
*/
#ifdef DEBUG_PARTITION_UNSAFE
cWarning() << "Allowing unsafe partitioning choices." << devices.count() << "candidates.";
-#ifdef DEBUG_PARTITION_LAME
+#ifdef DEBUG_PARTITION_BAIL_OUT
cDebug() << Logger::SubEntry << "unsafe partitioning has been lamed, and will fail.";
#endif
diff --git a/src/modules/partition/core/PartitionCoreModule.cpp b/src/modules/partition/core/PartitionCoreModule.cpp
index 989327ef0..79adf7686 100644
--- a/src/modules/partition/core/PartitionCoreModule.cpp
+++ b/src/modules/partition/core/PartitionCoreModule.cpp
@@ -37,7 +37,7 @@
#include "jobs/ResizeVolumeGroupJob.h"
#include "jobs/SetPartitionFlagsJob.h"
-#ifdef DEBUG_PARTITION_LAME
+#ifdef DEBUG_PARTITION_BAIL_OUT
#include "JobExample.h"
#endif
#include "partition/PartitionIterator.h"
@@ -622,7 +622,7 @@ PartitionCoreModule::jobs( const Config* config ) const
QList< Device* > devices;
#ifdef DEBUG_PARTITION_UNSAFE
-#ifdef DEBUG_PARTITION_LAME
+#ifdef DEBUG_PARTITION_BAIL_OUT
cDebug() << "Unsafe partitioning is enabled.";
cDebug() << Logger::SubEntry << "it has been lamed, and will fail.";
lst << Calamares::job_ptr( new Calamares::FailJob( QStringLiteral( "Partition" ) ) );
@@ -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 ) );
diff --git a/src/modules/partition/gui/ChoicePage.cpp b/src/modules/partition/gui/ChoicePage.cpp
index 588c1b643..c0845da7f 100644
--- a/src/modules/partition/gui/ChoicePage.cpp
+++ b/src/modules/partition/gui/ChoicePage.cpp
@@ -1481,7 +1481,7 @@ ChoicePage::setupActions()
}
#ifdef DEBUG_PARTITION_UNSAFE
-#ifdef DEBUG_PARTITION_LAME
+#ifdef DEBUG_PARTITION_BAIL_OUT
// If things can't be broken, allow all the buttons
atLeastOneCanBeReplaced = true;
atLeastOneCanBeResized = true;