commit: b4bb946e65660db34be7ce67f4e1ed00df47fd53
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 20 09:53:30 2019 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Oct 21 07:39:38 2019 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=b4bb946e
emirrordist: Report all stat() errors instead of first one
When DeletionIterator fails, report all stat() errors. Reporting
just the first one results in confusing logs, suggesting that one
of the location did not exist but the other existed and was removed.
Reviewed-by: Zac Medico <zmedico <AT> gentoo.org>
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
lib/portage/_emirrordist/DeletionIterator.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/portage/_emirrordist/DeletionIterator.py
b/lib/portage/_emirrordist/DeletionIterator.py
index cd773b3c8..dab6eaea2 100644
--- a/lib/portage/_emirrordist/DeletionIterator.py
+++ b/lib/portage/_emirrordist/DeletionIterator.py
@@ -25,20 +25,20 @@ class DeletionIterator(object):
distfiles_set.update(layout.get_filenames(distdir))
for filename in distfiles_set:
# require at least one successful stat()
- first_exception = None
+ exceptions = []
for layout in reversed(self._config.layouts):
try:
st = os.stat(
os.path.join(distdir,
layout.get_path(filename)))
except OSError as e:
- first_exception = e
+ exceptions.append(e)
else:
if stat.S_ISREG(st.st_mode):
break
else:
- if first_exception is not None:
+ if exceptions:
logging.error("stat failed on '%s' in
distfiles: %s\n" %
- (filename, first_exception))
+ (filename, '; '.join(str(x) for
x in exceptions)))
continue
if filename in file_owners: