From 4552631086bbd4bfcf6305f8704fa0c9a16378ab Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 11 Oct 2019 16:56:04 +0200 Subject: [PATCH] [unpackfs] Prep for more information in file_copy - Give the whole entry to file_copy, not just the destination. This will allow file_copy to work with local excludes. - Pluck entry.destination out immediately, to keep code changes minimal. - Document the parameters. --- src/modules/unpackfs/main.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/modules/unpackfs/main.py b/src/modules/unpackfs/main.py index 035912d48..8c074738a 100644 --- a/src/modules/unpackfs/main.py +++ b/src/modules/unpackfs/main.py @@ -93,15 +93,18 @@ def global_excludes(): return lst -def file_copy(source, dest, progress_cb): +def file_copy(source, entry, progress_cb): """ Extract given image using rsync. - :param source: - :param dest: - :param progress_cb: - :return: + :param source: Source file. This may be the place the entry's + image is mounted, or if it's a single file, the entry's source value. + :param entry: The UnpackEntry being copied. + :param progress_cb: A callback function for progress reporting. + Takes a number and a total-number. """ + dest = entry.destination + # Environment used for executing rsync properly # Setting locale to C (fix issue with tr_TR locale) at_env = os.environ @@ -313,7 +316,7 @@ class UnpackOperation: else: source = imgmountdir - return file_copy(source, entry.destination, progress_cb) + return file_copy(source, entry, progress_cb) finally: if not entry.is_file(): subprocess.check_call(["umount", "-l", imgmountdir])