commit:     09d783eb12ed1f93550d86f1ee2437012ffc7cc2
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed May 12 16:10:10 2021 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon May 24 04:40:21 2021 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=09d783eb

Relax update filenames as permitted for EAPI 8

Bug: https://bugs.gentoo.org/692774
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 lib/portage/update.py | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/lib/portage/update.py b/lib/portage/update.py
index f11b14217..67d3c08b0 100644
--- a/lib/portage/update.py
+++ b/lib/portage/update.py
@@ -1,4 +1,4 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 import errno
@@ -175,21 +175,16 @@ def grab_updates(updpath, prev_mtimes=None):
                raise
        if prev_mtimes is None:
                prev_mtimes = {}
-       # validate the file name (filter out CVS directory, etc...)
-       mylist = [myfile for myfile in mylist if len(myfile) == 7 and 
myfile[1:3] == "Q-"]
-       if len(mylist) == 0:
-               return []
-
-       # sort by (year, quarter)
-       mylist.sort(key=lambda x: (x[3:], x[:2]))
 
        update_data = []
        for myfile in mylist:
+               if myfile.startswith("."):
+                       continue
                file_path = os.path.join(updpath, myfile)
                mystat = os.stat(file_path)
-               if update_data or \
-                       file_path not in prev_mtimes or \
-                       int(prev_mtimes[file_path]) != mystat[stat.ST_MTIME]:
+               if not stat.S_ISREG(mystat.st_mode):
+                       continue
+               if int(prev_mtimes.get(file_path, -1)) != mystat[stat.ST_MTIME]:
                        f = io.open(_unicode_encode(file_path,
                                encoding=_encodings['fs'], errors='strict'),
                                mode='r', encoding=_encodings['repo.content'], 
errors='replace')

Reply via email to