From: Zac Medico Date: Sat, 29 Oct 2011 06:57:29 +0000 (-0700) Subject: git_sync_timestamps: fix breakage X-Git-Tag: v2.2.0_alpha72~22 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f43280c4d8d35f02c322e88c2d97e368303d5c1a;p=portage.git git_sync_timestamps: fix breakage This has been broken since metadbmodule support was removed in commit d4ea29bf6a3ce35d49e0f54f9173e3a6e42da2d6. --- 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) \