commit:     bee63f0684a29d18782c8d4c41e0b9dad5046fc0
Author:     Patrice Clement <monsieurp <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 25 20:40:19 2015 +0000
Commit:     Patrice Clement <monsieurp <AT> gentoo <DOT> org>
CommitDate: Fri Sep 25 20:40:19 2015 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bee63f06

dev-util/colorgcc: Add patch to keep colorgcc from hanging when invoked at the 
CLI. Fixes bug 234166.

Package-Manager: portage-2.2.18
Signed-off-by: Patrice Clement <monsieurp <AT> gentoo.org>

 dev-util/colorgcc/colorgcc-1.3.2-r7.ebuild         | 65 ++++++++++++++++++++++
 .../colorgcc/files/colorgcc-1.3.2-nohang.patch     | 58 +++++++++++++++++++
 2 files changed, 123 insertions(+)

diff --git a/dev-util/colorgcc/colorgcc-1.3.2-r7.ebuild 
b/dev-util/colorgcc/colorgcc-1.3.2-r7.ebuild
new file mode 100644
index 0000000..2a18254
--- /dev/null
+++ b/dev-util/colorgcc/colorgcc-1.3.2-r7.ebuild
@@ -0,0 +1,65 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils
+
+DESCRIPTION="Perl script to colorise the gcc output."
+HOMEPAGE="http://schlueters.de/colorgcc.html";
+SRC_URI="mirror://gentoo/${P}.tar.gz"
+
+SLOT="0"
+LICENSE="GPL-2"
+KEYWORDS="~alpha ~amd64 ~hppa ~mips ~ppc ~sparc ~x86 ~x86-interix ~amd64-linux 
~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
+IUSE=""
+
+DEPEND="dev-lang/perl"
+RDEPEND="${DEPEND}"
+
+PATCHES=(
+       "${FILESDIR}"/${P}-gentoo-one.patch
+       "${FILESDIR}"/${P}-gentoo-two.patch
+       "${FILESDIR}"/${P}-note.patch
+       "${FILESDIR}"/${P}-nohang.patch
+)
+
+src_prepare() {
+       epatch "${PATCHES[@]}"
+}
+
+src_install() {
+       dobin colorgcc || die
+       dodir /etc/colorgcc /usr/lib/colorgcc/bin
+       insinto /etc/colorgcc
+       doins colorgccrc || die
+       einfo "Scanning for compiler front-ends"
+       into /usr/lib/colorgcc/bin
+       for a in gcc cc c++ g++ ${CHOST}-gcc ${CHOST}-c++ ${CHOST}-g++ ; do
+               if [ -n "$(type -p ${a})" ]; then
+                       dosym /usr/bin/colorgcc /usr/lib/colorgcc/bin/${a}
+               fi
+       done
+
+       dodoc CREDITS ChangeLog || die
+}
+
+pkg_postinst() {
+       echo
+       elog "If you have existing \$HOME/.colorgccrc files that set the 
location"
+       elog "of the compilers, you should remove those lines for maximum"
+       elog "flexibility.  The colorgcc script now knows how to pass the 
command"
+       elog "on to the next step in the PATH without manual tweaking, making 
it"
+       elog "easier to use with things like ccache and distcc on a conditional"
+       elog "basis.  You can tweak the /etc/colorgcc/colorgccrc file to change"
+       elog "the default settings for everyone (or copy this file as a basis 
for"
+       elog "a custom \$HOME/.colorgccrc file)."
+       elog
+       elog "NOTE: the symlinks for colorgcc are now located in"
+       elog "/usr/lib/colorgcc/bin *NOT* /usr/bin/wrappers.  You'll need to"
+       elog "change any PATH settings that referred to the old location."
+       echo
+       # portage won't delete the old symlinks for users that are upgrading
+       # because the old symlinks still point to /usr/bin/colorgcc which 
exists...
+       [ -d "${EROOT}"/usr/bin/wrappers ] && rm -fr "${EROOT}"/usr/bin/wrappers
+}

diff --git a/dev-util/colorgcc/files/colorgcc-1.3.2-nohang.patch 
b/dev-util/colorgcc/files/colorgcc-1.3.2-nohang.patch
new file mode 100644
index 0000000..9602146
--- /dev/null
+++ b/dev-util/colorgcc/files/colorgcc-1.3.2-nohang.patch
@@ -0,0 +1,58 @@
+--- /usr/bin/colorgcc  2010-12-13 00:08:37.000000000 -0200
++++ colorgcc   2011-10-05 15:26:53.000000000 -0300
+@@ -221,17 +221,16 @@
+ # Figure out which compiler to invoke based on our program name.
+ $0 =~ m%.*/(.*)$%;
+ my $progName = $1 || $0;
+-my $compiler_pid;
++my $compiler;
+ 
+ # If called as "colorgcc", just filter STDIN to STDOUT.
+-if ($progName eq 'colorgcc')
++if ($progName =~ m/^colorgcc[-0-9.]*(\.pl)?$/)
+ {
+-   open(GCCOUT, "<&STDIN");
++   $compiler = 'gcc';
+ }
+ else
+ {
+    # See if the user asked for a specific compiler.
+-   my $compiler;
+    if (!defined($compiler = $compilerPaths{$progName}))
+    {
+       # Find our wrapper dir on the PATH and tweak the PATH to remove
+@@ -257,23 +256,23 @@
+       }
+       $compiler = $progName;
+    }
++}
+ 
+-   # Get the terminal type. 
+-   my $terminal = $ENV{"TERM"} || "dumb";
++# Get the terminal type. 
++my $terminal = $ENV{"TERM"} || "dumb";
+ 
+-   # If it's in the list of terminal types not to color, or if
+-   # we're writing to something that's not a tty, don't do color.
+-   if (! -t STDOUT || $nocolor{$terminal})
+-   {
++# If it's in the list of terminal types not to color, or if
++# we're writing to something that's not a tty, don't do color.
++if (! -t STDOUT || $nocolor{$terminal})
++{
+       exec $compiler, @ARGV
+        or die("Couldn't exec");
+-   }
+-
+-   # Keep the pid of the compiler process so we can get its return
+-   # code and use that as our return code.
+-   $compiler_pid = open3('<&STDIN', \*GCCOUT, \*GCCOUT, $compiler, @ARGV);
+ }
+ 
++# Keep the pid of the compiler process so we can get its return
++# code and use that as our return code.
++my $compiler_pid = open3('<&STDIN', \*GCCOUT, \*GCCOUT, $compiler, @ARGV);
++
+ # Colorize the output from the compiler.
+ while(<GCCOUT>)
+ {

Reply via email to