From d055cc9b6e46f37193841ef89843493e0d61ee7b Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 25 Jan 2011 12:40:54 -0800 Subject: [PATCH] grab_updates: return all after first modified This ensures that all relevant updates are returned for cases in which the destination package of an earlier move corresponds to the source package of a move that comes somewhere later in the entire sequence of files. --- pym/portage/update.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/pym/portage/update.py b/pym/portage/update.py index 37cab2503..bac09c2ac 100644 --- a/pym/portage/update.py +++ b/pym/portage/update.py @@ -99,7 +99,14 @@ def fixdbentries(update_iter, dbdir): def grab_updates(updpath, prev_mtimes=None): """Returns all the updates from the given directory as a sorted list of tuples, each containing (file_path, statobj, content). If prev_mtimes is - given then only updates with differing mtimes are considered.""" + given then updates are only returned if one or more files have different + mtimes. When a change is detected for a given file, updates will be + returned for that file and any files that come after it in the entire + sequence. This ensures that all relevant updates are returned for cases + in which the destination package of an earlier move corresponds to + the source package of a move that comes somewhere later in the entire + sequence of files. + """ try: mylist = os.listdir(updpath) except OSError as oe: @@ -122,8 +129,9 @@ def grab_updates(updpath, prev_mtimes=None): for myfile in mylist: file_path = os.path.join(updpath, myfile) mystat = os.stat(file_path) - if file_path not in prev_mtimes or \ - long(prev_mtimes[file_path]) != mystat[stat.ST_MTIME]: + if update_data or \ + file_path not in prev_mtimes or \ + long(prev_mtimes[file_path]) != mystat[stat.ST_MTIME]: content = codecs.open(_unicode_encode(file_path, encoding=_encodings['fs'], errors='strict'), mode='r', encoding=_encodings['repo.content'], errors='replace' -- 2.26.2