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 26D09138010 for ; Sat, 8 Sep 2012 05:35:37 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5AC8221C006; Sat, 8 Sep 2012 05:35:25 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 10A6721C006 for ; Sat, 8 Sep 2012 05:35:24 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 50B1C33C2F0 for ; Sat, 8 Sep 2012 05:35:24 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id EBA54E543D for ; Sat, 8 Sep 2012 05:35:21 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1347082503.7da74976e44534bcb286bd9bcb7a7847ba4d6a14.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: bin/ X-VCS-Repository: proj/portage X-VCS-Files: bin/egencache X-VCS-Directories: bin/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 7da74976e44534bcb286bd9bcb7a7847ba4d6a14 X-VCS-Branch: master Date: Sat, 8 Sep 2012 05:35:21 +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: 7bec3be8-631d-46f4-9da0-ed09e0202b60 X-Archives-Hash: 0258a7a94980c378815d48236fe3bc95 commit: 7da74976e44534bcb286bd9bcb7a7847ba4d6a14 Author: Zac Medico gentoo org> AuthorDate: Sat Sep 8 05:35:03 2012 +0000 Commit: Zac Medico gentoo org> CommitDate: Sat Sep 8 05:35:03 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=7da74976 egencache: skip metadata-transfer if possible If there is an existing metadata/md5-cache directory, then it's not necessary to forcibly enable metadata-transfer. --- bin/egencache | 42 +++++++++++++++++++++++++++++------------- 1 files changed, 29 insertions(+), 13 deletions(-) diff --git a/bin/egencache b/bin/egencache index a0766b1..18ab45d 100755 --- a/bin/egencache +++ b/bin/egencache @@ -35,6 +35,7 @@ import portage from portage import os, _encodings, _unicode_encode, _unicode_decode from _emerge.MetadataRegen import MetadataRegen from portage.cache.cache_errors import CacheError, StatCollision +from portage.cache.flat_hash import md5_database from portage.manifest import guessManifestFileType from portage.util import cmp_sort_key, writemsg_level from portage import cpv_getkey @@ -867,13 +868,40 @@ def egencache_main(args): parser.error('No action specified') return 1 + repo_path = None + if options.repo is not None: + repo_path = settings.repositories.treemap.get(options.repo) + if repo_path is None: + parser.error("Unable to locate repository named '%s'" % \ + (options.repo,)) + return 1 + else: + repo_path = settings.repositories.mainRepoLocation() + if not repo_path: + parser.error("PORTDIR is undefined") + return 1 + if options.update and 'metadata-transfer' not in settings.features: - settings.features.add('metadata-transfer') + metadata_transfer = True + repo_config = settings.repositories.get_repo_for_location(repo_path) + cache = repo_config.get_pregenerated_cache( + portage.dbapi.dbapi._known_keys, readonly=True) + if cache is not None: + if isinstance(cache, md5_database) and \ + os.path.isdir(cache.location): + metadata_transfer = False + cache = None + + if metadata_transfer: + settings.features.add('metadata-transfer') settings.lock() portdb = portage.portdbapi(mysettings=settings) + # Limit ebuilds to the specified repo. + portdb.porttrees = [repo_path] + if options.update: if options.cache_dir is not None: # already validated earlier @@ -889,18 +917,6 @@ def egencache_main(args): level=logging.ERROR, noiselevel=-1) return 1 - if options.repo is not None: - repo_path = portdb.getRepositoryPath(options.repo) - if repo_path is None: - parser.error("Unable to locate repository named '%s'" % \ - (options.repo,)) - return 1 - - # Limit ebuilds to the specified repo. - portdb.porttrees = [repo_path] - else: - portdb.porttrees = [portdb.porttree_root] - ret = [os.EX_OK] if options.update: