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 1RIpuB-0003E2-Iz for garchives@archives.gentoo.org; Tue, 25 Oct 2011 22:55:36 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5CAF321C021; Tue, 25 Oct 2011 22:55:25 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 1C0B521C021 for ; Tue, 25 Oct 2011 22:55:25 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 8610C1B401A for ; Tue, 25 Oct 2011 22:55:24 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id EAD9A80042 for ; Tue, 25 Oct 2011 22:55:23 +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: <2843806fad6d0aa07ad4ce97290ebe1d03b00104.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: bin/, pym/portage/repository/ X-VCS-Repository: proj/portage X-VCS-Files: bin/egencache pym/portage/repository/config.py X-VCS-Directories: bin/ pym/portage/repository/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 2843806fad6d0aa07ad4ce97290ebe1d03b00104 Date: Tue, 25 Oct 2011 22:55:23 +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: 81ba5ee1c22aedc5a69a3f4cb8621e26 commit: 2843806fad6d0aa07ad4ce97290ebe1d03b00104 Author: Zac Medico gentoo org> AuthorDate: Tue Oct 25 22:52:59 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Tue Oct 25 22:52:59 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3D2843806f layout.conf: rename cache_format to cache_formats We read layout.conf cache-formats from left to right and use the first supported type that's found. This will allow support for multiple formats in parallel, providing for smooth transitions between formats. --- bin/egencache | 3 +- pym/portage/repository/config.py | 44 ++++++++++++++++++++++++--------= ----- 2 files changed, 30 insertions(+), 17 deletions(-) diff --git a/bin/egencache b/bin/egencache index 0d07cdb..dec10b1 100755 --- a/bin/egencache +++ b/bin/egencache @@ -218,7 +218,8 @@ class GenCache(object): self._trg_cache =3D conf.get_pregenerated_cache(portage.auxdbkeys[:], force=3DTrue, readonly=3DFalse) if self._trg_cache is None: - raise Exception("cache format %s isn't supported" % (conf.cache_forma= t,)) + raise Exception("cache formats '%s' aren't supported" % + (" ".join(conf.cache_formats),)) if rsync: self._trg_cache.raise_stat_collision =3D True try: diff --git a/pym/portage/repository/config.py b/pym/portage/repository/co= nfig.py index 377ba47..9b4a76f 100644 --- a/pym/portage/repository/config.py +++ b/pym/portage/repository/config.py @@ -44,7 +44,7 @@ class RepoConfig(object): """Stores config of one repository""" =20 __slots__ =3D ('aliases', 'allow_missing_manifest', - 'cache_format', 'create_manifest', 'disable_manifest', + 'cache_formats', 'create_manifest', 'disable_manifest', 'eclass_overrides', 'eclass_locations', 'format', 'location', 'main_repo', 'manifest_hashes', 'masters', 'missing_repo_name', 'name', 'priority', 'sign_manifest', 'sync', 'thin_manifest', @@ -128,22 +128,32 @@ class RepoConfig(object): self.disable_manifest =3D False self.manifest_hashes =3D None self.update_changelog =3D False - self.cache_format =3D None + self.cache_formats =3D None self.portage1_profiles =3D True self.portage1_profiles_compat =3D False =20 def get_pregenerated_cache(self, auxdbkeys, readonly=3DTrue, force=3DFa= lse): - format =3D self.cache_format - if format is None: + """ + Reads layout.conf cache-formats from left to right and returns a + cache instance for the first supported type that's found. If no + cache-formats are specified in layout.conf, 'pms' type is assumed + if the metadata/cache directory exists or force is True. + """ + formats =3D self.cache_formats + if not formats: if not force: return None - format =3D 'pms' - if format =3D=3D 'pms': - from portage.cache.metadata import database - name =3D 'metadata/cache' - elif format =3D=3D 'md5-dict': - from portage.cache.flat_hash import md5_database as database - name =3D 'metadata/md5-cache' + formats =3D ('pms',) + + for fmt in formats: + if fmt =3D=3D 'pms': + from portage.cache.metadata import database + name =3D 'metadata/cache' + break + elif fmt =3D=3D 'md5-dict': + from portage.cache.flat_hash import md5_database as database + name =3D 'metadata/md5-cache' + break else: return None return database(self.location, name, @@ -379,7 +389,7 @@ class RepoConfigLoader(object): repo.aliases =3D tuple(aliases) + layout_data['aliases'] =20 for value in ('sign-manifest', 'thin-manifest', 'allow-missing-manife= st', - 'create-manifest', 'disable-manifest', 'cache-format', 'manifest-has= hes', + 'create-manifest', 'disable-manifest', 'cache-formats', 'manifest-ha= shes', 'update-changelog'): setattr(repo, value.lower().replace("-", "_"), layout_data[value]) =20 @@ -387,6 +397,8 @@ class RepoConfigLoader(object): for x in layout_data['profile-formats']) repo.portage1_profiles_compat =3D layout_data['profile-formats'] =3D=3D= ('portage-1-compat',) =20 + repo.cache_formats =3D layout_data['cache-formats'] + #Take aliases into account. new_prepos =3D {} for repo_name, repo in prepos.items(): @@ -608,11 +620,11 @@ def parse_layout_conf(repo_location, repo_name=3DNo= ne): =20 # for compatibility w/ PMS, fallback to pms; but also check if the # cache exists or not. - cache_format =3D layout_data.get('cache-format', 'pms').lower() - if cache_format =3D=3D 'pms' and not os.path.isdir( + cache_formats =3D layout_data.get('cache-formats', 'pms').lower().split= () + if 'pms' in cache_formats and not os.path.isdir( os.path.join(repo_location, 'metadata', 'cache')): - cache_format =3D None - data['cache-format'] =3D cache_format + cache_formats.remove('pms') + data['cache-formats'] =3D tuple(cache_formats) =20 manifest_hashes =3D layout_data.get('manifest-hashes') if manifest_hashes is not None: