From f8a3d769f483aa6a43b2710d6ac3500ec65d3aed Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 16 Jun 2008 10:47:30 +0000 Subject: [PATCH] =?utf8?q?Add=20two=20new=20build=20log=20qa=20checks,=20s?= =?utf8?q?uggested=20by=20Diego=20Petten=C3=B2:?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit * Detect automake "maintainer mode". See http://www.gentoo.org/proj/en/qa/autofailure.xml for more information. * Detect "Unrecognized options" messages from configure scripts. (trunk r10652) svn path=/main/branches/2.1.2/; revision=10663 --- pym/portage.py | 54 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/pym/portage.py b/pym/portage.py index fda8a1ec4..fbd997692 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -689,11 +689,14 @@ def elog_process(cpv, mysettings): pass def _eerror(settings, lines): + _elog("eerror", settings, lines) + +def _elog(func, settings, lines): if not lines: return cmd = "source '%s/isolated-functions.sh' ; " % PORTAGE_BIN_PATH for line in lines: - cmd += "eerror %s ; " % _shell_quote(line) + cmd += "%s %s ; " % (func, _shell_quote(line)) portage_exec.spawn(["bash", "-c", cmd], env=settings.environ()) @@ -4193,6 +4196,55 @@ def spawnebuild(mydo,actionmap,mysettings,debug,alwaysdep=0,logfile=None): filemode=060, filemask=0) if phase_retval == os.EX_OK: + if mydo == "install" and logfile: + try: + f = open(logfile, 'rb') + except EnvironmentError: + pass + else: + am_maintainer_mode = [] + configure_opts_warn = [] + configure_opts_warn_re = re.compile( + r'^configure: WARNING: Unrecognized options: .*') + am_maintainer_mode_re = re.compile(r'.*/missing --run .*') + try: + for line in f: + if am_maintainer_mode_re.search(line) is not None: + am_maintainer_mode.append(line.rstrip("\n")) + if configure_opts_warn_re.match(line) is not None: + configure_opts_warn.append(line.rstrip("\n")) + finally: + f.close() + + def _eqawarn(lines): + _elog("eqawarn", mysettings, lines) + from textwrap import wrap + wrap_width = 70 + + if am_maintainer_mode: + msg = ["QA Notice: Automake \"maintainer mode\" detected:"] + msg.append("") + msg.extend("\t" + line for line in am_maintainer_mode) + msg.append("") + msg.extend(wrap( + "If you patch Makefile.am, " + \ + "configure.in, or configure.ac then you " + \ + "should use autotools.eclass and " + \ + "eautomake or eautoreconf. Exceptions " + \ + "are limited to system packages " + \ + "for which it is impossible to run " + \ + "autotools during stage building. " + \ + "See http://www.gentoo.org/p" + \ + "roj/en/qa/autofailure.xml for more information.", + wrap_width)) + _eqawarn(msg) + + if configure_opts_warn: + msg = ["QA Notice: Unrecognized configure options:"] + msg.append("") + msg.extend("\t" + line for line in configure_opts_warn) + _eqawarn(msg) + if mydo == "install": # User and group bits that match the "portage" user or group are # automatically mapped to PORTAGE_INST_UID and PORTAGE_INST_GID if -- 2.26.2