summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/_emerge/FakeVartree.py10
-rw-r--r--pym/_emerge/Package.py31
2 files changed, 29 insertions, 12 deletions
diff --git a/pym/_emerge/FakeVartree.py b/pym/_emerge/FakeVartree.py
index c74092d55..1d6a1aa67 100644
--- a/pym/_emerge/FakeVartree.py
+++ b/pym/_emerge/FakeVartree.py
@@ -7,12 +7,20 @@ import portage
from portage import os
from _emerge.Package import Package
from _emerge.PackageVirtualDbapi import PackageVirtualDbapi
+from portage.const import VDB_PATH
from portage.dbapi.vartree import vartree
from portage.update import grab_updates, parse_updates, update_dbentries
if sys.hexversion >= 0x3000000:
long = int
+class FakeVardbapi(PackageVirtualDbapi):
+ def getpath(self, cpv, filename=None):
+ path = os.path.join(self.settings['EROOT'], VDB_PATH, cpv)
+ if filename is not None:
+ path =os.path.join(path, filename)
+ return path
+
class FakeVartree(vartree):
"""This is implements an in-memory copy of a vartree instance that provides
all the interfaces required for use by the depgraph. The vardb is locked
@@ -37,7 +45,7 @@ class FakeVartree(vartree):
mykeys.append("_mtime_")
self._db_keys = mykeys
self._pkg_cache = pkg_cache
- self.dbapi = PackageVirtualDbapi(real_vartree.settings)
+ self.dbapi = FakeVardbapi(real_vartree.settings)
# Intialize variables needed for lazy cache pulls of the live ebuild
# metadata. This ensures that the vardb lock is released ASAP, without
diff --git a/pym/_emerge/Package.py b/pym/_emerge/Package.py
index 03f15b1c1..1209c6d9e 100644
--- a/pym/_emerge/Package.py
+++ b/pym/_emerge/Package.py
@@ -76,18 +76,27 @@ class Package(Task):
use_reduce(v, eapi=eapi,
is_valid_flag=self.iuse.is_valid_flag, token_class=Atom)
except portage.exception.InvalidDependString as e:
- categorized_error = False
- if e.errors:
- for error in e.errors:
- if getattr(error, 'category', None) is None:
- continue
- categorized_error = True
- self._invalid_metadata(error.category,
- "%s: %s" % (k, error))
-
- if not categorized_error:
+ if not self.installed:
+ categorized_error = False
+ if e.errors:
+ for error in e.errors:
+ if getattr(error, 'category', None) is None:
+ continue
+ categorized_error = True
+ self._invalid_metadata(error.category,
+ "%s: %s" % (k, error))
+
+ if not categorized_error:
+ self._invalid_metadata(k + ".syntax",
+ "%s: %s" % (k, e))
+ else:
+ # For installed packages, show the path of the file
+ # containing the invalid metadata, since the user may
+ # want to fix the deps by hand.
+ vardb = self.root_config.trees['vartree'].dbapi
+ path = vardb.getpath(self.cpv, filename=k)
self._invalid_metadata(k + ".syntax",
- "%s: %s" % (k, e))
+ "%s: %s in '%s'" % (k, e, path))
k = 'REQUIRED_USE'
v = self.metadata.get(k)