summaryrefslogtreecommitdiffstats
path: root/pym/portage/update.py
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-01-25 12:40:54 -0800
committerZac Medico <zmedico@gentoo.org>2011-01-25 12:40:54 -0800
commitd055cc9b6e46f37193841ef89843493e0d61ee7b (patch)
tree33f4f1d468eb753427475611857f8f5472aecfa8 /pym/portage/update.py
parent5119dea05eb07e7e981c9a9e776d4ddfadcf6330 (diff)
downloadportage-d055cc9b6e46f37193841ef89843493e0d61ee7b.tar.gz
portage-d055cc9b6e46f37193841ef89843493e0d61ee7b.tar.bz2
portage-d055cc9b6e46f37193841ef89843493e0d61ee7b.zip
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.
Diffstat (limited to 'pym/portage/update.py')
-rw-r--r--pym/portage/update.py14
1 files 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'