summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSheng Yu <syu.os@protonmail.com>2022-09-15 11:52:31 -0400
committerSam James <sam@gentoo.org>2022-09-20 04:39:23 +0100
commit355b6598225e3ffa921d2fb6646539bcbcc694a7 (patch)
tree913d5aae072c221926d883a45ec134fdb2276943 /lib
parentgpkg-sign: add gpg configuration check (diff)
downloadportage-355b6598225e3ffa921d2fb6646539bcbcc694a7.tar.gz
portage-355b6598225e3ffa921d2fb6646539bcbcc694a7.tar.bz2
portage-355b6598225e3ffa921d2fb6646539bcbcc694a7.zip
GPKG quickpkg allow missing files
Bug: https://bugs.gentoo.org/870229 Signed-off-by: Sheng Yu <syu.os@protonmail.com> Closes: https://github.com/gentoo/portage/pull/900 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/portage/gpkg.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/portage/gpkg.py b/lib/portage/gpkg.py
index 5f8e19341..c0a80208f 100644
--- a/lib/portage/gpkg.py
+++ b/lib/portage/gpkg.py
@@ -33,7 +33,7 @@ from portage.exception import (
MissingSignature,
InvalidSignature,
)
-from portage.output import colorize
+from portage.output import colorize, EOutput
from portage.util._urlopen import urlopen
from portage.util import writemsg
from portage.util import shlex_split, varexpand
@@ -1271,6 +1271,7 @@ class gpkg:
Will compress the given files to image with root,
ignoring all other files.
"""
+ eout = EOutput()
protect_file = io.BytesIO(
b"# empty file because --include-config=n when `quickpkg` was used\n"
@@ -1284,7 +1285,7 @@ class gpkg:
# Get pre image info
container_tar_format, image_tar_format = self._get_tar_format_from_stats(
- *self._check_pre_quickpkg_files(contents, root_dir)
+ *self._check_pre_quickpkg_files(contents, root_dir, ignore_missing=True)
)
# Long CPV
@@ -1341,6 +1342,7 @@ class gpkg:
except OSError as e:
if e.errno != errno.ENOENT:
raise
+ eout.ewarn(f'Missing file from local system: "{path}"')
del e
continue
contents_type = contents[path][0]
@@ -1984,7 +1986,9 @@ class gpkg:
image_total_size,
)
- def _check_pre_quickpkg_files(self, contents, root, image_prefix="image"):
+ def _check_pre_quickpkg_files(
+ self, contents, root, image_prefix="image", ignore_missing=False
+ ):
"""
Check the pre quickpkg files size and path, return the longest
path length, largest single file size, and total files size.
@@ -2034,6 +2038,12 @@ class gpkg:
+ image_prefix_length
)
+ if not os.path.exists(path):
+ if ignore_missing:
+ continue
+ else:
+ raise FileNotFound(path)
+
file_stat = os.lstat(path)
if os.path.islink(path):