diff --git a/CMakeModules/BoostPython3.cmake b/CMakeModules/BoostPython3.cmake index 70fb0aa49..021c1947a 100644 --- a/CMakeModules/BoostPython3.cmake +++ b/CMakeModules/BoostPython3.cmake @@ -37,7 +37,12 @@ macro( _find_boost_python3_int boost_version componentname found_var ) find_package( Boost ${boost_version} QUIET COMPONENTS ${_fbp_name} ) string( TOUPPER ${_fbp_name} _fbp_uc_name ) if( Boost_${_fbp_uc_name}_FOUND ) - set( ${found_var} ${_fbp_uc_name} ) + if( CMAKE_SYSTEM_NAME MATCHES "FreeBSD" ) + # No upcasing + set( ${found_var} ${_fbp_name} ) + else() + set( ${found_var} ${_fbp_uc_name} ) + endif() break() endif() endforeach() @@ -63,7 +68,7 @@ macro( find_boost_python3 boost_version python_version found_var ) endif() set( ${found_var} ${_fbp_found} ) - + # This is superfluous, but allows proper reporting in the features list if ( _fbp_found ) find_package( Boost ${boost_version} COMPONENTS ${_fbp_found} ) diff --git a/src/libcalamares/Job.h b/src/libcalamares/Job.h index 3a68297ca..862a5f3f5 100644 --- a/src/libcalamares/Job.h +++ b/src/libcalamares/Job.h @@ -96,6 +96,14 @@ public: explicit Job( QObject* parent = nullptr ); virtual ~Job(); + /** @brief The job's (relative) weight. + * + * The default implementation returns 1.0, which gives all jobs + * the same weight, so they advance the overall progress the same + * amount. This is nonsense, since some jobs take much longer than + * others; it's up to the individual jobs to say something about + * how much work is (relatively) done. + */ virtual qreal getJobWeight() const; virtual QString prettyName() const = 0; virtual QString prettyDescription() const; diff --git a/src/libcalamares/PythonJob.cpp b/src/libcalamares/PythonJob.cpp index 39f500194..6524ed922 100644 --- a/src/libcalamares/PythonJob.cpp +++ b/src/libcalamares/PythonJob.cpp @@ -170,7 +170,8 @@ namespace Calamares { -PythonJob::PythonJob( const QString& scriptFile, +PythonJob::PythonJob( const QString& instance, + const QString& scriptFile, const QString& workingPath, const QVariantMap& moduleConfiguration, QObject* parent ) @@ -179,12 +180,18 @@ PythonJob::PythonJob( const QString& scriptFile, , m_workingPath( workingPath ) , m_description() , m_configurationMap( moduleConfiguration ) + , m_weight( (instance == QStringLiteral( "unpackfs" )) ? 12.0 : 1.0 ) { } PythonJob::~PythonJob() {} +qreal +PythonJob::getJobWeight() const +{ + return m_weight; +} QString PythonJob::prettyName() const diff --git a/src/libcalamares/PythonJob.h b/src/libcalamares/PythonJob.h index a2bdf171c..9c2b91a57 100644 --- a/src/libcalamares/PythonJob.h +++ b/src/libcalamares/PythonJob.h @@ -21,6 +21,8 @@ #include "Job.h" +#include "modulesystem/InstanceKey.h" + #include namespace CalamaresPython @@ -36,7 +38,8 @@ class PythonJob : public Job { Q_OBJECT public: - explicit PythonJob( const QString& scriptFile, + explicit PythonJob( const QString& instance, // TODO: InstanceKey + const QString& scriptFile, const QString& workingPath, const QVariantMap& moduleConfiguration = QVariantMap(), QObject* parent = nullptr ); @@ -46,6 +49,8 @@ public: QString prettyStatusMessage() const override; JobResult exec() override; + virtual qreal getJobWeight() const override; + private: friend class CalamaresPython::Helper; friend class CalamaresPython::PythonJobInterface; @@ -56,6 +61,7 @@ private: QString m_workingPath; QString m_description; QVariantMap m_configurationMap; + qreal m_weight; }; } // namespace Calamares diff --git a/src/libcalamaresui/modulesystem/PythonJobModule.cpp b/src/libcalamaresui/modulesystem/PythonJobModule.cpp index c9e90a707..f731fa693 100644 --- a/src/libcalamaresui/modulesystem/PythonJobModule.cpp +++ b/src/libcalamaresui/modulesystem/PythonJobModule.cpp @@ -49,7 +49,7 @@ PythonJobModule::loadSelf() return; } - m_job = Calamares::job_ptr( new PythonJob( m_scriptFileName, m_workingPath, m_configurationMap ) ); + m_job = Calamares::job_ptr( new PythonJob( name(), m_scriptFileName, m_workingPath, m_configurationMap ) ); m_loaded = true; } diff --git a/src/modules/unpackfs/main.py b/src/modules/unpackfs/main.py index 53ffd37df..a6ee3455d 100644 --- a/src/modules/unpackfs/main.py +++ b/src/modules/unpackfs/main.py @@ -132,6 +132,9 @@ def file_copy(source, entry, progress_cb): process = subprocess.Popen( args, env=at_env, bufsize=1, stdout=subprocess.PIPE, close_fds=ON_POSIX ) + # last_num_files_copied trails num_files_copied, and whenever at least 100 more + # files have been copied, progress is reported and last_num_files_copied is updated. + last_num_files_copied = 0 for line in iter(process.stdout.readline, b''): # rsync outputs progress in parentheses. Each line will have an @@ -157,7 +160,8 @@ def file_copy(source, entry, progress_cb): num_files_copied = num_files_total_local - num_files_remaining # I guess we're updating every 100 files... - if num_files_copied % 100 == 0: + if num_files_copied - last_num_files_copied >= 100: + last_num_files_copied = num_files_copied progress_cb(num_files_copied, num_files_total_local) process.wait()