From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1REVV4-0001kI-R8 for garchives@archives.gentoo.org; Fri, 14 Oct 2011 00:19:47 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 768CC21C097; Fri, 14 Oct 2011 00:19:37 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 3532221C097 for ; Fri, 14 Oct 2011 00:19:37 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 651061B401A for ; Fri, 14 Oct 2011 00:19:36 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 44F2580042 for ; Fri, 14 Oct 2011 00:19:35 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, pym/portage/dbapi/, bin/, pym/portage/repository/, ... X-VCS-Repository: proj/portage X-VCS-Files: bin/egencache pym/_emerge/actions.py pym/portage/dbapi/porttree.py pym/portage/package/ebuild/config.py pym/portage/repository/config.py X-VCS-Directories: pym/portage/package/ebuild/ pym/portage/dbapi/ bin/ pym/portage/repository/ pym/_emerge/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: d4ea29bf6a3ce35d49e0f54f9173e3a6e42da2d6 Date: Fri, 14 Oct 2011 00:19:35 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 10c89c998e4bec9c875616c9e376a4c9 commit: d4ea29bf6a3ce35d49e0f54f9173e3a6e42da2d6 Author: Brian Harring chromium org> AuthorDate: Thu Oct 13 23:26:03 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Fri Oct 14 00:19:26 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3Dd4ea29bf layout.conf: make the pregenerated cache format controllable Controllable via 'cache-format', currently it supports only one cache; 'pms', and defaults to it. If an unsupported cache-format is specified, the cache is disabled. If pms is specified and metadata/cache directory doesn't exist, the cache is disabled. Finally, this rips out the best module support for locally overriding the cache format used for pregenerated caches; this functionality made zero sense (upstream determines the format, we use what is available). --- bin/egencache | 4 ++-- pym/_emerge/actions.py | 8 -------- pym/portage/dbapi/porttree.py | 10 ++++------ pym/portage/package/ebuild/config.py | 1 - pym/portage/repository/config.py | 19 ++++++++++++++++++- 5 files changed, 24 insertions(+), 18 deletions(-) diff --git a/bin/egencache b/bin/egencache index 7766e78..26660c1 100755 --- a/bin/egencache +++ b/bin/egencache @@ -38,6 +38,7 @@ except ImportError: 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 import metadata from portage.manifest import guessManifestFileType from portage.util import cmp_sort_key, writemsg_level from portage import cpv_getkey @@ -214,8 +215,7 @@ class GenCache(object): consumer=3Dself._metadata_callback, max_jobs=3Dmax_jobs, max_load=3Dmax_load) self.returncode =3D os.EX_OK - metadbmodule =3D portdb.settings.load_best_module("portdbapi.metadbmod= ule") - self._trg_cache =3D metadbmodule(portdb.porttrees[0], + self._trg_cache =3D metadata.database(portdb.porttrees[0], "metadata/cache", portage.auxdbkeys[:]) if rsync: self._trg_cache.raise_stat_collision =3D True diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py index 08f70df..70a92c9 100644 --- a/pym/_emerge/actions.py +++ b/pym/_emerge/actions.py @@ -1660,14 +1660,6 @@ def action_metadata(settings, portdb, myopts, port= trees=3DNone): porttrees_data =3D [] for path in porttrees: src_db =3D portdb._pregen_auxdb.get(path) - if src_db is None and \ - os.path.isdir(os.path.join(path, 'metadata', 'cache')): - src_db =3D portdb.metadbmodule( - path, 'metadata/cache', auxdbkeys, readonly=3DTrue) - try: - src_db.ec =3D portdb._repo_info[path].eclass_db - except AttributeError: - pass =20 if src_db is not None: porttrees_data.append(TreeData(portdb.auxdb[path], diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.p= y index ef2e088..f48741b 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -120,8 +120,6 @@ class portdbapi(dbapi): self._have_root_eclass_dir =3D os.path.isdir( os.path.join(self.settings.repositories.mainRepoLocation(), "eclass")= ) =20 - self.metadbmodule =3D self.settings.load_best_module("portdbapi.metadb= module") - #if the portdbapi is "frozen", then we assume that we can cache everyt= hing (that no updates to it are happening) self.xcache =3D {} self.frozen =3D 0 @@ -214,10 +212,10 @@ class portdbapi(dbapi): for x in self.porttrees: if x in self._pregen_auxdb: continue - if os.path.isdir(os.path.join(x, "metadata", "cache")): - conf =3D self.repositories.get_repo_for_location(x) - cache =3D self._pregen_auxdb[x] =3D self.metadbmodule( - x, "metadata/cache", filtered_auxdbkeys, readonly=3DTrue) + conf =3D self.repositories.get_repo_for_location(x) + cache =3D conf.get_pregenerated_cache(filtered_auxdbkeys, readonly=3D= True) + if cache is not None: + self._pregen_auxdb[x] =3D cache try: cache.ec =3D self._repo_info[x].eclass_db except AttributeError: diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/e= build/config.py index 73af066..37dcbb4 100644 --- a/pym/portage/package/ebuild/config.py +++ b/pym/portage/package/ebuild/config.py @@ -311,7 +311,6 @@ class config(object): if self.modules["user"] is None: self.modules["user"] =3D {} self.modules["default"] =3D { - "portdbapi.metadbmodule": "portage.cache.metadata.database", "portdbapi.auxdbmodule": "portage.cache.flat_hash.database", } =20 diff --git a/pym/portage/repository/config.py b/pym/portage/repository/co= nfig.py index 2490b65..9a54738 100644 --- a/pym/portage/repository/config.py +++ b/pym/portage/repository/config.py @@ -48,7 +48,7 @@ class RepoConfig(object): 'eclass_overrides', 'eclass_locations', 'format', 'location', 'main_repo', 'manifest_hashes', 'masters', 'missing_repo_name', 'name', 'priority', 'sign_manifest', 'sync', 'thin_manifest', - 'user_location') + 'user_location', 'cache_format') =20 def __init__(self, name, repo_opts): """Build a RepoConfig with options in repo_opts @@ -126,6 +126,16 @@ class RepoConfig(object): self.create_manifest =3D True self.disable_manifest =3D False self.manifest_hashes =3D None + self.cache_format =3D None + + def get_pregenerated_cache(self, auxdbkeys, readonly=3DTrue): + if self.cache_format is None: + return None + elif self.cache_format =3D=3D 'pms': + from portage.cache.metadata import database + return database(self.location, 'metadata/cache', + auxdbkeys, readonly=3Dreadonly) + return None =20 def load_manifest(self, *args, **kwds): kwds['thin'] =3D self.thin_manifest @@ -377,6 +387,13 @@ class RepoConfigLoader(object): repo.create_manifest =3D manifest_policy !=3D 'false' repo.disable_manifest =3D manifest_policy =3D=3D 'false' =20 + # for compatibility w/ PMS, fallback to pms; but also check if the + # cache exists or not. + repo.cache_format =3D layout_data.get('cache-format', 'pms').lower() + if repo.cache_format =3D=3D 'pms' and not os.path.isdir( + os.path.join(repo.location, 'metadata', 'cache')): + repo.cache_format =3D None + manifest_hashes =3D layout_data.get('manifest-hashes') if manifest_hashes is not None: manifest_hashes =3D frozenset(manifest_hashes.upper().split())