From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 0F4861381F3 for ; Sat, 6 Jul 2013 01:41:30 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B0E3EE097C; Sat, 6 Jul 2013 01:41:26 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 306C4E097C for ; Sat, 6 Jul 2013 01:41:26 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id E941833DA22 for ; Sat, 6 Jul 2013 01:41:24 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 84ACDE468F for ; Sat, 6 Jul 2013 01:41:23 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1373074861.1ac7623f580711d26a2b8e72547f2e6b5800b88e.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/package/ebuild/doebuild.py X-VCS-Directories: pym/portage/package/ebuild/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 1ac7623f580711d26a2b8e72547f2e6b5800b88e X-VCS-Branch: master Date: Sat, 6 Jul 2013 01:41:23 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 2e230f7f-f0a6-4df4-af61-f9b0329bbec4 X-Archives-Hash: f4c6e029e2712c4adc308675a300e35d commit: 1ac7623f580711d26a2b8e72547f2e6b5800b88e Author: Zac Medico gentoo org> AuthorDate: Sat Jul 6 01:41:01 2013 +0000 Commit: Zac Medico gentoo org> CommitDate: Sat Jul 6 01:41:01 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=1ac7623f doebuild: cleanup returnpid support, bug #475812 The returnpid parameter is no longer deprecated, since it's useful for API consumers that wish to use the fd_pipes parameter (the fd_pipes parameter is only respected when returnpid is True). --- pym/portage/package/ebuild/doebuild.py | 57 ++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 24 deletions(-) diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py index 6901719..8444e19 100644 --- a/pym/portage/package/ebuild/doebuild.py +++ b/pym/portage/package/ebuild/doebuild.py @@ -499,7 +499,9 @@ def doebuild(myebuild, mydo, _unused=DeprecationWarning, settings=None, debug=0, @param prev_mtimes: A dict of { filename:mtime } keys used by merge() to do config_protection @type prev_mtimes: dictionary @param fd_pipes: A dict of mapping for pipes, { '0': stdin, '1': stdout } - for example. + for example. This is parameter only guaranteed to be respected when + returnpid is True (otherwise all subprocesses simply inherit file + descriptors from sys.__std* streams). @type fd_pipes: Dictionary @param returnpid: Return a list of process IDs for a successful spawn, or an integer value if spawn is unsuccessful. NOTE: This requires the @@ -581,12 +583,6 @@ def doebuild(myebuild, mydo, _unused=DeprecationWarning, settings=None, debug=0, writemsg("\n", noiselevel=-1) return 1 - if returnpid and mydo != 'depend': - warnings.warn("portage.doebuild() called " + \ - "with returnpid parameter enabled. This usage will " + \ - "not be supported in the future.", - DeprecationWarning, stacklevel=2) - if mydo == "fetchall": fetchall = 1 mydo = "fetch" @@ -697,7 +693,7 @@ def doebuild(myebuild, mydo, _unused=DeprecationWarning, settings=None, debug=0, # we can temporarily override PORTAGE_TMPDIR with a random temp dir # so that there's no need for locking and it can be used even if the # user isn't in the portage group. - if mydo in ("info",): + if not returnpid and mydo in ("info",): tmpdir = tempfile.mkdtemp() tmpdir_orig = mysettings["PORTAGE_TMPDIR"] mysettings["PORTAGE_TMPDIR"] = tmpdir @@ -736,14 +732,15 @@ def doebuild(myebuild, mydo, _unused=DeprecationWarning, settings=None, debug=0, return _spawn_phase(mydo, mysettings, fd_pipes=fd_pipes, returnpid=returnpid) - # Validate dependency metadata here to ensure that ebuilds with invalid - # data are never installed via the ebuild command. Don't bother when - # returnpid == True since there's no need to do this every time emerge - # executes a phase. if tree == "porttree": - rval = _validate_deps(mysettings, myroot, mydo, mydbapi) - if rval != os.EX_OK: - return rval + + if not returnpid: + # Validate dependency metadata here to ensure that ebuilds with + # invalid data are never installed via the ebuild command. Skip + # this when returnpid is True (assume the caller handled it). + rval = _validate_deps(mysettings, myroot, mydo, mydbapi) + if rval != os.EX_OK: + return rval else: # FEATURES=noauto only makes sense for porttree, and we don't want @@ -761,11 +758,16 @@ def doebuild(myebuild, mydo, _unused=DeprecationWarning, settings=None, debug=0, return rval if mydo == "unmerge": + if returnpid: + writemsg("!!! doebuild: %s\n" % + _("returnpid is not supported for phase '%s'\n" % mydo), + noiselevel=-1) return unmerge(mysettings["CATEGORY"], mysettings["PF"], myroot, mysettings, vartree=vartree) phases_to_run = set() - if "noauto" in mysettings.features or \ + if returnpid or \ + "noauto" in mysettings.features or \ mydo not in actionmap_deps: phases_to_run.add(mydo) else: @@ -1013,7 +1015,9 @@ def doebuild(myebuild, mydo, _unused=DeprecationWarning, settings=None, debug=0, if len(actionmap_deps.get(x, [])): actionmap[x]["dep"] = ' '.join(actionmap_deps[x]) - if mydo in actionmap: + regular_actionmap_phase = mydo in actionmap + + if regular_actionmap_phase: bintree = None if mydo == "package": # Make sure the package directory exists before executing @@ -1037,6 +1041,9 @@ def doebuild(myebuild, mydo, _unused=DeprecationWarning, settings=None, debug=0, actionmap, mysettings, debug, logfile=logfile, fd_pipes=fd_pipes, returnpid=returnpid) + if returnpid and isinstance(retval, list): + return retval + if retval == os.EX_OK: if mydo == "package" and bintree is not None: bintree.inject(mysettings.mycpv, @@ -1048,7 +1055,15 @@ def doebuild(myebuild, mydo, _unused=DeprecationWarning, settings=None, debug=0, except OSError: pass - elif mydo=="qmerge": + elif returnpid: + writemsg("!!! doebuild: %s\n" % + _("returnpid is not supported for phase '%s'\n" % mydo), + noiselevel=-1) + + if regular_actionmap_phase: + # handled above + pass + elif mydo == "qmerge": # check to ensure install was run. this *only* pops up when users # forget it and are using ebuild if not os.path.exists( @@ -1492,12 +1507,6 @@ def spawn(mystring, mysettings, debug=0, free=0, droppriv=0, sesandbox=0, fakero def spawnebuild(mydo, actionmap, mysettings, debug, alwaysdep=0, logfile=None, fd_pipes=None, returnpid=False): - if returnpid: - warnings.warn("portage.spawnebuild() called " + \ - "with returnpid parameter enabled. This usage will " + \ - "not be supported in the future.", - DeprecationWarning, stacklevel=2) - if not returnpid and \ (alwaysdep or "noauto" not in mysettings.features): # process dependency first