commit
c1f1934c27
@ -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_*
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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( "<br/>" );
|
||||
}
|
||||
|
||||
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( "<br/>" ) );
|
||||
return diskInfoLabel + "<br/>" + 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 <b>always</b> 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
|
||||
{
|
||||
|
@ -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
|
||||
|
||||
|
@ -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 ) );
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user