* [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, pym/portage/dbapi/, bin/, pym/_emerge/
@ 2011-09-15 5:49 Zac Medico
0 siblings, 0 replies; 4+ messages in thread
From: Zac Medico @ 2011-09-15 5:49 UTC (permalink / raw
To: gentoo-commits
commit: 64b83bcc9935cb3255ed96238db86fb27120abfa
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 15 05:48:26 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Sep 15 05:48:26 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=64b83bcc
Remove unused Manifest imports.
---
bin/repoman | 1 -
pym/_emerge/search.py | 1 -
pym/portage/dbapi/porttree.py | 1 -
pym/portage/package/ebuild/digestcheck.py | 1 -
pym/portage/package/ebuild/fetch.py | 1 -
5 files changed, 0 insertions(+), 5 deletions(-)
diff --git a/bin/repoman b/bin/repoman
index f216a9b..b95fc03 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -67,7 +67,6 @@ from portage import cvstree, normalize_path
from portage import util
from portage.exception import (FileNotFound, MissingParameter,
ParseError, PermissionDenied)
-from portage.manifest import Manifest
from portage.process import find_binary, spawn
from portage.output import bold, create_color_func, \
green, nocolor, red
diff --git a/pym/_emerge/search.py b/pym/_emerge/search.py
index 4a4183d..acfcfd0 100644
--- a/pym/_emerge/search.py
+++ b/pym/_emerge/search.py
@@ -7,7 +7,6 @@ import re
import portage
from portage import os
from portage.dbapi.porttree import _parse_uri_map
-from portage.manifest import Manifest
from portage.output import bold, bold as white, darkgreen, green, red
from portage.util import writemsg_stdout
diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py
index bfff026..af2bca1 100644
--- a/pym/portage/dbapi/porttree.py
+++ b/pym/portage/dbapi/porttree.py
@@ -24,7 +24,6 @@ from portage.dbapi import dbapi
from portage.exception import PortageException, \
FileNotFound, InvalidAtom, InvalidDependString, InvalidPackageName
from portage.localization import _
-from portage.manifest import Manifest
from portage import eclass_cache, auxdbkeys, \
eapi_is_supported, dep_check, \
diff --git a/pym/portage/package/ebuild/digestcheck.py b/pym/portage/package/ebuild/digestcheck.py
index 33f9cd6..6cbaad9 100644
--- a/pym/portage/package/ebuild/digestcheck.py
+++ b/pym/portage/package/ebuild/digestcheck.py
@@ -8,7 +8,6 @@ import warnings
from portage import os, _encodings, _unicode_decode
from portage.exception import DigestException, FileNotFound
from portage.localization import _
-from portage.manifest import Manifest
from portage.output import EOutput
from portage.util import writemsg
diff --git a/pym/portage/package/ebuild/fetch.py b/pym/portage/package/ebuild/fetch.py
index 11c4c01..84b6418 100644
--- a/pym/portage/package/ebuild/fetch.py
+++ b/pym/portage/package/ebuild/fetch.py
@@ -34,7 +34,6 @@ from portage.exception import FileNotFound, OperationNotPermitted, \
PortageException, TryAgain
from portage.localization import _
from portage.locks import lockfile, unlockfile
-from portage.manifest import Manifest
from portage.output import colorize, EOutput
from portage.util import apply_recursive_permissions, \
apply_secpass_permissions, ensure_dirs, grabdict, shlex_split, \
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, pym/portage/dbapi/, bin/, pym/_emerge/
@ 2011-12-09 5:56 Arfrever Frehtes Taifersar Arahesis
0 siblings, 0 replies; 4+ messages in thread
From: Arfrever Frehtes Taifersar Arahesis @ 2011-12-09 5:56 UTC (permalink / raw
To: gentoo-commits
commit: 611268630be4349727b3bf39a1249953f04e3b7f
Author: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Gentoo <DOT> Org>
AuthorDate: Fri Dec 9 05:51:26 2011 +0000
Commit: Arfrever Frehtes Taifersar Arahesis <arfrever <AT> gentoo <DOT> org>
CommitDate: Fri Dec 9 05:51:26 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=61126863
Delete portage.dbapi.porttree._repo_info class and _repo_info attribute of
portage.dbapi.porttree.portdbapi objects. Migrate consumers to repositories
attribute of portage.dbapi.porttree.portdbapi objects.
---
bin/egencache | 2 +-
bin/repoman | 6 +++---
pym/_emerge/actions.py | 2 +-
pym/portage/dbapi/porttree.py | 24 +++---------------------
pym/portage/package/ebuild/doebuild.py | 10 +++++-----
5 files changed, 13 insertions(+), 31 deletions(-)
diff --git a/bin/egencache b/bin/egencache
index 3329a07..ba1f188 100755
--- a/bin/egencache
+++ b/bin/egencache
@@ -203,7 +203,7 @@ class GenCache(object):
# findname, cp_list, and cpv_list to the desired tree.
tree = portdb.porttrees[0]
self._portdb = portdb
- self._eclass_db = portdb._repo_info[tree].eclass_db
+ self._eclass_db = portdb.repositories.get_repo_for_location(tree).eclass_db
self._auxdbkeys = portdb._known_keys
# We can globally cleanse stale cache only if we
# iterate over every single cp.
diff --git a/bin/repoman b/bin/repoman
index 8f42a38..fc5000f 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -584,8 +584,8 @@ portdb = trees[root]['porttree'].dbapi
# that are specified in layout.conf.
repodir = os.path.realpath(portdir_overlay)
repo_config = repoman_settings.repositories.get_repo_for_location(repodir)
-repo_info = portdb._repo_info[repodir]
-portdb.porttrees = list(repo_info.eclass_db.porttrees)
+eclass_db = portdb.repositories.get_repo_for_location(repodir).eclass_db
+portdb.porttrees = list(eclass_db.porttrees)
portdir = portdb.porttrees[0]
# In order to disable manifest signatures, repos may set
@@ -673,7 +673,7 @@ logging.info('PORTDIR_OVERLAY = "%s"' % env['PORTDIR_OVERLAY'])
env['FEATURES'] = env.get('FEATURES', '') + ' -unknown-features-warn'
categories = []
-for path in repo_info.eclass_db.porttrees:
+for path in eclass_db.porttrees:
categories.extend(portage.util.grabfile(
os.path.join(path, 'profiles', 'categories')))
repoman_settings.categories = frozenset(
diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
index 54c9774..b7b3b90 100644
--- a/pym/_emerge/actions.py
+++ b/pym/_emerge/actions.py
@@ -1672,7 +1672,7 @@ def action_metadata(settings, portdb, myopts, porttrees=None):
if src_db is not None:
porttrees_data.append(TreeData(portdb.auxdb[path],
- portdb._repo_info[path].eclass_db, path, src_db))
+ portdb.repositories.get_repo_for_location(path).eclass_db, path, src_db))
porttrees = [tree_data.path for tree_data in porttrees_data]
diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py
index 94961dd..e483edb 100644
--- a/pym/portage/dbapi/porttree.py
+++ b/pym/portage/dbapi/porttree.py
@@ -46,15 +46,6 @@ if sys.hexversion >= 0x3000000:
basestring = str
long = int
-class _repo_info(object):
- __slots__ = ('name', 'path', 'eclass_db', 'portdir', 'portdir_overlay')
- def __init__(self, name, path, eclass_db):
- self.name = name
- self.path = path
- self.eclass_db = eclass_db
- self.portdir = eclass_db.porttrees[0]
- self.portdir_overlay = ' '.join(eclass_db.porttrees[1:])
-
class portdbapi(dbapi):
"""this tree will scan a portage directory located at root (passed to init)"""
portdbapi_instances = []
@@ -124,14 +115,6 @@ class portdbapi(dbapi):
self.xcache = {}
self.frozen = 0
- #Create eclass dbs
- self._repo_info = {}
- for repo in self.repositories:
- if repo.location in self._repo_info:
- continue
-
- self._repo_info[repo.location] = _repo_info(repo.name, repo.location, repo.eclass_db)
-
#Keep a list of repo names, sorted by priority (highest priority first).
self._ordered_repo_name_list = tuple(reversed(self.repositories.prepos_order))
@@ -211,7 +194,7 @@ class portdbapi(dbapi):
self._known_keys, readonly=True)
if cache is not None:
try:
- cache.ec = self._repo_info[tree].eclass_db
+ cache.ec = self.repositories.get_repo_for_location(tree).eclass_db
except AttributeError:
pass
return cache
@@ -362,8 +345,7 @@ class portdbapi(dbapi):
metadata = dict(i)
if metadata.get("INHERITED", False):
- metadata["_eclasses_"] = self._repo_info[repo_path
- ].eclass_db.get_eclass_data(metadata["INHERITED"].split())
+ metadata["_eclasses_"] = self.repositories.get_repo_for_location(repo_path).eclass_db.get_eclass_data(metadata["INHERITED"].split())
else:
metadata["_eclasses_"] = {}
@@ -423,7 +405,7 @@ class portdbapi(dbapi):
if ro_auxdb is not None:
auxdbs.append(ro_auxdb)
auxdbs.append(self.auxdb[repo_path])
- eclass_db = self._repo_info[repo_path].eclass_db
+ eclass_db = self.repositories.get_repo_for_location(repo_path).eclass_db
for auxdb in auxdbs:
try:
diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
index e42d9a4..4955c66 100644
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@ -239,11 +239,11 @@ def doebuild_environment(myebuild, mydo, myroot=None, settings=None,
mysettings["FILESDIR"] = pkg_dir+"/files"
mysettings["PF"] = mypv
- if hasattr(mydbapi, '_repo_info'):
- repo_info = mydbapi._repo_info[mytree]
- mysettings['PORTDIR'] = repo_info.portdir
- mysettings['PORTDIR_OVERLAY'] = repo_info.portdir_overlay
- mysettings.configdict["pkg"]["PORTAGE_REPO_NAME"] = repo_info.name
+ if hasattr(mydbapi, 'repositories'):
+ repo = mydbapi.repositories.get_repo_for_location(mytree)
+ mysettings['PORTDIR'] = repo.eclass_db.porttrees[0]
+ mysettings['PORTDIR_OVERLAY'] = ' '.join(repo.eclass_db.porttrees[1:])
+ mysettings.configdict["pkg"]["PORTAGE_REPO_NAME"] = repo.name
mysettings["PORTDIR"] = os.path.realpath(mysettings["PORTDIR"])
mysettings["DISTDIR"] = os.path.realpath(mysettings["DISTDIR"])
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, pym/portage/dbapi/, bin/, pym/_emerge/
@ 2012-05-10 22:03 Zac Medico
0 siblings, 0 replies; 4+ messages in thread
From: Zac Medico @ 2012-05-10 22:03 UTC (permalink / raw
To: gentoo-commits
commit: 46665179f7ca0bfe675d7a07bcfb29a8cdb8e307
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu May 10 21:23:56 2012 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 10 22:03:14 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=46665179
Don't write or trust cache for unsupported EAPIs.
Since we're supposed to be able to efficiently obtain the EAPI from
_parse_eapi_ebuild_head, we don't need to write or trust cache entries
for unsupported EAPIs.
---
bin/egencache | 9 +++-
pym/_emerge/EbuildMetadataPhase.py | 46 +++++++++++++------
pym/_emerge/MetadataRegen.py | 6 +-
pym/portage/dbapi/porttree.py | 60 ++++--------------------
pym/portage/package/ebuild/getmaskingstatus.py | 2 -
5 files changed, 51 insertions(+), 72 deletions(-)
diff --git a/bin/egencache b/bin/egencache
index b301115..13860bc 100755
--- a/bin/egencache
+++ b/bin/egencache
@@ -238,10 +238,15 @@ class GenCache(object):
self._existing_nodes = set()
- def _metadata_callback(self, cpv, repo_path, metadata, ebuild_hash):
+ def _metadata_callback(self, cpv, repo_path, metadata,
+ ebuild_hash, eapi_supported):
self._existing_nodes.add(cpv)
self._cp_missing.discard(cpv_getkey(cpv))
- if metadata is not None:
+
+ # Since we're supposed to be able to efficiently obtain the
+ # EAPI from _parse_eapi_ebuild_head, we don't write cache
+ # entries for unsupported EAPIs.
+ if metadata is not None and eapi_supported:
if metadata.get('EAPI') == '0':
del metadata['EAPI']
for trg_cache in self._trg_caches:
diff --git a/pym/_emerge/EbuildMetadataPhase.py b/pym/_emerge/EbuildMetadataPhase.py
index 7f9bd3b..c2d3747 100644
--- a/pym/_emerge/EbuildMetadataPhase.py
+++ b/pym/_emerge/EbuildMetadataPhase.py
@@ -24,8 +24,8 @@ class EbuildMetadataPhase(SubProcess):
used to extract metadata from the ebuild.
"""
- __slots__ = ("cpv", "ebuild_hash", "fd_pipes",
- "metadata_callback", "metadata", "portdb", "repo_path", "settings") + \
+ __slots__ = ("cpv", "eapi_supported", "ebuild_hash", "fd_pipes",
+ "metadata", "portdb", "repo_path", "settings") + \
("_eapi", "_eapi_lineno", "_raw_metadata",)
_file_names = ("ebuild",)
@@ -33,8 +33,6 @@ class EbuildMetadataPhase(SubProcess):
_metadata_fd = 9
def _start(self):
- settings = self.settings
- settings.setcpv(self.cpv)
ebuild_path = self.ebuild_hash.location
with io.open(_unicode_encode(ebuild_path,
@@ -54,13 +52,15 @@ class EbuildMetadataPhase(SubProcess):
self.wait()
return
- if not portage.eapi_is_supported(parsed_eapi):
- self.metadata = self.metadata_callback(self.cpv,
- self.repo_path, {'EAPI' : parsed_eapi}, self.ebuild_hash)
+ self.eapi_supported = portage.eapi_is_supported(parsed_eapi)
+ if not self.eapi_supported:
+ self.metadata = {"EAPI": parsed_eapi}
self._set_returncode((self.pid, os.EX_OK << 8))
self.wait()
return
+ settings = self.settings
+ settings.setcpv(self.cpv)
settings.configdict['pkg']['EAPI'] = parsed_eapi
debug = settings.get("PORTAGE_DEBUG") == "1"
@@ -148,28 +148,46 @@ class EbuildMetadataPhase(SubProcess):
metadata_lines = _unicode_decode(b''.join(self._raw_metadata),
encoding=_encodings['repo.content'],
errors='replace').splitlines()
+ metadata_valid = True
if len(portage.auxdbkeys) != len(metadata_lines):
# Don't trust bash's returncode if the
# number of lines is incorrect.
- self.returncode = 1
+ metadata_valid = False
else:
- metadata_valid = True
metadata = dict(zip(portage.auxdbkeys, metadata_lines))
parsed_eapi = self._eapi
if parsed_eapi is None:
parsed_eapi = "0"
- if (not metadata["EAPI"] or
- portage.eapi_is_supported(metadata["EAPI"])) and \
+ self.eapi_supported = \
+ portage.eapi_is_supported(metadata["EAPI"])
+ if (not metadata["EAPI"] or self.eapi_supported) and \
metadata["EAPI"] != parsed_eapi:
self._eapi_invalid(metadata)
if 'parse-eapi-ebuild-head' in self.settings.features:
metadata_valid = False
- if metadata_valid:
- self.metadata = self.metadata_callback(self.cpv,
+ if metadata_valid:
+ # Since we're supposed to be able to efficiently obtain the
+ # EAPI from _parse_eapi_ebuild_head, we don't write cache
+ # entries for unsupported EAPIs.
+ if self.eapi_supported:
+
+ if metadata.get("INHERITED", False):
+ metadata["_eclasses_"] = \
+ self.portdb.repositories.get_repo_for_location(
+ self.repo_path).eclass_db.get_eclass_data(
+ metadata["INHERITED"].split())
+ else:
+ metadata["_eclasses_"] = {}
+ metadata.pop("INHERITED", None)
+
+ self.portdb._write_cache(self.cpv,
self.repo_path, metadata, self.ebuild_hash)
else:
- self.returncode = 1
+ metadata = {"EAPI": metadata["EAPI"]}
+ self.metadata = metadata
+ else:
+ self.returncode = 1
def _eapi_invalid(self, metadata):
repo_name = self.portdb.getRepositoryName(self.repo_path)
diff --git a/pym/_emerge/MetadataRegen.py b/pym/_emerge/MetadataRegen.py
index 07fea73..79446ee 100644
--- a/pym/_emerge/MetadataRegen.py
+++ b/pym/_emerge/MetadataRegen.py
@@ -78,12 +78,11 @@ class MetadataRegen(PollScheduler):
cpv, ebuild_path, repo_path)
if metadata is not None:
if consumer is not None:
- consumer(cpv, repo_path, metadata, ebuild_hash)
+ consumer(cpv, repo_path, metadata, ebuild_hash, True)
continue
yield EbuildMetadataPhase(cpv=cpv,
ebuild_hash=ebuild_hash,
- metadata_callback=portdb._metadata_callback,
portdb=portdb, repo_path=repo_path,
settings=portdb.doebuild_settings)
@@ -177,7 +176,8 @@ class MetadataRegen(PollScheduler):
self._consumer(metadata_process.cpv,
metadata_process.repo_path,
metadata_process.metadata,
- metadata_process.ebuild_hash)
+ metadata_process.ebuild_hash,
+ metadata_process.eapi_supported)
self._schedule()
diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py
index 2bf17e1..f348a15 100644
--- a/pym/portage/dbapi/porttree.py
+++ b/pym/portage/dbapi/porttree.py
@@ -95,6 +95,7 @@ class portdbapi(dbapi):
# this purpose because doebuild makes many changes to the config
# instance that is passed in.
self.doebuild_settings = config(clone=self.settings)
+ self._scheduler = PollScheduler().sched_iface
self.depcachedir = os.path.realpath(self.settings.depcachedir)
if os.environ.get("SANDBOX_ON") == "1":
@@ -324,34 +325,7 @@ class portdbapi(dbapi):
return (filename, x)
return (None, 0)
- def _metadata_process(self, cpv, ebuild_path, repo_path):
- """
- Create an EbuildMetadataPhase instance to generate metadata for the
- give ebuild.
- @rtype: EbuildMetadataPhase
- @return: A new EbuildMetadataPhase instance, or None if the
- metadata cache is already valid.
- """
- metadata, ebuild_hash = self._pull_valid_cache(cpv, ebuild_path, repo_path)
- if metadata is not None:
- return None
-
- process = EbuildMetadataPhase(cpv=cpv,
- ebuild_hash=ebuild_hash, metadata_callback=self._metadata_callback,
- portdb=self, repo_path=repo_path, settings=self.doebuild_settings)
- return process
-
- def _metadata_callback(self, cpv, repo_path, metadata, ebuild_hash):
-
- i = metadata
- if hasattr(metadata, "items"):
- i = iter(metadata.items())
- metadata = dict(i)
-
- if metadata.get("INHERITED", False):
- metadata["_eclasses_"] = self.repositories.get_repo_for_location(repo_path).eclass_db.get_eclass_data(metadata["INHERITED"].split())
- else:
- metadata["_eclasses_"] = {}
+ def _write_cache(self, cpv, repo_path, metadata, ebuild_hash):
try:
cache = self.auxdb[repo_path]
@@ -363,20 +337,6 @@ class portdbapi(dbapi):
traceback.print_exc()
cache = None
- metadata.pop("INHERITED", None)
-
- eapi = metadata.get("EAPI")
- if not eapi or not eapi.strip():
- eapi = "0"
- metadata["EAPI"] = eapi
- if not eapi_is_supported(eapi):
- keys = set(metadata)
- keys.discard('_eclasses_')
- keys.discard('_mtime_')
- keys.discard('_%s_' % chf)
- metadata.update((k, '') for k in keys)
- metadata["EAPI"] = "-" + eapi.lstrip("-")
-
if cache is not None:
try:
cache[cpv] = metadata
@@ -384,7 +344,6 @@ class portdbapi(dbapi):
# Normally this shouldn't happen, so we'll show
# a traceback for debugging purposes.
traceback.print_exc()
- return metadata
def _pull_valid_cache(self, cpv, ebuild_path, repo_path):
try:
@@ -427,7 +386,10 @@ class portdbapi(dbapi):
if not eapi:
eapi = '0'
metadata['EAPI'] = eapi
- if eapi[:1] == '-' and eapi_is_supported(eapi[1:]):
+ if not eapi_is_supported(eapi):
+ # Since we're supposed to be able to efficiently obtain the
+ # EAPI from _parse_eapi_ebuild_head, we disregard cache entries
+ # for unsupported EAPIs.
continue
if auxdb.validate_entry(metadata, ebuild_hash, eclass_db):
break
@@ -482,13 +444,9 @@ class portdbapi(dbapi):
if myebuild in self._broken_ebuilds:
raise KeyError(mycpv)
- self.doebuild_settings.setcpv(mycpv)
-
proc = EbuildMetadataPhase(cpv=mycpv,
- ebuild_hash=ebuild_hash,
- metadata_callback=self._metadata_callback, portdb=self,
- repo_path=mylocation,
- scheduler=PollScheduler().sched_iface,
+ ebuild_hash=ebuild_hash, portdb=self,
+ repo_path=mylocation, scheduler=self._scheduler,
settings=self.doebuild_settings)
proc.start()
@@ -552,7 +510,7 @@ class portdbapi(dbapi):
# since callers already handle it.
raise portage.exception.InvalidDependString(
"getFetchMap(): '%s' has unsupported EAPI: '%s'" % \
- (mypkg, eapi.lstrip("-")))
+ (mypkg, eapi))
return _parse_uri_map(mypkg, {'EAPI':eapi,'SRC_URI':myuris},
use=useflags)
diff --git a/pym/portage/package/ebuild/getmaskingstatus.py b/pym/portage/package/ebuild/getmaskingstatus.py
index 66d3db5..b89fbf5 100644
--- a/pym/portage/package/ebuild/getmaskingstatus.py
+++ b/pym/portage/package/ebuild/getmaskingstatus.py
@@ -79,8 +79,6 @@ def _getmaskingstatus(mycpv, settings, portdb, myrepo=None):
mygroups = settings._getKeywords(mycpv, metadata)
licenses = metadata["LICENSE"]
properties = metadata["PROPERTIES"]
- if eapi.startswith("-"):
- eapi = eapi[1:]
if not eapi_is_supported(eapi):
return [_MaskReason("EAPI", "EAPI %s" % eapi)]
elif _eapi_is_deprecated(eapi) and not installed:
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, pym/portage/dbapi/, bin/, pym/_emerge/
@ 2012-05-10 23:32 Zac Medico
0 siblings, 0 replies; 4+ messages in thread
From: Zac Medico @ 2012-05-10 23:32 UTC (permalink / raw
To: gentoo-commits
commit: b6ef0aedb1b1b7c6fd4ab2d8d38369724ec6c383
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu May 10 21:23:56 2012 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 10 23:32:39 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b6ef0aed
Don't write or trust cache for unsupported EAPIs.
Since we're supposed to be able to efficiently obtain the EAPI from
_parse_eapi_ebuild_head, we don't need to write or trust cache entries
for unsupported EAPIs.
---
bin/egencache | 9 +++-
pym/_emerge/EbuildMetadataPhase.py | 46 +++++++++++++------
pym/_emerge/MetadataRegen.py | 6 +-
pym/_emerge/actions.py | 8 ---
pym/_emerge/depgraph.py | 2 -
pym/portage/dbapi/porttree.py | 60 ++++--------------------
pym/portage/package/ebuild/getmaskingstatus.py | 2 -
7 files changed, 51 insertions(+), 82 deletions(-)
diff --git a/bin/egencache b/bin/egencache
index b301115..13860bc 100755
--- a/bin/egencache
+++ b/bin/egencache
@@ -238,10 +238,15 @@ class GenCache(object):
self._existing_nodes = set()
- def _metadata_callback(self, cpv, repo_path, metadata, ebuild_hash):
+ def _metadata_callback(self, cpv, repo_path, metadata,
+ ebuild_hash, eapi_supported):
self._existing_nodes.add(cpv)
self._cp_missing.discard(cpv_getkey(cpv))
- if metadata is not None:
+
+ # Since we're supposed to be able to efficiently obtain the
+ # EAPI from _parse_eapi_ebuild_head, we don't write cache
+ # entries for unsupported EAPIs.
+ if metadata is not None and eapi_supported:
if metadata.get('EAPI') == '0':
del metadata['EAPI']
for trg_cache in self._trg_caches:
diff --git a/pym/_emerge/EbuildMetadataPhase.py b/pym/_emerge/EbuildMetadataPhase.py
index 7f9bd3b..c2d3747 100644
--- a/pym/_emerge/EbuildMetadataPhase.py
+++ b/pym/_emerge/EbuildMetadataPhase.py
@@ -24,8 +24,8 @@ class EbuildMetadataPhase(SubProcess):
used to extract metadata from the ebuild.
"""
- __slots__ = ("cpv", "ebuild_hash", "fd_pipes",
- "metadata_callback", "metadata", "portdb", "repo_path", "settings") + \
+ __slots__ = ("cpv", "eapi_supported", "ebuild_hash", "fd_pipes",
+ "metadata", "portdb", "repo_path", "settings") + \
("_eapi", "_eapi_lineno", "_raw_metadata",)
_file_names = ("ebuild",)
@@ -33,8 +33,6 @@ class EbuildMetadataPhase(SubProcess):
_metadata_fd = 9
def _start(self):
- settings = self.settings
- settings.setcpv(self.cpv)
ebuild_path = self.ebuild_hash.location
with io.open(_unicode_encode(ebuild_path,
@@ -54,13 +52,15 @@ class EbuildMetadataPhase(SubProcess):
self.wait()
return
- if not portage.eapi_is_supported(parsed_eapi):
- self.metadata = self.metadata_callback(self.cpv,
- self.repo_path, {'EAPI' : parsed_eapi}, self.ebuild_hash)
+ self.eapi_supported = portage.eapi_is_supported(parsed_eapi)
+ if not self.eapi_supported:
+ self.metadata = {"EAPI": parsed_eapi}
self._set_returncode((self.pid, os.EX_OK << 8))
self.wait()
return
+ settings = self.settings
+ settings.setcpv(self.cpv)
settings.configdict['pkg']['EAPI'] = parsed_eapi
debug = settings.get("PORTAGE_DEBUG") == "1"
@@ -148,28 +148,46 @@ class EbuildMetadataPhase(SubProcess):
metadata_lines = _unicode_decode(b''.join(self._raw_metadata),
encoding=_encodings['repo.content'],
errors='replace').splitlines()
+ metadata_valid = True
if len(portage.auxdbkeys) != len(metadata_lines):
# Don't trust bash's returncode if the
# number of lines is incorrect.
- self.returncode = 1
+ metadata_valid = False
else:
- metadata_valid = True
metadata = dict(zip(portage.auxdbkeys, metadata_lines))
parsed_eapi = self._eapi
if parsed_eapi is None:
parsed_eapi = "0"
- if (not metadata["EAPI"] or
- portage.eapi_is_supported(metadata["EAPI"])) and \
+ self.eapi_supported = \
+ portage.eapi_is_supported(metadata["EAPI"])
+ if (not metadata["EAPI"] or self.eapi_supported) and \
metadata["EAPI"] != parsed_eapi:
self._eapi_invalid(metadata)
if 'parse-eapi-ebuild-head' in self.settings.features:
metadata_valid = False
- if metadata_valid:
- self.metadata = self.metadata_callback(self.cpv,
+ if metadata_valid:
+ # Since we're supposed to be able to efficiently obtain the
+ # EAPI from _parse_eapi_ebuild_head, we don't write cache
+ # entries for unsupported EAPIs.
+ if self.eapi_supported:
+
+ if metadata.get("INHERITED", False):
+ metadata["_eclasses_"] = \
+ self.portdb.repositories.get_repo_for_location(
+ self.repo_path).eclass_db.get_eclass_data(
+ metadata["INHERITED"].split())
+ else:
+ metadata["_eclasses_"] = {}
+ metadata.pop("INHERITED", None)
+
+ self.portdb._write_cache(self.cpv,
self.repo_path, metadata, self.ebuild_hash)
else:
- self.returncode = 1
+ metadata = {"EAPI": metadata["EAPI"]}
+ self.metadata = metadata
+ else:
+ self.returncode = 1
def _eapi_invalid(self, metadata):
repo_name = self.portdb.getRepositoryName(self.repo_path)
diff --git a/pym/_emerge/MetadataRegen.py b/pym/_emerge/MetadataRegen.py
index 07fea73..79446ee 100644
--- a/pym/_emerge/MetadataRegen.py
+++ b/pym/_emerge/MetadataRegen.py
@@ -78,12 +78,11 @@ class MetadataRegen(PollScheduler):
cpv, ebuild_path, repo_path)
if metadata is not None:
if consumer is not None:
- consumer(cpv, repo_path, metadata, ebuild_hash)
+ consumer(cpv, repo_path, metadata, ebuild_hash, True)
continue
yield EbuildMetadataPhase(cpv=cpv,
ebuild_hash=ebuild_hash,
- metadata_callback=portdb._metadata_callback,
portdb=portdb, repo_path=repo_path,
settings=portdb.doebuild_settings)
@@ -177,7 +176,8 @@ class MetadataRegen(PollScheduler):
self._consumer(metadata_process.cpv,
metadata_process.repo_path,
metadata_process.metadata,
- metadata_process.ebuild_hash)
+ metadata_process.ebuild_hash,
+ metadata_process.eapi_supported)
self._schedule()
diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
index 62f3ff7..eaf5a15 100644
--- a/pym/_emerge/actions.py
+++ b/pym/_emerge/actions.py
@@ -1752,7 +1752,6 @@ def action_metadata(settings, portdb, myopts, porttrees=None):
eapi = src.get('EAPI')
if not eapi:
eapi = '0'
- eapi = eapi.lstrip('-')
eapi_supported = eapi_is_supported(eapi)
if not eapi_supported:
continue
@@ -1800,13 +1799,6 @@ def action_metadata(settings, portdb, myopts, porttrees=None):
# so there's no need to overwrite it.
continue
- if not eapi_supported:
- src = {
- 'EAPI' : '-' + eapi,
- dest_chf_key : src[dest_chf_key],
- '_eclasses_' : src['_eclasses_'],
- }
-
try:
tree_data.dest_db[cpv] = src
except CacheError:
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 2df29f7..4d3b04c 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -7130,8 +7130,6 @@ def get_mask_info(root_config, cpv, pkgsettings,
mreasons = ["corruption"]
else:
eapi = metadata['EAPI']
- if eapi[:1] == '-':
- eapi = eapi[1:]
if not portage.eapi_is_supported(eapi):
mreasons = ['EAPI %s' % eapi]
else:
diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py
index 2bf17e1..f348a15 100644
--- a/pym/portage/dbapi/porttree.py
+++ b/pym/portage/dbapi/porttree.py
@@ -95,6 +95,7 @@ class portdbapi(dbapi):
# this purpose because doebuild makes many changes to the config
# instance that is passed in.
self.doebuild_settings = config(clone=self.settings)
+ self._scheduler = PollScheduler().sched_iface
self.depcachedir = os.path.realpath(self.settings.depcachedir)
if os.environ.get("SANDBOX_ON") == "1":
@@ -324,34 +325,7 @@ class portdbapi(dbapi):
return (filename, x)
return (None, 0)
- def _metadata_process(self, cpv, ebuild_path, repo_path):
- """
- Create an EbuildMetadataPhase instance to generate metadata for the
- give ebuild.
- @rtype: EbuildMetadataPhase
- @return: A new EbuildMetadataPhase instance, or None if the
- metadata cache is already valid.
- """
- metadata, ebuild_hash = self._pull_valid_cache(cpv, ebuild_path, repo_path)
- if metadata is not None:
- return None
-
- process = EbuildMetadataPhase(cpv=cpv,
- ebuild_hash=ebuild_hash, metadata_callback=self._metadata_callback,
- portdb=self, repo_path=repo_path, settings=self.doebuild_settings)
- return process
-
- def _metadata_callback(self, cpv, repo_path, metadata, ebuild_hash):
-
- i = metadata
- if hasattr(metadata, "items"):
- i = iter(metadata.items())
- metadata = dict(i)
-
- if metadata.get("INHERITED", False):
- metadata["_eclasses_"] = self.repositories.get_repo_for_location(repo_path).eclass_db.get_eclass_data(metadata["INHERITED"].split())
- else:
- metadata["_eclasses_"] = {}
+ def _write_cache(self, cpv, repo_path, metadata, ebuild_hash):
try:
cache = self.auxdb[repo_path]
@@ -363,20 +337,6 @@ class portdbapi(dbapi):
traceback.print_exc()
cache = None
- metadata.pop("INHERITED", None)
-
- eapi = metadata.get("EAPI")
- if not eapi or not eapi.strip():
- eapi = "0"
- metadata["EAPI"] = eapi
- if not eapi_is_supported(eapi):
- keys = set(metadata)
- keys.discard('_eclasses_')
- keys.discard('_mtime_')
- keys.discard('_%s_' % chf)
- metadata.update((k, '') for k in keys)
- metadata["EAPI"] = "-" + eapi.lstrip("-")
-
if cache is not None:
try:
cache[cpv] = metadata
@@ -384,7 +344,6 @@ class portdbapi(dbapi):
# Normally this shouldn't happen, so we'll show
# a traceback for debugging purposes.
traceback.print_exc()
- return metadata
def _pull_valid_cache(self, cpv, ebuild_path, repo_path):
try:
@@ -427,7 +386,10 @@ class portdbapi(dbapi):
if not eapi:
eapi = '0'
metadata['EAPI'] = eapi
- if eapi[:1] == '-' and eapi_is_supported(eapi[1:]):
+ if not eapi_is_supported(eapi):
+ # Since we're supposed to be able to efficiently obtain the
+ # EAPI from _parse_eapi_ebuild_head, we disregard cache entries
+ # for unsupported EAPIs.
continue
if auxdb.validate_entry(metadata, ebuild_hash, eclass_db):
break
@@ -482,13 +444,9 @@ class portdbapi(dbapi):
if myebuild in self._broken_ebuilds:
raise KeyError(mycpv)
- self.doebuild_settings.setcpv(mycpv)
-
proc = EbuildMetadataPhase(cpv=mycpv,
- ebuild_hash=ebuild_hash,
- metadata_callback=self._metadata_callback, portdb=self,
- repo_path=mylocation,
- scheduler=PollScheduler().sched_iface,
+ ebuild_hash=ebuild_hash, portdb=self,
+ repo_path=mylocation, scheduler=self._scheduler,
settings=self.doebuild_settings)
proc.start()
@@ -552,7 +510,7 @@ class portdbapi(dbapi):
# since callers already handle it.
raise portage.exception.InvalidDependString(
"getFetchMap(): '%s' has unsupported EAPI: '%s'" % \
- (mypkg, eapi.lstrip("-")))
+ (mypkg, eapi))
return _parse_uri_map(mypkg, {'EAPI':eapi,'SRC_URI':myuris},
use=useflags)
diff --git a/pym/portage/package/ebuild/getmaskingstatus.py b/pym/portage/package/ebuild/getmaskingstatus.py
index 66d3db5..b89fbf5 100644
--- a/pym/portage/package/ebuild/getmaskingstatus.py
+++ b/pym/portage/package/ebuild/getmaskingstatus.py
@@ -79,8 +79,6 @@ def _getmaskingstatus(mycpv, settings, portdb, myrepo=None):
mygroups = settings._getKeywords(mycpv, metadata)
licenses = metadata["LICENSE"]
properties = metadata["PROPERTIES"]
- if eapi.startswith("-"):
- eapi = eapi[1:]
if not eapi_is_supported(eapi):
return [_MaskReason("EAPI", "EAPI %s" % eapi)]
elif _eapi_is_deprecated(eapi) and not installed:
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-05-10 23:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-09 5:56 [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, pym/portage/dbapi/, bin/, pym/_emerge/ Arfrever Frehtes Taifersar Arahesis
-- strict thread matches above, loose matches on Subject: below --
2012-05-10 23:32 Zac Medico
2012-05-10 22:03 Zac Medico
2011-09-15 5:49 Zac Medico
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox