Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o, "Michał Górny" <mgorny@g.o>
Subject: Re: [gentoo-portage-dev] [PATCH] fetch: Make FlatLayout.get_filenames() not return directories
Date: Sun, 13 Oct 2019 19:32:27
Message-Id: 565ef6fd-bd96-0150-47bb-43b63de71394@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH] fetch: Make FlatLayout.get_filenames() not return directories by "Michał Górny"
1 On 10/13/19 4:57 AM, Michał Górny wrote:
2 > Stop returning directories from FlatLayout.get_filenames(). This causes
3 > emirrordist to wrongly presume directories created by new layout
4 > to be distfiles, and causes some noisy errors.
5 >
6 > Signed-off-by: Michał Górny <mgorny@g.o>
7 > ---
8 > lib/portage/package/ebuild/fetch.py | 3 ++-
9 > 1 file changed, 2 insertions(+), 1 deletion(-)
10 >
11 > diff --git a/lib/portage/package/ebuild/fetch.py b/lib/portage/package/ebuild/fetch.py
12 > index 5d0bc7355..793402137 100644
13 > --- a/lib/portage/package/ebuild/fetch.py
14 > +++ b/lib/portage/package/ebuild/fetch.py
15 > @@ -269,7 +269,8 @@ class FlatLayout(object):
16 > return filename
17 >
18 > def get_filenames(self, distdir):
19 > - return iter(os.listdir(distdir))
20 > + for dirpath, dirnames, filenames in os.walk(distdir):
21 > + return iter(filenames)
22
23 Since os.walk will silently fail if distdir suddenly disappears somehow,
24 we should use the onerror parameter to force it to raise an exception in
25 this (albeit unlikely) case. The portage.util.install_mask._raise_exc
26 function works perfectly well for this kind of onerror handler.
27
28 Otherwise, looks good.
29 --
30 Thanks,
31 Zac

Attachments

File name MIME type
signature.asc application/pgp-signature