From 9c0c0472ff894ebff43036c85740046aefb258fa Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Sat, 11 Apr 2009 11:22:36 +0000 Subject: [PATCH] Merged from trunk -r13286:13290 | 13287 | If there are not ebuilds matching a argument, only generate | | zmedico | an error if there are also no cache entries matching the | | | argument. | | 13288 | Always generate an error if the target cache contains an | | zmedico | apparently invalid cpv. | | 13289 | Add an example for PORTAGE_IONICE_COMMAND. Thanks to | | zmedico | Vlastimil Babka for the suggestion. | | 13290 | Bug #262647 - Inside config.setcpv(), never add SRC_URI to | | zmedico | the environment since that can cause execve() calls to fail | | | with E2BIG errors. | svn path=/main/branches/prefix/; revision=13318 --- acinclude.m4 | 2 +- bin/egencache | 45 ++++++++++++++++++++++++++++------------- cnf/make.conf | 5 +++++ pym/portage/__init__.py | 14 +++++++++---- 4 files changed, 47 insertions(+), 19 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index d305e3a52..07714f3a1 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -44,7 +44,7 @@ AC_DEFUN([GENTOO_PATH_XCU_ID], dnl does it support all the bells and whistles we need? AC_MSG_CHECKING([whether $XCU_ID is good enough]) - for a in '' '-G' '-Gn' '-g' '-gn' '-gr' '-gnr' '-u' '-un' '-ur' '-unr' ; do + for a in '' '-u' '-g' ; do if ! "$XCU_ID" $a >/dev/null 2>&1 ; then XCU_ID=no break diff --git a/bin/egencache b/bin/egencache index 923bd1664..487901cf0 100755 --- a/bin/egencache +++ b/bin/egencache @@ -26,6 +26,7 @@ import portage import _emerge from portage.cache.cache_errors import CacheError, StatCollision from portage.util import writemsg_level +from portage import cpv_getkey def parse_args(args): usage = "egencache [options] --update [atom] ..." @@ -133,7 +134,7 @@ class GenCache(object): def _metadata_callback(self, cpv, ebuild_path, repo_path, metadata): self._existing_nodes.add(cpv) - self._cp_missing.discard(portage.cpv_getkey(cpv)) + self._cp_missing.discard(cpv_getkey(cpv)) if metadata is not None: if metadata.get('EAPI') == '0': del metadata['EAPI'] @@ -176,19 +177,21 @@ class GenCache(object): def run(self): self._regen.run() self.returncode |= self._regen.returncode - - if self._cp_missing: - self.returncode |= 1 - for cp in sorted(self._cp_missing): - writemsg_level( - "No ebuilds found for '%s'\n" % (cp,), - level=logging.ERROR, noiselevel=-1) + cp_missing = self._cp_missing trg_cache = self._trg_cache - dead_nodes = None + dead_nodes = set() if self._global_cleanse: try: - dead_nodes = set(trg_cache.iterkeys()) + for cpv in trg_cache.iterkeys(): + cp = cpv_getkey(cpv) + if cp is None: + self.returncode |= 1 + writemsg_level( + "Unable to parse cp for '%s'\n" % (cpv,), + level=logging.ERROR, noiselevel=-1) + else: + dead_nodes.add(cpv) except CacheError, ce: self.returncode |= 1 writemsg_level( @@ -199,11 +202,18 @@ class GenCache(object): else: cp_set = self._cp_set - cpv_getkey = portage.cpv_getkey try: - dead_nodes = set(cpv for cpv in \ - trg_cache.iterkeys() \ - if cpv_getkey(cpv) in cp_set) + for cpv in trg_cache.iterkeys(): + cp = cpv_getkey(cpv) + if cp is None: + self.returncode |= 1 + writemsg_level( + "Unable to parse cp for '%s'\n" % (cpv,), + level=logging.ERROR, noiselevel=-1) + else: + cp_missing.discard(cp) + if cp in cp_set: + dead_nodes.add(cpv) except CacheError, ce: self.returncode |= 1 writemsg_level( @@ -212,6 +222,13 @@ class GenCache(object): (self._portdb.porttree_root, ce), level=logging.ERROR, noiselevel=-1) + if cp_missing: + self.returncode |= 1 + for cp in sorted(cp_missing): + writemsg_level( + "No ebuilds or cache entries found for '%s'\n" % (cp,), + level=logging.ERROR, noiselevel=-1) + if dead_nodes: dead_nodes.difference_update(self._existing_nodes) for k in dead_nodes: diff --git a/cnf/make.conf b/cnf/make.conf index 64a8ecff2..252105f7c 100644 --- a/cnf/make.conf +++ b/cnf/make.conf @@ -239,6 +239,11 @@ # reduce it further. Default is unset. #PORTAGE_NICENESS=3 # +# PORTAGE_IONICE_COMMAND provides a command for portage to call in order to +# adjust the io priority of portage and it's subprocesses. Default is +# unset. +#PORTAGE_IONICE_COMMAND="ionice -c 3 -p \${PID}" +# # AUTOCLEAN enables portage to automatically clean out older or overlapping # packages from the system after every successful merge. This is the # same as running 'emerge -c' after every merge. Set with: "yes" or "no". diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index b91dd006d..88ec62c4b 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -999,6 +999,13 @@ class config(object): virtuals ...etc you look in here. """ + # Don't include anything that could be extremely long here (like SRC_URI) + # since that could cause execve() calls to fail with E2BIG errors. For + # example, see bug #262647. + _setcpv_aux_keys = ('SLOT', 'RESTRICT', 'LICENSE', + 'KEYWORDS', 'INHERITED', 'IUSE', 'PROVIDE', 'EAPI', + 'PROPERTIES', 'DEFINED_PHASES', 'repository') + _env_blacklist = [ "A", "AA", "CATEGORY", "DEPEND", "DESCRIPTION", "EAPI", "EBUILD_PHASE", "EMERGE_FROM", "HOMEPAGE", "INHERITED", "IUSE", @@ -2125,9 +2132,7 @@ class config(object): pkg_configdict = self.configdict["pkg"] previous_iuse = pkg_configdict.get("IUSE") - aux_keys = [k for k in auxdbkeys \ - if not k.startswith("UNUSED_")] - aux_keys.append("repository") + aux_keys = self._setcpv_aux_keys # Discard any existing metadata from the previous package, but # preserve things like USE_EXPAND values and PORTAGE_USE which @@ -2139,7 +2144,8 @@ class config(object): pkg_configdict["PF"] = pf if mydb: if not hasattr(mydb, "aux_get"): - pkg_configdict.update(mydb) + for k in aux_keys: + pkg_configdict[k] = mydb.get(k, '') else: for k, v in izip(aux_keys, mydb.aux_get(self.mycpv, aux_keys)): pkg_configdict[k] = v -- 2.26.2