Merge branch 'issue-1603' into calamares

FIXES #1603
This commit is contained in:
Adriaan de Groot 2021-09-22 01:45:36 +02:00
commit 744979a095
6 changed files with 36 additions and 33 deletions

View File

@ -112,17 +112,19 @@ public:
QString message; ///< Filled in with errors
QString details;
Logger::Once o;
m_jobIndex = 0;
for ( const auto& jobitem : *m_runningJobs )
{
if ( failureEncountered && !jobitem.job->isEmergency() )
{
cDebug() << "Skipping non-emergency job" << jobitem.job->prettyName();
cDebug() << o << "Skipping non-emergency job" << jobitem.job->prettyName();
}
else
{
cDebug() << "Starting" << ( failureEncountered ? "EMERGENCY JOB" : "job" ) << jobitem.job->prettyName()
cDebug() << o << "Starting" << ( failureEncountered ? "EMERGENCY JOB" : "job" ) << jobitem.job->prettyName()
<< '(' << ( m_jobIndex + 1 ) << '/' << m_runningJobs->count() << ')';
o.refresh(); // So next time it shows the function header again
emitProgress( 0.0 ); // 0% for *this job*
connect( jobitem.job.data(), &Job::progress, this, &JobThread::emitProgress );
auto result = jobitem.job->exec();

View File

@ -101,7 +101,7 @@ Module::loadConfigurationFile( const QString& configFileName ) //throws YAML::E
YAML::Node doc = YAML::Load( ba.constData() );
if ( doc.IsNull() )
{
cDebug() << "Found empty module configuration" << path;
cWarning() << "Found empty module configuration" << path;
// Special case: empty config files are valid,
// but aren't a map.
return;
@ -112,14 +112,13 @@ Module::loadConfigurationFile( const QString& configFileName ) //throws YAML::E
return;
}
cDebug() << "Loaded module configuration" << path;
m_configurationMap = CalamaresUtils::yamlMapToVariant( doc );
m_emergency = m_maybe_emergency && m_configurationMap.contains( EMERGENCY )
&& m_configurationMap[ EMERGENCY ].toBool();
return;
}
}
cDebug() << "No config file for" << name() << "found anywhere at" << Logger::DebugList( configCandidates );
cWarning() << "No config file for" << name() << "found anywhere at" << Logger::DebugList( configCandidates );
}

View File

@ -100,12 +100,10 @@ getInternal()
KPMManager::KPMManager()
: m_d( getInternal() )
{
cDebug() << "KPMManager" << s_backend.use_count() << "created.";
}
KPMManager::~KPMManager()
{
cDebug() << "KPMManager" << s_backend.use_count() << "being destroyed.";
}
KPMManager::operator bool() const

View File

@ -169,7 +169,7 @@ System::runCommand( System::RunLocation location,
}
}
cDebug() << "Running" << program << RedactedList( arguments );
cDebug() << Logger::SubEntry << "Running" << program << RedactedList( arguments );
process.start();
if ( !process.waitForStarted() )
{
@ -208,10 +208,6 @@ System::runCommand( System::RunLocation location,
{
cDebug() << Logger::SubEntry << "Finished. Exit code:" << r << "output:\n" << Logger::NoQuote << output;
}
else
{
cDebug() << Logger::SubEntry << "Finished. Exit code:" << r;
}
}
else // if ( r != 0 )
{

View File

@ -310,6 +310,14 @@ public:
}
friend CDebug& operator<<( CDebug&&, const Once& );
/** @brief Restore the object to "fresh" state
*
* It may be necessary to allow the Once object to stream the
* function header again -- for instance, after logging an error,
* any following debug log might want to re-introduce the header.
*/
void refresh() { m = true; }
private:
mutable bool m = false;
};

View File

