From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 0AE4F1389E2 for ; Thu, 4 Dec 2014 20:04:42 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 9A903E08E2; Thu, 4 Dec 2014 20:04:37 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 783BDE08E1 for ; Thu, 4 Dec 2014 20:04:36 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 85F80340590 for ; Thu, 4 Dec 2014 20:04:35 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 7191DB942 for ; Thu, 4 Dec 2014 20:04:31 +0000 (UTC) From: "Brian Dolbec" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" Message-ID: <1417722995.932fa3f8295dcfb0bdbf3762161940d44d19d395.dol-sen@gentoo> Subject: [gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/git/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/sync/modules/git/git.py pym/portage/sync/modules/git/timestamps.py X-VCS-Directories: pym/portage/sync/modules/git/ X-VCS-Committer: dol-sen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: 932fa3f8295dcfb0bdbf3762161940d44d19d395 X-VCS-Branch: plugin-sync Date: Thu, 4 Dec 2014 20:04:31 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 9ab14bd2-efe2-4618-82d6-a17f1e713143 X-Archives-Hash: 849c813ea9dae3cbcd419927f5b59d22 commit: 932fa3f8295dcfb0bdbf3762161940d44d19d395 Author: Zac Medico gentoo org> AuthorDate: Tue Oct 21 01:13:45 2014 +0000 Commit: Brian Dolbec gmail com> CommitDate: Thu Dec 4 19:56:35 2014 +0000 URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=932fa3f8 Remove obsolete git_sync_timestamps function. This function is no longer needed since we switched to the md5-cache format which does not use timestamps. --- pym/portage/sync/modules/git/git.py | 8 +- pym/portage/sync/modules/git/timestamps.py | 154 ----------------------------- 2 files changed, 1 insertion(+), 161 deletions(-) diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py index 5e0e5df..d8c5a32 100644 --- a/pym/portage/sync/modules/git/git.py +++ b/pym/portage/sync/modules/git/git.py @@ -10,7 +10,6 @@ from portage.output import create_color_func good = create_color_func("GOOD") bad = create_color_func("BAD") warn = create_color_func("WARN") -from .timestamps import git_sync_timestamps from portage.sync.syncbase import SyncBase @@ -116,9 +115,4 @@ class GitSync(SyncBase): # Reload the whole config from scratch. settings, trees, mtimedb = load_emerge_config(emerge_config=emerge_config) adjust_configs(emerge_config.opts, emerge_config.trees) - portdb = trees[settings['EROOT']]['porttree'].dbapi - updatecache_flg = False - exitcode = git_sync_timestamps(portdb, location) - if exitcode == os.EX_OK: - updatecache_flg = True - return (exitcode, updatecache_flg) + return (os.EX_OK, True) diff --git a/pym/portage/sync/modules/git/timestamps.py b/pym/portage/sync/modules/git/timestamps.py deleted file mode 100644 index 5e44845..0000000 --- a/pym/portage/sync/modules/git/timestamps.py +++ /dev/null @@ -1,154 +0,0 @@ -# Copyright 1999-2014 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -import logging -import stat -import subprocess - - -import portage -from portage import os -from portage import _unicode_decode -from portage.util import writemsg_level -from portage.cache.cache_errors import CacheError - - -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_db = portdb._pregen_auxdb.get(portdir) - - try: - 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 - - if cache_db.validation_chf != 'mtime': - # 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) \ - if f.endswith(".eclass")) - except OSError as e: - writemsg_level("!!! Unable to list eclasses: %s\n" % (e,), - level=logging.ERROR, noiselevel=-1) - return 1 - - args = [portage.const.BASH_BINARY, "-c", - "cd %s && git diff-index --name-only --diff-filter=M HEAD" % \ - portage._shell_quote(portdir)] - proc = subprocess.Popen(args, stdout=subprocess.PIPE) - modified_files = set(_unicode_decode(l).rstrip("\n") for l in proc.stdout) - rval = proc.wait() - proc.stdout.close() - if rval != os.EX_OK: - return rval - - modified_eclasses = set(ec for ec in ec_names \ - if os.path.join("eclass", ec + ".eclass") in modified_files) - - updated_ec_mtimes = {} - - for cpv in cache_db: - cpv_split = portage.catpkgsplit(cpv) - if cpv_split is None: - writemsg_level("!!! Invalid cache entry: %s\n" % (cpv,), - level=logging.ERROR, noiselevel=-1) - continue - - cat, pn, ver, rev = cpv_split - cat, pf = portage.catsplit(cpv) - relative_eb_path = os.path.join(cat, pn, pf + ".ebuild") - if relative_eb_path in modified_files: - continue - - try: - cache_entry = cache_db[cpv] - eb_mtime = cache_entry.get("_mtime_") - ec_mtimes = cache_entry.get("_eclasses_") - except KeyError: - writemsg_level("!!! Missing cache entry: %s\n" % (cpv,), - level=logging.ERROR, noiselevel=-1) - continue - except CacheError as e: - writemsg_level("!!! Unable to access cache entry: %s %s\n" % \ - (cpv, e), level=logging.ERROR, noiselevel=-1) - continue - - if eb_mtime is None: - writemsg_level("!!! Missing ebuild mtime: %s\n" % (cpv,), - level=logging.ERROR, noiselevel=-1) - continue - - try: - eb_mtime = long(eb_mtime) - except ValueError: - writemsg_level("!!! Invalid ebuild mtime: %s %s\n" % \ - (cpv, eb_mtime), level=logging.ERROR, noiselevel=-1) - continue - - if ec_mtimes is None: - writemsg_level("!!! Missing eclass mtimes: %s\n" % (cpv,), - level=logging.ERROR, noiselevel=-1) - continue - - if modified_eclasses.intersection(ec_mtimes): - continue - - missing_eclasses = set(ec_mtimes).difference(ec_names) - if missing_eclasses: - writemsg_level("!!! Non-existent eclass(es): %s %s\n" % \ - (cpv, sorted(missing_eclasses)), level=logging.ERROR, - noiselevel=-1) - continue - - eb_path = os.path.join(portdir, relative_eb_path) - try: - current_eb_mtime = os.stat(eb_path) - except OSError: - writemsg_level("!!! Missing ebuild: %s\n" % \ - (cpv,), level=logging.ERROR, noiselevel=-1) - continue - - inconsistent = False - for ec, (ec_path, ec_mtime) in ec_mtimes.items(): - updated_mtime = updated_ec_mtimes.get(ec) - if updated_mtime is not None and updated_mtime != ec_mtime: - writemsg_level("!!! Inconsistent eclass mtime: %s %s\n" % \ - (cpv, ec), level=logging.ERROR, noiselevel=-1) - inconsistent = True - break - - if inconsistent: - continue - - if current_eb_mtime != eb_mtime: - os.utime(eb_path, (eb_mtime, eb_mtime)) - - for ec, (ec_path, ec_mtime) in ec_mtimes.items(): - if ec in updated_ec_mtimes: - continue - ec_path = os.path.join(ec_dir, ec + ".eclass") - current_mtime = os.stat(ec_path)[stat.ST_MTIME] - if current_mtime != ec_mtime: - os.utime(ec_path, (ec_mtime, ec_mtime)) - updated_ec_mtimes[ec] = ec_mtime - - return os.EX_OK From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 1A0F01389E2 for ; Thu, 4 Dec 2014 20:16:21 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 78D9AE0912; Thu, 4 Dec 2014 20:16:16 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id C9C3AE0912 for ; Thu, 4 Dec 2014 20:16:14 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 924823405A5 for ; Thu, 4 Dec 2014 20:16:13 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id CE627B945 for ; Thu, 4 Dec 2014 20:16:10 +0000 (UTC) From: "Brian Dolbec" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" Message-ID: <1417722995.932fa3f8295dcfb0bdbf3762161940d44d19d395.dol-sen@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/sync/modules/git/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/sync/modules/git/git.py pym/portage/sync/modules/git/timestamps.py X-VCS-Directories: pym/portage/sync/modules/git/ X-VCS-Committer: dol-sen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: 932fa3f8295dcfb0bdbf3762161940d44d19d395 X-VCS-Branch: master Date: Thu, 4 Dec 2014 20:16:10 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 671ff6c7-cb3c-477e-aca4-dc51e413e599 X-Archives-Hash: c8708b8270afd40a011bd5b4f3cba1ef Message-ID: <20141204201610.xut-6ecF7TezPgpfG0FT60Oz7m5vyDdrO9Mjli1hSLA@z> commit: 932fa3f8295dcfb0bdbf3762161940d44d19d395 Author: Zac Medico gentoo org> AuthorDate: Tue Oct 21 01:13:45 2014 +0000 Commit: Brian Dolbec gmail com> CommitDate: Thu Dec 4 19:56:35 2014 +0000 URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=932fa3f8 Remove obsolete git_sync_timestamps function. This function is no longer needed since we switched to the md5-cache format which does not use timestamps. --- pym/portage/sync/modules/git/git.py | 8 +- pym/portage/sync/modules/git/timestamps.py | 154 ----------------------------- 2 files changed, 1 insertion(+), 161 deletions(-) diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py index 5e0e5df..d8c5a32 100644 --- a/pym/portage/sync/modules/git/git.py +++ b/pym/portage/sync/modules/git/git.py @@ -10,7 +10,6 @@ from portage.output import create_color_func good = create_color_func("GOOD") bad = create_color_func("BAD") warn = create_color_func("WARN") -from .timestamps import git_sync_timestamps from portage.sync.syncbase import SyncBase @@ -116,9 +115,4 @@ class GitSync(SyncBase): # Reload the whole config from scratch. settings, trees, mtimedb = load_emerge_config(emerge_config=emerge_config) adjust_configs(emerge_config.opts, emerge_config.trees) - portdb = trees[settings['EROOT']]['porttree'].dbapi - updatecache_flg = False - exitcode = git_sync_timestamps(portdb, location) - if exitcode == os.EX_OK: - updatecache_flg = True - return (exitcode, updatecache_flg) + return (os.EX_OK, True) diff --git a/pym/portage/sync/modules/git/timestamps.py b/pym/portage/sync/modules/git/timestamps.py deleted file mode 100644 index 5e44845..0000000 --- a/pym/portage/sync/modules/git/timestamps.py +++ /dev/null @@ -1,154 +0,0 @@ -# Copyright 1999-2014 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -import logging -import stat -import subprocess - - -import portage -from portage import os -from portage import _unicode_decode -from portage.util import writemsg_level -from portage.cache.cache_errors import CacheError - - -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_db = portdb._pregen_auxdb.get(portdir) - - try: - 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 - - if cache_db.validation_chf != 'mtime': - # 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) \ - if f.endswith(".eclass")) - except OSError as e: - writemsg_level("!!! Unable to list eclasses: %s\n" % (e,), - level=logging.ERROR, noiselevel=-1) - return 1 - - args = [portage.const.BASH_BINARY, "-c", - "cd %s && git diff-index --name-only --diff-filter=M HEAD" % \ - portage._shell_quote(portdir)] - proc = subprocess.Popen(args, stdout=subprocess.PIPE) - modified_files = set(_unicode_decode(l).rstrip("\n") for l in proc.stdout) - rval = proc.wait() - proc.stdout.close() - if rval != os.EX_OK: - return rval - - modified_eclasses = set(ec for ec in ec_names \ - if os.path.join("eclass", ec + ".eclass") in modified_files) - - updated_ec_mtimes = {} - - for cpv in cache_db: - cpv_split = portage.catpkgsplit(cpv) - if cpv_split is None: - writemsg_level("!!! Invalid cache entry: %s\n" % (cpv,), - level=logging.ERROR, noiselevel=-1) - continue - - cat, pn, ver, rev = cpv_split - cat, pf = portage.catsplit(cpv) - relative_eb_path = os.path.join(cat, pn, pf + ".ebuild") - if relative_eb_path in modified_files: - continue - - try: - cache_entry = cache_db[cpv] - eb_mtime = cache_entry.get("_mtime_") - ec_mtimes = cache_entry.get("_eclasses_") - except KeyError: - writemsg_level("!!! Missing cache entry: %s\n" % (cpv,), - level=logging.ERROR, noiselevel=-1) - continue - except CacheError as e: - writemsg_level("!!! Unable to access cache entry: %s %s\n" % \ - (cpv, e), level=logging.ERROR, noiselevel=-1) - continue - - if eb_mtime is None: - writemsg_level("!!! Missing ebuild mtime: %s\n" % (cpv,), - level=logging.ERROR, noiselevel=-1) - continue - - try: - eb_mtime = long(eb_mtime) - except ValueError: - writemsg_level("!!! Invalid ebuild mtime: %s %s\n" % \ - (cpv, eb_mtime), level=logging.ERROR, noiselevel=-1) - continue - - if ec_mtimes is None: - writemsg_level("!!! Missing eclass mtimes: %s\n" % (cpv,), - level=logging.ERROR, noiselevel=-1) - continue - - if modified_eclasses.intersection(ec_mtimes): - continue - - missing_eclasses = set(ec_mtimes).difference(ec_names) - if missing_eclasses: - writemsg_level("!!! Non-existent eclass(es): %s %s\n" % \ - (cpv, sorted(missing_eclasses)), level=logging.ERROR, - noiselevel=-1) - continue - - eb_path = os.path.join(portdir, relative_eb_path) - try: - current_eb_mtime = os.stat(eb_path) - except OSError: - writemsg_level("!!! Missing ebuild: %s\n" % \ - (cpv,), level=logging.ERROR, noiselevel=-1) - continue - - inconsistent = False - for ec, (ec_path, ec_mtime) in ec_mtimes.items(): - updated_mtime = updated_ec_mtimes.get(ec) - if updated_mtime is not None and updated_mtime != ec_mtime: - writemsg_level("!!! Inconsistent eclass mtime: %s %s\n" % \ - (cpv, ec), level=logging.ERROR, noiselevel=-1) - inconsistent = True - break - - if inconsistent: - continue - - if current_eb_mtime != eb_mtime: - os.utime(eb_path, (eb_mtime, eb_mtime)) - - for ec, (ec_path, ec_mtime) in ec_mtimes.items(): - if ec in updated_ec_mtimes: - continue - ec_path = os.path.join(ec_dir, ec + ".eclass") - current_mtime = os.stat(ec_path)[stat.ST_MTIME] - if current_mtime != ec_mtime: - os.utime(ec_path, (ec_mtime, ec_mtime)) - updated_ec_mtimes[ec] = ec_mtime - - return os.EX_OK