From 10d1c4cf5bde5646c8791c511ad8c87455a50f38 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 20 Jan 2020 19:39:05 +0100 Subject: [PATCH 1/5] [unpackfs] Improve progress reporting - don't rely on exactly 100 files being copied (thanks to Kevin Kofler) --- src/modules/unpackfs/main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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() From b0b9073b40fa017b99afed54d6aa428c51a5a69c Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sat, 25 Jan 2020 02:26:52 +0100 Subject: [PATCH 2/5] CMake: fix boost.python detection on FreeBSD --- CMakeModules/BoostPython3.cmake | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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} ) From 0c9188ee83222d6856cb0c41e91f601e3baeb9ed Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sat, 25 Jan 2020 01:10:04 +0100 Subject: [PATCH 3/5] [libcalamares] Document JobWeight --- src/libcalamares/Job.h | 8 ++++++++ 1 file changed, 8 insertions(+) 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; From d4b24894cbc1159823fe00d9bc2bea2e16205f20 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sat, 25 Jan 2020 01:10:23 +0100 Subject: [PATCH 4/5] [libcalamares] Weigh unpackfs extra heavy - This is a gross hack, which hard-codes unpackfs as much-heavier than other Python modules. --- src/libcalamares/PythonJob.cpp | 9 ++++++++- src/libcalamares/PythonJob.h | 8 +++++++- src/libcalamaresui/modulesystem/PythonJobModule.cpp | 2 +- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/libcalamares/PythonJob.cpp b/src/libcalamares/PythonJob.cpp index 39f500194..1fe0ae513 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" )) ? 8.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 46ec1dff1..072388cca 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; } From 9976e9265914d644a323c6b047aff85e391d3898 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sat, 25 Jan 2020 03:06:20 +0100 Subject: [PATCH 5/5] [libcalamares] Enlarge unpackfs to 12x --- src/libcalamares/PythonJob.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcalamares/PythonJob.cpp b/src/libcalamares/PythonJob.cpp index 1fe0ae513..6524ed922 100644 --- a/src/libcalamares/PythonJob.cpp +++ b/src/libcalamares/PythonJob.cpp @@ -180,7 +180,7 @@ PythonJob::PythonJob( const QString& instance, , m_workingPath( workingPath ) , m_description() , m_configurationMap( moduleConfiguration ) - , m_weight( (instance == QStringLiteral( "unpackfs" )) ? 8.0 : 1.0 ) + , m_weight( (instance == QStringLiteral( "unpackfs" )) ? 12.0 : 1.0 ) { }