Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Cc: Zac Medico <zmedico@g.o>
Subject: [gentoo-portage-dev] [PATCH] Manifest._apply_max_mtime: include all dirs (bug 567920)
Date: Thu, 17 Dec 2015 17:50:24
Message-Id: 1450374593-5266-1-git-send-email-zmedico@gentoo.org
1 Commit 3c2cce57700e8a2be4774d653cd632d9e59aab78 only included direct
2 parent directories of files listed in the manifest. In order to account
3 for changes to directories that only contain directories, include all
4 directories in the max mtime calculation for thick manifests.
5
6 Fixes: 3c2cce57700e ("Manifest._apply_max_mtime: account for removals and renames (bug 567920)")
7 X-Gentoo-Bug: 567920
8 X-Gentoo-Bug-url: https://bugs.gentoo.org/show_bug.cgi?id=567920
9 ---
10 pym/portage/manifest.py | 20 +++++++++++++++-----
11 1 file changed, 15 insertions(+), 5 deletions(-)
12
13 diff --git a/pym/portage/manifest.py b/pym/portage/manifest.py
14 index 3a6bc7e..f696f84 100644
15 --- a/pym/portage/manifest.py
16 +++ b/pym/portage/manifest.py
17 @@ -362,7 +362,6 @@ class Manifest(object):
18 for stat_result in preserved_stats.values():
19 max_mtime = _update_max(stat_result)
20
21 - dirs = set()
22 for entry in entries:
23 if entry.type == 'DIST':
24 continue
25 @@ -370,10 +369,21 @@ class Manifest(object):
26 entry.type == 'AUX' else os.path.join(self.pkgdir, entry.name))
27 max_mtime = _update_max(_stat(abs_path))
28
29 - parent_dir = os.path.dirname(abs_path)
30 - if parent_dir not in dirs:
31 - dirs.add(parent_dir)
32 - max_mtime = _update_max(_stat(parent_dir))
33 + if not self.thin:
34 + # Account for changes to all relevant nested directories.
35 + # This is not necessary for thin manifests because
36 + # self.pkgdir is already included via preserved_stats.
37 + for parent_dir, dirs, files in os.walk(self.pkgdir.rstrip(os.sep)):
38 + try:
39 + parent_dir = _unicode_decode(parent_dir,
40 + encoding=_encodings['fs'], errors='strict')
41 + except UnicodeDecodeError:
42 + # If an absolute path cannot be decoded, then it is
43 + # always excluded from the manifest (repoman will
44 + # report such problems).
45 + pass
46 + else:
47 + max_mtime = _update_max(_stat(parent_dir))
48
49 if max_mtime is not None:
50 for path in preserved_stats:
51 --
52 2.4.10

Replies