Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: pym/_emerge/
Date: Sat, 29 Oct 2011 06:57:46
Message-Id: f43280c4d8d35f02c322e88c2d97e368303d5c1a.zmedico@gentoo
1 commit: f43280c4d8d35f02c322e88c2d97e368303d5c1a
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Sat Oct 29 06:57:29 2011 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Sat Oct 29 06:57:29 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=f43280c4
7
8 git_sync_timestamps: fix breakage
9
10 This has been broken since metadbmodule support was removed in commit
11 d4ea29bf6a3ce35d49e0f54f9173e3a6e42da2d6.
12
13 ---
14 pym/_emerge/actions.py | 27 ++++++++++++++++++---------
15 1 files changed, 18 insertions(+), 9 deletions(-)
16
17 diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
18 index d482e0b..de5275d 100644
19 --- a/pym/_emerge/actions.py
20 +++ b/pym/_emerge/actions.py
21 @@ -2011,7 +2011,7 @@ def action_sync(settings, trees, mtimedb, myopts, myaction):
22 msg = ">>> Git pull in %s successful" % myportdir
23 emergelog(xterm_titles, msg)
24 writemsg_level(msg + "\n")
25 - exitcode = git_sync_timestamps(settings, myportdir)
26 + exitcode = git_sync_timestamps(portdb, myportdir)
27 if exitcode == os.EX_OK:
28 updatecache_flg = True
29 elif syncuri[:8]=="rsync://" or syncuri[:6]=="ssh://":
30 @@ -2844,27 +2844,36 @@ def getportageversion(portdir, _unused, profile, chost, vardb):
31 return "Portage %s (%s, %s, %s, %s)" % \
32 (portage.VERSION, profilever, gccver, ",".join(libcver), unameout)
33
34 -def git_sync_timestamps(settings, portdir):
35 +def git_sync_timestamps(portdb, portdir):
36 """
37 Since git doesn't preserve timestamps, synchronize timestamps between
38 entries and ebuilds/eclasses. Assume the cache has the correct timestamp
39 for a given file as long as the file in the working tree is not modified
40 (relative to HEAD).
41 """
42 - cache_dir = os.path.join(portdir, "metadata", "cache")
43 - if not os.path.isdir(cache_dir):
44 - return os.EX_OK
45 - writemsg_level(">>> Synchronizing timestamps...\n")
46
47 - from portage.cache.cache_errors import CacheError
48 + cache_db = portdb._pregen_auxdb.get(portdir)
49 +
50 try:
51 - cache_db = settings.load_best_module("portdbapi.metadbmodule")(
52 - portdir, "metadata/cache", portage.auxdbkeys[:], readonly=True)
53 + if cache_db is None:
54 + # portdbapi does not populate _pregen_auxdb
55 + # when FEATURES=metadata-transfer is enabled
56 + cache_db = portdb._create_pregen_cache(portdir)
57 except CacheError as e:
58 writemsg_level("!!! Unable to instantiate cache: %s\n" % (e,),
59 level=logging.ERROR, noiselevel=-1)
60 return 1
61
62 + if cache_db is None:
63 + return os.EX_OK
64 +
65 + from portage.cache.metadata import database as pms_database
66 + if not isinstance(cache_db, pms_database):
67 + # newer formats like md5-dict do not require mtime sync
68 + return os.EX_OK
69 +
70 + writemsg_level(">>> Synchronizing timestamps...\n")
71 +
72 ec_dir = os.path.join(portdir, "eclass")
73 try:
74 ec_names = set(f[:-7] for f in os.listdir(ec_dir) \