commit:     1a25cc20a662d5dbcbaa18b4f10093f95428b1d3
Author:     Rin Cat (鈴猫) <syu.os <AT> protonmail <DOT> com>
AuthorDate: Sun Jul  3 21:10:29 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jul  5 22:56:05 2022 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=1a25cc20

Fix _check_pre_quickpkg_files image prefix

Closes: https://bugs.gentoo.org/851276
Signed-off-by: Sheng Yu <syu.os <AT> protonmail.com>
Closes: https://github.com/gentoo/portage/pull/847
Signed-off-by: Sam James <sam <AT> gentoo.org>

 lib/portage/gpkg.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/portage/gpkg.py b/lib/portage/gpkg.py
index fc111e44a..0622feb70 100644
--- a/lib/portage/gpkg.py
+++ b/lib/portage/gpkg.py
@@ -1847,11 +1847,12 @@ class gpkg:
             image_total_size,
         )
 
-    def _check_pre_quickpkg_files(self, contents, root):
+    def _check_pre_quickpkg_files(self, contents, root, image_prefix="image"):
         """
         Check the pre quickpkg files size and path, return the longest
         path length, largest single file size, and total files size.
         """
+        image_prefix_length = len(image_prefix) + 1
         root_dir = os.path.join(
             normalize_path(
                 _unicode_decode(root, encoding=_encodings["fs"], 
errors="strict")
@@ -1881,6 +1882,7 @@ class gpkg:
             prefix_length = (
                 len(_unicode_encode(d, encoding=_encodings["fs"], 
errors="strict"))
                 - root_dir_length
+                + image_prefix_length
             )
             image_max_prefix_length = max(image_max_prefix_length, 
prefix_length)
 
@@ -1892,6 +1894,7 @@ class gpkg:
             path_length = (
                 len(_unicode_encode(path, encoding=_encodings["fs"], 
errors="strict"))
                 - root_dir_length
+                + image_prefix_length
             )
 
             file_stat = os.lstat(path)

Reply via email to