summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-10-28 23:57:29 -0700
committerZac Medico <zmedico@gentoo.org>2011-10-28 23:57:29 -0700
commitf43280c4d8d35f02c322e88c2d97e368303d5c1a (patch)
treecb1352b724f2880ee96ba38751ea1b303d756052 /pym
parent486b6ebd44bec7b12f6c4ab36c85b5c270fc3883 (diff)
downloadportage-f43280c4d8d35f02c322e88c2d97e368303d5c1a.tar.gz
portage-f43280c4d8d35f02c322e88c2d97e368303d5c1a.tar.bz2
portage-f43280c4d8d35f02c322e88c2d97e368303d5c1a.zip
git_sync_timestamps: fix breakage
This has been broken since metadbmodule support was removed in commit d4ea29bf6a3ce35d49e0f54f9173e3a6e42da2d6.
Diffstat (limited to 'pym')
-rw-r--r--pym/_emerge/actions.py27
1 files changed, 18 insertions, 9 deletions
diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
index d482e0ba1..de5275d2b 100644
--- a/pym/_emerge/actions.py
+++ b/pym/_emerge/actions.py
@@ -2011,7 +2011,7 @@ def action_sync(settings, trees, mtimedb, myopts, myaction):
msg = ">>> Git pull in %s successful" % myportdir
emergelog(xterm_titles, msg)
writemsg_level(msg + "\n")
- exitcode = git_sync_timestamps(settings, myportdir)
+ exitcode = git_sync_timestamps(portdb, myportdir)
if exitcode == os.EX_OK:
updatecache_flg = True
elif syncuri[:8]=="rsync://" or syncuri[:6]=="ssh://":
@@ -2844,27 +2844,36 @@ def getportageversion(portdir, _unused, profile, chost, vardb):
return "Portage %s (%s, %s, %s, %s)" % \
(portage.VERSION, profilever, gccver, ",".join(libcver), unameout)
-def git_sync_timestamps(settings, portdir):
+def git_sync_timestamps(portdb, portdir):
"""
Since git doesn't preserve timestamps, synchronize timestamps between
entries and ebuilds/eclasses. Assume the cache has the correct timestamp
for a given file as long as the file in the working tree is not modified
(relative to HEAD).
"""
- cache_dir = os.path.join(portdir, "metadata", "cache")
- if not os.path.isdir(cache_dir):
- return os.EX_OK
- writemsg_level(">>> Synchronizing timestamps...\n")
- from portage.cache.cache_errors import CacheError
+ cache_db = portdb._pregen_auxdb.get(portdir)
+
try:
- cache_db = settings.load_best_module("portdbapi.metadbmodule")(
- portdir, "metadata/cache", portage.auxdbkeys[:], readonly=True)
+ if cache_db is None:
+ # portdbapi does not populate _pregen_auxdb
+ # when FEATURES=metadata-transfer is enabled
+ cache_db = portdb._create_pregen_cache(portdir)
except CacheError as e:
writemsg_level("!!! Unable to instantiate cache: %s\n" % (e,),
level=logging.ERROR, noiselevel=-1)
return 1
+ if cache_db is None:
+ return os.EX_OK
+
+ from portage.cache.metadata import database as pms_database
+ if not isinstance(cache_db, pms_database):
+ # newer formats like md5-dict do not require mtime sync
+ return os.EX_OK
+
+ writemsg_level(">>> Synchronizing timestamps...\n")
+
ec_dir = os.path.join(portdir, "eclass")
try:
ec_names = set(f[:-7] for f in os.listdir(ec_dir) \