[PATCH v2] fetch: Make FlatLayout.get_filenames() not return directories

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH v2] fetch: Make FlatLayout.get_filenames() not return directories

Michał Górny-5
Stop returning directories from FlatLayout.get_filenames().  This causes
emirrordist to wrongly presume directories created by new layout
to be distfiles, and causes some noisy errors.

Signed-off-by: Michał Górny <[hidden email]>
---
 lib/portage/package/ebuild/fetch.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/portage/package/ebuild/fetch.py b/lib/portage/package/ebuild/fetch.py
index 5d0bc7355..cd204b755 100644
--- a/lib/portage/package/ebuild/fetch.py
+++ b/lib/portage/package/ebuild/fetch.py
@@ -35,6 +35,7 @@ portage.proxy.lazyimport.lazyimport(globals(),
  'portage.util:atomic_ofstream',
  'portage.util.configparser:SafeConfigParser,read_configs,' +
  'ConfigParserError',
+ 'portage.util.install_mask:_raise_exc',
  'portage.util._urlopen:urlopen',
 )
 
@@ -269,7 +270,9 @@ class FlatLayout(object):
  return filename
 
  def get_filenames(self, distdir):
- return iter(os.listdir(distdir))
+ for dirpath, dirnames, filenames in os.walk(distdir,
+ onerror=_raise_exc):
+ return iter(filenames)
 
  @staticmethod
  def verify_args(args):
--
2.23.0


Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v2] fetch: Make FlatLayout.get_filenames() not return directories

Zac Medico-2
On 10/13/19 12:46 PM, Michał Górny wrote:

> Stop returning directories from FlatLayout.get_filenames().  This causes
> emirrordist to wrongly presume directories created by new layout
> to be distfiles, and causes some noisy errors.
>
> Signed-off-by: Michał Górny <[hidden email]>
> ---
>  lib/portage/package/ebuild/fetch.py | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/lib/portage/package/ebuild/fetch.py b/lib/portage/package/ebuild/fetch.py
> index 5d0bc7355..cd204b755 100644
> --- a/lib/portage/package/ebuild/fetch.py
> +++ b/lib/portage/package/ebuild/fetch.py
> @@ -35,6 +35,7 @@ portage.proxy.lazyimport.lazyimport(globals(),
>   'portage.util:atomic_ofstream',
>   'portage.util.configparser:SafeConfigParser,read_configs,' +
>   'ConfigParserError',
> + 'portage.util.install_mask:_raise_exc',
>   'portage.util._urlopen:urlopen',
>  )
>  
> @@ -269,7 +270,9 @@ class FlatLayout(object):
>   return filename
>  
>   def get_filenames(self, distdir):
> - return iter(os.listdir(distdir))
> + for dirpath, dirnames, filenames in os.walk(distdir,
> + onerror=_raise_exc):
> + return iter(filenames)
>  
>   @staticmethod
>   def verify_args(args):
>
Looks good. Please merge.
--
Thanks,
Zac


signature.asc (1000 bytes) Download Attachment