Gentoo Archives: gentoo-commits

From: Patrice Clement <monsieurp@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-util/colorgcc/files/, dev-util/colorgcc/
Date: Fri, 25 Sep 2015 20:42:27
Message-Id: 1443213619.bee63f0684a29d18782c8d4c41e0b9dad5046fc0.monsieurp@gentoo
1 commit: bee63f0684a29d18782c8d4c41e0b9dad5046fc0
2 Author: Patrice Clement <monsieurp <AT> gentoo <DOT> org>
3 AuthorDate: Fri Sep 25 20:40:19 2015 +0000
4 Commit: Patrice Clement <monsieurp <AT> gentoo <DOT> org>
5 CommitDate: Fri Sep 25 20:40:19 2015 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bee63f06
7
8 dev-util/colorgcc: Add patch to keep colorgcc from hanging when invoked at the CLI. Fixes bug 234166.
9
10 Package-Manager: portage-2.2.18
11 Signed-off-by: Patrice Clement <monsieurp <AT> gentoo.org>
12
13 dev-util/colorgcc/colorgcc-1.3.2-r7.ebuild | 65 ++++++++++++++++++++++
14 .../colorgcc/files/colorgcc-1.3.2-nohang.patch | 58 +++++++++++++++++++
15 2 files changed, 123 insertions(+)
16
17 diff --git a/dev-util/colorgcc/colorgcc-1.3.2-r7.ebuild b/dev-util/colorgcc/colorgcc-1.3.2-r7.ebuild
18 new file mode 100644
19 index 0000000..2a18254
20 --- /dev/null
21 +++ b/dev-util/colorgcc/colorgcc-1.3.2-r7.ebuild
22 @@ -0,0 +1,65 @@
23 +# Copyright 1999-2015 Gentoo Foundation
24 +# Distributed under the terms of the GNU General Public License v2
25 +# $Id$
26 +
27 +EAPI=5
28 +inherit eutils
29 +
30 +DESCRIPTION="Perl script to colorise the gcc output."
31 +HOMEPAGE="http://schlueters.de/colorgcc.html"
32 +SRC_URI="mirror://gentoo/${P}.tar.gz"
33 +
34 +SLOT="0"
35 +LICENSE="GPL-2"
36 +KEYWORDS="~alpha ~amd64 ~hppa ~mips ~ppc ~sparc ~x86 ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
37 +IUSE=""
38 +
39 +DEPEND="dev-lang/perl"
40 +RDEPEND="${DEPEND}"
41 +
42 +PATCHES=(
43 + "${FILESDIR}"/${P}-gentoo-one.patch
44 + "${FILESDIR}"/${P}-gentoo-two.patch
45 + "${FILESDIR}"/${P}-note.patch
46 + "${FILESDIR}"/${P}-nohang.patch
47 +)
48 +
49 +src_prepare() {
50 + epatch "${PATCHES[@]}"
51 +}
52 +
53 +src_install() {
54 + dobin colorgcc || die
55 + dodir /etc/colorgcc /usr/lib/colorgcc/bin
56 + insinto /etc/colorgcc
57 + doins colorgccrc || die
58 + einfo "Scanning for compiler front-ends"
59 + into /usr/lib/colorgcc/bin
60 + for a in gcc cc c++ g++ ${CHOST}-gcc ${CHOST}-c++ ${CHOST}-g++ ; do
61 + if [ -n "$(type -p ${a})" ]; then
62 + dosym /usr/bin/colorgcc /usr/lib/colorgcc/bin/${a}
63 + fi
64 + done
65 +
66 + dodoc CREDITS ChangeLog || die
67 +}
68 +
69 +pkg_postinst() {
70 + echo
71 + elog "If you have existing \$HOME/.colorgccrc files that set the location"
72 + elog "of the compilers, you should remove those lines for maximum"
73 + elog "flexibility. The colorgcc script now knows how to pass the command"
74 + elog "on to the next step in the PATH without manual tweaking, making it"
75 + elog "easier to use with things like ccache and distcc on a conditional"
76 + elog "basis. You can tweak the /etc/colorgcc/colorgccrc file to change"
77 + elog "the default settings for everyone (or copy this file as a basis for"
78 + elog "a custom \$HOME/.colorgccrc file)."
79 + elog
80 + elog "NOTE: the symlinks for colorgcc are now located in"
81 + elog "/usr/lib/colorgcc/bin *NOT* /usr/bin/wrappers. You'll need to"
82 + elog "change any PATH settings that referred to the old location."
83 + echo
84 + # portage won't delete the old symlinks for users that are upgrading
85 + # because the old symlinks still point to /usr/bin/colorgcc which exists...
86 + [ -d "${EROOT}"/usr/bin/wrappers ] && rm -fr "${EROOT}"/usr/bin/wrappers
87 +}
88
89 diff --git a/dev-util/colorgcc/files/colorgcc-1.3.2-nohang.patch b/dev-util/colorgcc/files/colorgcc-1.3.2-nohang.patch
90 new file mode 100644
91 index 0000000..9602146
92 --- /dev/null
93 +++ b/dev-util/colorgcc/files/colorgcc-1.3.2-nohang.patch
94 @@ -0,0 +1,58 @@
95 +--- /usr/bin/colorgcc 2010-12-13 00:08:37.000000000 -0200
96 ++++ colorgcc 2011-10-05 15:26:53.000000000 -0300
97 +@@ -221,17 +221,16 @@
98 + # Figure out which compiler to invoke based on our program name.
99 + $0 =~ m%.*/(.*)$%;
100 + my $progName = $1 || $0;
101 +-my $compiler_pid;
102 ++my $compiler;
103 +
104 + # If called as "colorgcc", just filter STDIN to STDOUT.
105 +-if ($progName eq 'colorgcc')
106 ++if ($progName =~ m/^colorgcc[-0-9.]*(\.pl)?$/)
107 + {
108 +- open(GCCOUT, "<&STDIN");
109 ++ $compiler = 'gcc';
110 + }
111 + else
112 + {
113 + # See if the user asked for a specific compiler.
114 +- my $compiler;
115 + if (!defined($compiler = $compilerPaths{$progName}))
116 + {
117 + # Find our wrapper dir on the PATH and tweak the PATH to remove
118 +@@ -257,23 +256,23 @@
119 + }
120 + $compiler = $progName;
121 + }
122 ++}
123 +
124 +- # Get the terminal type.
125 +- my $terminal = $ENV{"TERM"} || "dumb";
126 ++# Get the terminal type.
127 ++my $terminal = $ENV{"TERM"} || "dumb";
128 +
129 +- # If it's in the list of terminal types not to color, or if
130 +- # we're writing to something that's not a tty, don't do color.
131 +- if (! -t STDOUT || $nocolor{$terminal})
132 +- {
133 ++# If it's in the list of terminal types not to color, or if
134 ++# we're writing to something that's not a tty, don't do color.
135 ++if (! -t STDOUT || $nocolor{$terminal})
136 ++{
137 + exec $compiler, @ARGV
138 + or die("Couldn't exec");
139 +- }
140 +-
141 +- # Keep the pid of the compiler process so we can get its return
142 +- # code and use that as our return code.
143 +- $compiler_pid = open3('<&STDIN', \*GCCOUT, \*GCCOUT, $compiler, @ARGV);
144 + }
145 +
146 ++# Keep the pid of the compiler process so we can get its return
147 ++# code and use that as our return code.
148 ++my $compiler_pid = open3('<&STDIN', \*GCCOUT, \*GCCOUT, $compiler, @ARGV);
149 ++
150 + # Colorize the output from the compiler.
151 + while(<GCCOUT>)
152 + {