From: Zac Medico Date: Sun, 29 Jun 2008 08:09:58 +0000 (-0000) Subject: Split out a _spawn_misc_sh() function from spawnebuild(). X-Git-Tag: v2.2_rc2~280 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=5a79dd93a294310f325459b123400e156158140e;p=portage.git Split out a _spawn_misc_sh() function from spawnebuild(). svn path=/main/trunk/; revision=10845 --- diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 9fd08e88e..2ae0bbfe5 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -4289,36 +4289,51 @@ def spawnebuild(mydo,actionmap,mysettings,debug,alwaysdep=0,logfile=None): apply_secpass_permissions(fpath, uid=myuid, gid=mygid, mode=mystat.st_mode, stat_cached=mystat, follow_links=False) - # Note: PORTAGE_BIN_PATH may differ from the global - # constant when portage is reinstalling itself. - portage_bin_path = mysettings["PORTAGE_BIN_PATH"] - misc_sh_binary = os.path.join(portage_bin_path, - os.path.basename(MISC_SH_BINARY)) - mycommand = " ".join([_shell_quote(misc_sh_binary), - "install_qa_check", "install_symlink_html_docs"]) - _doebuild_exit_status_unlink( - mysettings.get("EBUILD_EXIT_STATUS_FILE")) - filter_calling_env_state = mysettings._filter_calling_env - if os.path.exists(os.path.join(mysettings["T"], "environment")): - mysettings._filter_calling_env = True - try: - qa_retval = spawn(mycommand, mysettings, debug=debug, - logfile=logfile, **kwargs) - finally: - mysettings._filter_calling_env = filter_calling_env_state - msg = _doebuild_exit_status_check(mydo, mysettings) - if msg: - qa_retval = 1 - from textwrap import wrap - from portage.elog.messages import eerror - for l in wrap(msg, 72): - eerror(l, phase=mydo, key=mysettings.mycpv) + qa_retval = _spawn_misc_sh(mysettings, ["install_qa_check", + "install_symlink_html_docs"], **kwargs) if qa_retval != os.EX_OK: writemsg("!!! install_qa_check failed; exiting.\n", noiselevel=-1) - return qa_retval + return qa_retval return phase_retval +def _spawn_misc_sh(mysettings, commands, **kwargs): + """ + @param mysettings: the ebuild config + @type mysettings: config + @param commands: a list of function names to call in misc-functions.sh + @type commands: list + @rtype: int + @returns: the return value from the spawn() call + """ + + # Note: PORTAGE_BIN_PATH may differ from the global + # constant when portage is reinstalling itself. + portage_bin_path = mysettings["PORTAGE_BIN_PATH"] + misc_sh_binary = os.path.join(portage_bin_path, + os.path.basename(MISC_SH_BINARY)) + mycommand = " ".join([_shell_quote(misc_sh_binary)] + commands) + _doebuild_exit_status_unlink( + mysettings.get("EBUILD_EXIT_STATUS_FILE")) + filter_calling_env_state = mysettings._filter_calling_env + if os.path.exists(os.path.join(mysettings["T"], "environment")): + mysettings._filter_calling_env = True + debug = mysettings.get("PORTAGE_DEBUG") == "1" + logfile = mysettings.get("PORTAGE_LOG_FILE") + mydo = mysettings["EBUILD_PHASE"] + try: + rval = spawn(mycommand, mysettings, debug=debug, + logfile=logfile, **kwargs) + finally: + mysettings._filter_calling_env = filter_calling_env_state + msg = _doebuild_exit_status_check(mydo, mysettings) + if msg: + rval = 1 + from textwrap import wrap + from portage.elog.messages import eerror + for l in wrap(msg, 72): + eerror(l, phase=mydo, key=mysettings.mycpv) + return rval def eapi_is_supported(eapi): try: