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
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
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)