From dcadc5c8787b28d67e630c7f3101bc02f5721997 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Tue, 4 Aug 2009 16:29:35 +0000 Subject: [PATCH] Merged from trunk -r13874:13887 | 13879 | Remove the code from bug #278895 since we're going to need | | zmedico | a daemon process in the ebuild's login session in order to | | | pass signals from the controlling terminal to the detached | | | session. A simple fifo-based approach in ebuild.sh does not | | | seem to work since bash's read builtin occasionally loses | | | the fifo data when it's 'Interrupted system call'. Maybe a | | | python script will work better for the session | | | leader/daemon. NOTE: The daemon will also be useful for | | | implementing a fifo-based die helper (to replace the | | | current signal- based approach). | | 13880 | Bug #278729 - Add an Atom.without_use attribute which is | | zmedico | identical to the atom itself, except without any USE | | | dependencies. | | 13881 | Bug #278729 - Inside dep_zapdeps(), ignore USE dependencies | | zmedico | since we don't want USE settings to adversely affect || | | | preference evaluation. Drop invalid atoms inside | | | _expand_new_virtuals() since we only want real Atom | | | instances inside dep_zapdeps(). | | 13882 | Make the USE=test RDEPEND check (bug #236786) also apply to | | zmedico | PDEPEND. | | 13883 | Fix NameError from r13880. Thanks to Arfrever for | | zmedico | reporting. | | 13884 | Add a PDEPEND.suspect category. | | zmedico | | | 13887 | Set "emerge" xterm title at the beginning of running | | arfrever | emerge. | svn path=/main/branches/prefix/; revision=13897 --- bin/ebuild.sh | 13 ------------- bin/isolated-functions.sh | 3 +-- bin/repoman | 17 ++++++++++------- bin/setsid | 10 ---------- man/repoman.1 | 3 +++ pym/_emerge/depgraph.py | 18 +++--------------- pym/_emerge/main.py | 6 ++++-- pym/portage/__init__.py | 8 ++++++-- pym/portage/dep.py | 9 ++++++++- 9 files changed, 35 insertions(+), 52 deletions(-) delete mode 100755 bin/setsid diff --git a/bin/ebuild.sh b/bin/ebuild.sh index 150d98149..8f42772f0 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -27,19 +27,6 @@ PREROOTPATH=${PREROOTPATH%%:} PATH="$PORTAGE_BIN_PATH/ebuild-helpers:$PREROOTPATH${PREROOTPATH:+:}${DEFAULT_PATH}:${ROOTPATH:+:}$ROOTPATH" export PATH -if [[ -z $PORTAGE_SETSID && -n $1 && $1 != depend ]] ; then - # If available, use setsid to create a new login session so that we can use - # SIGHUP to ensure that no orphaned subprocesses are left running. - if type -P setsid >/dev/null ; then - export PORTAGE_SETSID=1 - exec setsid "$PORTAGE_BIN_PATH/ebuild.sh" "$@" - elif [[ -x $PORTAGE_BIN_PATH/setsid ]] ; then - export PORTAGE_SETSID=1 - exec "$PORTAGE_BIN_PATH/setsid" "$PORTAGE_BIN_PATH/ebuild.sh" "$@" - fi -fi -[[ $PORTAGE_SETSID = 1 ]] && trap 'trap : SIGHUP ; kill -s SIGHUP 0 ;' EXIT - # These two functions wrap sourcing and calling respectively. At present they # perform a qa check to make sure eclasses and ebuilds and profiles don't mess # with shell opts (shopts). Ebuilds/eclasses changing shopts should reset them diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh index 947da3946..20ab0f50f 100755 --- a/bin/isolated-functions.sh +++ b/bin/isolated-functions.sh @@ -538,8 +538,7 @@ save_ebuild_env() { PORTAGE_DEPCACHEDIR PORTAGE_GID PORTAGE_INST_GID \ PORTAGE_INST_UID PORTAGE_LOG_FILE PORTAGE_MASTER_PID \ PORTAGE_QUIET \ - PORTAGE_REPO_NAME PORTAGE_RESTRICT \ - PORTAGE_SETSID PORTAGE_UPDATE_ENV \ + PORTAGE_REPO_NAME PORTAGE_RESTRICT PORTAGE_UPDATE_ENV \ PORTAGE_VERBOSE PORTAGE_WORKDIR_MODE PORTDIR \ PORTDIR_OVERLAY ${!PORTAGE_SANDBOX_*} PREROOTPATH \ PROFILE_PATHS PWORKDIR QA_INTERCEPTORS \ diff --git a/bin/repoman b/bin/repoman index 2b67f44d6..186d38407 100755 --- a/bin/repoman +++ b/bin/repoman @@ -282,6 +282,7 @@ qahelp={ "DEPEND.badmaskedindev":"Masked ebuilds with bad DEPEND settings (matched against *all* ebuilds) in developing arch", "RDEPEND.badmaskedindev":"Masked ebuilds with RDEPEND settings (matched against *all* ebuilds) in developing arch", "PDEPEND.badmaskedindev":"Masked ebuilds with PDEPEND settings (matched against *all* ebuilds) in developing arch", + "PDEPEND.suspect":"PDEPEND contains a package that usually only belongs in DEPEND.", "DEPEND.syntax":"Syntax error in DEPEND (usually an extra/missing space/parenthesis)", "RDEPEND.syntax":"Syntax error in RDEPEND (usually an extra/missing space/parenthesis)", "PDEPEND.syntax":"Syntax error in PDEPEND (usually an extra/missing space/parenthesis)", @@ -342,6 +343,7 @@ qawarnings = set(( "KEYWORDS.missing", "IUSE.invalid", "IUSE.undefined", +"PDEPEND.suspect", "RDEPEND.implicit", "RDEPEND.suspect", "RESTRICT.invalid", @@ -1411,10 +1413,11 @@ for x in scanlist: for token in mydepstr.split(): if token in operator_tokens or \ token[-1:] == "?": - if token == "test?" and mytype == "RDEPEND": - stats['RDEPEND.suspect'] += 1 - fails['RDEPEND.suspect'].append(relative_path + \ - ": 'test?' USE conditional in RDEPEND") + if token == "test?" and \ + mytype in ("RDEPEND", "PDEPEND"): + stats[mytype + '.suspect'] += 1 + fails[mytype + '.suspect'].append(relative_path + \ + ": 'test?' USE conditional in %s" % mytype) continue try: atom = portage.dep.Atom(token) @@ -1429,11 +1432,11 @@ for x in scanlist: portage.dep_getkey(atom) == "virtual/jdk": stats['java.eclassesnotused'] += 1 fails['java.eclassesnotused'].append(relative_path) - elif mytype == "RDEPEND": + elif mytype in ("PDEPEND", "RDEPEND"): if not is_blocker and \ portage.dep_getkey(atom) in suspect_rdepend: - stats['RDEPEND.suspect'] += 1 - fails['RDEPEND.suspect'].append( + stats[mytype + '.suspect'] += 1 + fails[mytype + '.suspect'].append( relative_path + ": '%s'" % atom) if eapi == "0": if portage.dep.dep_getslot(atom): diff --git a/bin/setsid b/bin/setsid deleted file mode 100755 index 51ebaa395..000000000 --- a/bin/setsid +++ /dev/null @@ -1,10 +0,0 @@ -#!@PORTAGE_PYTHON@ -O -# Copyright 2009 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Id$ - -import os -import sys - -os.setsid() -os.execl(sys.argv[1], *sys.argv[1:]) diff --git a/man/repoman.1 b/man/repoman.1 index 555ff3995..13383a423 100644 --- a/man/repoman.1 +++ b/man/repoman.1 @@ -161,6 +161,9 @@ Masked ebuilds with PDEPEND settings (matched against *all* ebuilds) .B PDEPEND.badmaskedindev Masked ebuilds with PDEPEND settings (matched against *all* ebuilds) in developing arch .TP +.B PDEPEND.suspect +PDEPEND contains a package that usually only belongs in DEPEND +.TP .B PDEPEND.syntax Syntax error in PDEPEND (usually an extra/missing space/parenthesis) .TP diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index 1cfd0d693..f9363df9f 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -714,14 +714,8 @@ class depgraph(object): else: # Do not backtrack if only USE have to be changed in # order to satisfy the dependency. - atom_without_use = dep.atom - if dep.atom.use: - atom_without_use = portage.dep.remove_slot(dep.atom) - if dep.atom.slot: - atom_without_use += ":" + dep.atom.slot - atom_without_use = portage.dep.Atom(atom_without_use) dep_pkg, existing_node = \ - self._select_package(dep.root, atom_without_use, + self._select_package(dep.root, dep.atom.without_use, onlydeps=dep.onlydeps) if dep_pkg is None: self._dynamic_config._runtime_pkg_mask.setdefault( @@ -1847,12 +1841,6 @@ class depgraph(object): def _show_unsatisfied_dep(self, root, atom, myparent=None, arg=None): atom = portage.dep.Atom(atom) atom_set = InternalPackageSet(initial_atoms=(atom,)) - atom_without_use = atom - if atom.use: - atom_without_use = portage.dep.remove_slot(atom) - if atom.slot: - atom_without_use += ":" + atom.slot - atom_without_use = portage.dep.Atom(atom_without_use) xinfo = '"%s"' % atom if arg: xinfo='"%s"' % arg @@ -1873,9 +1861,9 @@ class depgraph(object): continue match = db.match if hasattr(db, "xmatch"): - cpv_list = db.xmatch("match-all", atom_without_use) + cpv_list = db.xmatch("match-all", atom.without_use) else: - cpv_list = db.match(atom_without_use) + cpv_list = db.match(atom.without_use) # descending order cpv_list.reverse() for cpv in cpv_list: diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py index c6c8d8583..0cb30da32 100644 --- a/pym/_emerge/main.py +++ b/pym/_emerge/main.py @@ -31,7 +31,7 @@ import portage import _emerge.help import portage.xpak, commands, errno, re, time -from portage.output import colorize, xtermTitleReset +from portage.output import colorize, xtermTitle, xtermTitleReset from portage.output import create_color_func good = create_color_func("GOOD") bad = create_color_func("BAD") @@ -1046,6 +1046,8 @@ def emerge_main(): portdb = trees[settings["ROOT"]]["porttree"].dbapi xterm_titles = "notitles" not in settings.features + if xterm_titles: + xtermTitle("emerge") tmpcmdline = [] if "--ignore-default-opts" not in myopts: @@ -1306,7 +1308,7 @@ def emerge_main(): """This gets out final log message in before we quit.""" if "--pretend" not in myopts: emergelog(xterm_titles, " *** terminating.") - if "notitles" not in settings.features: + if xterm_titles: xtermTitleReset() portage.atexit_register(emergeexit) diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 61ffd65fd..e850dcdae 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -1049,7 +1049,6 @@ class config(object): "EBUILD_PHASE", "EMERGE_FROM", "HOMEPAGE", "INHERITED", "IUSE", "KEYWORDS", "LICENSE", "PDEPEND", "PF", "PKGUSE", "PORTAGE_CONFIGROOT", "PORTAGE_IUSE", "PORTAGE_REPO_NAME", - "PORTAGE_SETSID", "PORTAGE_USE", "PROPERTIES", "PROVIDE", "RDEPEND", "RESTRICT", "ROOT", "SLOT", "SRC_URI", "EPREFIX", "EROOT" ] @@ -6944,6 +6943,9 @@ def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/", if portage.dep._dep_check_strict: raise portage.exception.ParseError( "invalid atom: '%s'" % x) + else: + # Only real Atom instances are allowed past this point. + continue else: if x.blocker and x.blocker.overlap.forbid and \ eapi in ("0", "1") and portage.dep._dep_check_strict: @@ -7165,7 +7167,9 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None): for atom in atoms: if atom[:1] == "!": continue - avail_pkg = mydbapi.match(atom) + # Ignore USE dependencies here since we don't want USE + # settings to adversely affect || preference evaluation. + avail_pkg = mydbapi.match(atom.without_use) if avail_pkg: avail_pkg = avail_pkg[-1] # highest (ascending order) avail_slot = "%s:%s" % (dep_getkey(atom), diff --git a/pym/portage/dep.py b/pym/portage/dep.py index 679a8558d..64215b68c 100644 --- a/pym/portage/dep.py +++ b/pym/portage/dep.py @@ -511,7 +511,7 @@ class Atom(object): _atoms = weakref.WeakValueDictionary() __slots__ = ("__weakref__", "blocker", "cp", "cpv", "operator", - "slot", "use", "_str") + "slot", "use", "without_use", "_str",) class _blocker(object): __slots__ = ("overlap",) @@ -550,9 +550,16 @@ class Atom(object): use = dep_getusedeps(s) if use: use = _use_dep(use) + without_use = remove_slot(self) + if self.slot is not None: + without_use += ":" + self.slot + without_use = Atom(without_use) else: use = None + without_use = self + obj_setattr(self, "use", use) + obj_setattr(self, "without_use", without_use) def __setattr__(self, name, value): raise AttributeError("Atom instances are immutable", -- 2.26.2