On 10/20/19 2:54 AM, Michał Górny wrote:
> 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.
> ---
>  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:
> 

Looks good. Please merge.
-- 
Thanks,
Zac

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to