1 |
commit: 1a25cc20a662d5dbcbaa18b4f10093f95428b1d3 |
2 |
Author: Rin Cat (鈴猫) <syu.os <AT> protonmail <DOT> com> |
3 |
AuthorDate: Sun Jul 3 21:10:29 2022 +0000 |
4 |
Commit: Sam James <sam <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Jul 5 22:56:05 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=1a25cc20 |
7 |
|
8 |
Fix _check_pre_quickpkg_files image prefix |
9 |
|
10 |
Closes: https://bugs.gentoo.org/851276 |
11 |
Signed-off-by: Sheng Yu <syu.os <AT> protonmail.com> |
12 |
Closes: https://github.com/gentoo/portage/pull/847 |
13 |
Signed-off-by: Sam James <sam <AT> gentoo.org> |
14 |
|
15 |
lib/portage/gpkg.py | 5 ++++- |
16 |
1 file changed, 4 insertions(+), 1 deletion(-) |
17 |
|
18 |
diff --git a/lib/portage/gpkg.py b/lib/portage/gpkg.py |
19 |
index fc111e44a..0622feb70 100644 |
20 |
--- a/lib/portage/gpkg.py |
21 |
+++ b/lib/portage/gpkg.py |
22 |
@@ -1847,11 +1847,12 @@ class gpkg: |
23 |
image_total_size, |
24 |
) |
25 |
|
26 |
- def _check_pre_quickpkg_files(self, contents, root): |
27 |
+ def _check_pre_quickpkg_files(self, contents, root, image_prefix="image"): |
28 |
""" |
29 |
Check the pre quickpkg files size and path, return the longest |
30 |
path length, largest single file size, and total files size. |
31 |
""" |
32 |
+ image_prefix_length = len(image_prefix) + 1 |
33 |
root_dir = os.path.join( |
34 |
normalize_path( |
35 |
_unicode_decode(root, encoding=_encodings["fs"], errors="strict") |
36 |
@@ -1881,6 +1882,7 @@ class gpkg: |
37 |
prefix_length = ( |
38 |
len(_unicode_encode(d, encoding=_encodings["fs"], errors="strict")) |
39 |
- root_dir_length |
40 |
+ + image_prefix_length |
41 |
) |
42 |
image_max_prefix_length = max(image_max_prefix_length, prefix_length) |
43 |
|
44 |
@@ -1892,6 +1894,7 @@ class gpkg: |
45 |
path_length = ( |
46 |
len(_unicode_encode(path, encoding=_encodings["fs"], errors="strict")) |
47 |
- root_dir_length |
48 |
+ + image_prefix_length |
49 |
) |
50 |
|
51 |
file_stat = os.lstat(path) |