@ -126,23 +126,22 @@ canBeResized( Partition* candidate, const Logger::Once& o )
return false;
}
cDebug() << o << "Checking if" << convenienceName( candidate ) << "can be resized.";
if ( !candidate->fileSystem().supportGrow() || !candidate->fileSystem().supportShrink() )
{
cDebug() << Logger::SubEntry << "NO, filesystem" << candidate->fileSystem().name()
<< "does not support resize.";
cDebug() << o << "Can not resize" << convenienceName( candidate ) << ", filesystem"
<< candidate->fileSystem().name() << "does not support resize.";
return false;
}
if ( isPartitionFreeSpace( candidate ) )
{
cDebug() << Logger::SubEntry << "NO, partition is free space";
cDebug() << o << "Can not resize" << convenienceName( candidate ) << ", partition is free space";
return false;
}
if ( candidate->isMounted() )
{
cDebug() << Logger::SubEntry << "NO, partition is mounted";
cDebug() << o << "Can not resize" << convenienceName( candidate ) << ", partition is mounted";
return false;
}
@ -151,14 +150,14 @@ canBeResized( Partition* candidate, const Logger::Once& o )
PartitionTable* table = dynamic_cast< PartitionTable* >( candidate->parent() );
if ( !table )
{
cDebug() << Logger::SubEntry << "NO, no partition table found";
cDebug() << o << "Can not resize" << convenienceName( candidate ) << ", no partition table found";
return false;
}
if ( table->numPrimaries() >= table->maxPrimaries() )
{
cDebug() << Logger::SubEntry << "NO, partition table already has" << table->maxPrimaries()
<< "primary partitions.";
cDebug() << o << "Can not resize" << convenienceName( candidate ) << ", partition table already has"
<< table->maxPrimaries() << "primary partitions.";
return false;
}
}
@ -167,7 +166,8 @@ canBeResized( Partition* candidate, const Logger::Once& o )
double requiredStorageGiB = getRequiredStorageGiB( ok );
if ( !ok )
{
cDebug() << Logger::SubEntry << "NO, requiredStorageGiB is not set correctly.";
cDebug() << o << "Can not resize" << convenienceName( candidate )
<< ", requiredStorageGiB is not set correctly.";
return false;
}
@ -200,24 +200,25 @@ canBeResized( Partition* candidate, const Logger::Once& o )
bool
canBeResized( DeviceModel* dm, const QString& partitionPath, const Logger::Once& o )
{
cDebug() << o << "Checking if" << partitionPath << "can be resized.";
QString partitionWithOs = partitionPath;
if ( partitionWithOs.startsWith( "/dev/" ) )
if ( partitionPath.startsWith( "/dev/" ) )
{
for ( int i = 0; i < dm->rowCount(); ++i )
{
Device* dev = dm->deviceForIndex( dm->index( i ) );
Partition* candidate = CalamaresUtils::Partition::findPartitionByPath( { dev }, partitionWithOs );
Partition* candidate = CalamaresUtils::Partition::findPartitionByPath( { dev }, partitionPath );
if ( candidate )
{
return canBeResized( candidate, o );
}
}
cDebug() << Logger::SubEntry << "no Partition* found for" << partitionWithOs;
cWarning() << "Can not resize" << partitionPath << ", no Partition* found.";
return false;
}
else
{
cWarning() << "Can not resize" << partitionPath << ", does not start with /dev";
return false;
}
cDebug() << Logger::SubEntry << "Partition" << partitionWithOs << "CANNOT BE RESIZED FOR AUTOINSTALL.";
return false;
}
@ -250,8 +251,6 @@ lookForFstabEntries( const QString& partitionPath )
{
QFile fstabFile( mount.path() + "/etc/fstab" );
cDebug() << Logger::SubEntry << "reading" << fstabFile.fileName();
if ( fstabFile.open( QIODevice::ReadOnly | QIODevice::Text ) )
{
const QStringList fstabLines = QString::fromLocal8Bit( fstabFile.readAll() ).split( '\n' );
@ -261,10 +260,11 @@ lookForFstabEntries( const QString& partitionPath )
fstabEntries.append( FstabEntry::fromEtcFstab( rawLine ) );
}
fstabFile.close();
cDebug() << Logger::SubEntry << "got" << fstabEntries.count() << "lines.";
const int lineCount = fstabEntries.count();
std::remove_if(
fstabEntries.begin(), fstabEntries.end(), []( const FstabEntry& x ) { return !x.isValid(); } );
cDebug() << Logger::SubEntry << "got" << fstabEntries.count() << "fstab entries.";
cDebug() << Logger::SubEntry << "got" << fstabEntries.count() << "fstab entries from" << lineCount
<< "lines in" << fstabFile.fileName();
}
else
{