From dc2fafe3241ff181f70de6a2d73315be912ecf0e Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 29 Mar 2019 12:51:00 -0400 Subject: [PATCH] [unpackfs] to-chk is also progress information - ir-chk happens first, and then there's a phase with to-chk messages; use those as well. --- src/modules/unpackfs/main.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/modules/unpackfs/main.py b/src/modules/unpackfs/main.py index 7417793e8..4d077ce29 100644 --- a/src/modules/unpackfs/main.py +++ b/src/modules/unpackfs/main.py @@ -109,19 +109,20 @@ def file_copy(source, dest, progress_cb): ) for line in iter(process.stdout.readline, b''): - # small comment on this regexp. - # rsync outputs three items in the progress (in parentheses) + # rsync outputs progress in parentheses. Each line will have an + # xfer and a chk item (either ir-chk or to-chk) as follows: + # # - xfer#x => Interpret it as 'file copy try no. x' # - ir-chk=x/y, where: # - x = number of files yet to be checked # - y = currently calculated total number of files. - # - to-chk=x/y, which is similar but seems to only be emitted when - # progress is short; these are ignored. + # - to-chk=x/y, which is similar and happens once the ir-chk + # phase (collecting total files) is over. # # If you're copying directory with some links in it, the xfer# # might not be a reliable counter (for one increase of xfer, many # files may be created). - m = re.findall(r'xfr#(\d+), ir-chk=(\d+)/(\d+)', line.decode()) + m = re.findall(r'xfr#(\d+), ..-chk=(\d+)/(\d+)', line.decode()) if m: # we've got a percentage update