mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-28 09:55:37 -04:00
[unpackfs] Re-jig progress reporting
- rsync reports its own progress, and reports on files that find -type f doesn't. This meant that the numbers didn't match what was stored in entry.total - The ir-phase adds files to be handled; to-phase happens once ir-phase is over and the remaining files are processed. By adding the to-phase files, percentages over 100% were reported (in part because the number of files doesn't match). - Update expected entries total from rsync output. - Re-jig computation of how done everything is: tally it up in integers, and do only one global progress percentage.
This commit is contained in:
parent
6d85fd3586
commit
fae0b8c2f8
1 changed files with 13 additions and 7 deletions
|
@ -136,10 +136,10 @@ def file_copy(source, dest, progress_cb):
|
||||||
|
|
||||||
# I guess we're updating every 100 files...
|
# I guess we're updating every 100 files...
|
||||||
if num_files_copied % 100 == 0:
|
if num_files_copied % 100 == 0:
|
||||||
progress_cb(num_files_copied)
|
progress_cb(num_files_copied, num_files_total_local)
|
||||||
|
|
||||||
process.wait()
|
process.wait()
|
||||||
progress_cb(num_files_copied) # Push towards 100%
|
progress_cb(num_files_copied, num_files_total_local) # Push towards 100%
|
||||||
|
|
||||||
# 23 is the return code rsync returns if it cannot write extended
|
# 23 is the return code rsync returns if it cannot write extended
|
||||||
# attributes (with -X) because the target file system does not support it,
|
# attributes (with -X) because the target file system does not support it,
|
||||||
|
@ -177,14 +177,19 @@ class UnpackOperation:
|
||||||
"""
|
"""
|
||||||
progress = float(0)
|
progress = float(0)
|
||||||
|
|
||||||
|
done = 0
|
||||||
|
total = 0
|
||||||
|
complete = 0
|
||||||
for entry in self.entries:
|
for entry in self.entries:
|
||||||
if entry.total == 0:
|
if entry.total == 0:
|
||||||
continue
|
continue
|
||||||
|
total += entry.total
|
||||||
|
done += entry.copied
|
||||||
|
if entry.total == entry.copied:
|
||||||
|
complete += 1
|
||||||
|
|
||||||
partialprogress = 0.05 # Having a total !=0 gives 5%
|
if done > 0 and total > 0:
|
||||||
|
progress = 0.05 + (0.90 * done / total) + (0.05 * complete / len(self.entries))
|
||||||
partialprogress += 0.95 * (entry.copied / float(entry.total))
|
|
||||||
progress += partialprogress / len(self.entries)
|
|
||||||
|
|
||||||
job.setprogress(progress)
|
job.setprogress(progress)
|
||||||
|
|
||||||
|
@ -263,12 +268,13 @@ class UnpackOperation:
|
||||||
:param imgmountdir:
|
:param imgmountdir:
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
def progress_cb(copied):
|
def progress_cb(copied, total):
|
||||||
""" Copies file to given destination target.
|
""" Copies file to given destination target.
|
||||||
|
|
||||||
:param copied:
|
:param copied:
|
||||||
"""
|
"""
|
||||||
entry.copied = copied
|
entry.copied = copied
|
||||||
|
entry.total = total
|
||||||
self.report_progress()
|
self.report_progress()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue