Gentoo Archives: gentoo-commits

From: Sebastian Pipping <sping@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/betagarden:master commit in: sys-devel/make/files/, sys-devel/make/
Date: Mon, 26 Sep 2011 21:07:25
Message-Id: 4a2cc99d48cd6c30df3b95829f76d177f1870d6e.sping@gentoo
1 commit: 4a2cc99d48cd6c30df3b95829f76d177f1870d6e
2 Author: Sebastian Pipping <sebastian <AT> pipping <DOT> org>
3 AuthorDate: Mon Sep 26 21:03:23 2011 +0000
4 Commit: Sebastian Pipping <sping <AT> gentoo <DOT> org>
5 CommitDate: Mon Sep 26 21:06:23 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/betagarden.git;a=commit;h=4a2cc99d
7
8 sys-devel/make: Add colorization patch v1 (keeping revision on purpose)
9
10 ---
11 sys-devel/make/files/make-3.82-color.patch | 141 ++++++++++++++++++++++++++++
12 sys-devel/make/make-3.82-r3.ebuild | 4 +-
13 2 files changed, 144 insertions(+), 1 deletions(-)
14
15 diff --git a/sys-devel/make/files/make-3.82-color.patch b/sys-devel/make/files/make-3.82-color.patch
16 new file mode 100644
17 index 0000000..d6fa0bf
18 --- /dev/null
19 +++ b/sys-devel/make/files/make-3.82-color.patch
20 @@ -0,0 +1,141 @@
21 +From 9cb97d5705658f31ba3c4fb197d8800e3f77aec0 Mon Sep 17 00:00:00 2001
22 +From: Sebastian Pipping <sebastian@×××××××.org>
23 +Date: Mon, 26 Sep 2011 22:54:04 +0200
24 +Subject: [PATCH] Colorize make output (v1)
25 +
26 +---
27 + job.c | 2 +-
28 + main.c | 2 ++
29 + misc.c | 16 +++++++++-------
30 + remake.c | 45 ++++++++++++++++++++++++++++++++++++++++-----
31 + 4 files changed, 52 insertions(+), 13 deletions(-)
32 +
33 +diff --git a/job.c b/job.c
34 +index aacfb84..37017e0 100644
35 +--- a/job.c
36 ++++ b/job.c
37 +@@ -1144,7 +1144,7 @@ start_job_command (struct child *child)
38 + appear. */
39 +
40 + message (0, (just_print_flag || (!(flags & COMMANDS_SILENT) && !silent_flag))
41 +- ? "%s" : (char *) 0, p);
42 ++ ? "\033[1;35m%s\033[0m" : (char *) 0, p);
43 +
44 + /* Tell update_goal_chain that a command has been started on behalf of
45 + this target. It is important that this happens here and not in
46 +diff --git a/main.c b/main.c
47 +index c6989e3..5c6528d 100644
48 +--- a/main.c
49 ++++ b/main.c
50 +@@ -3231,6 +3231,7 @@ log_working_directory (int entering)
51 +
52 + /* Use entire sentences to give the translators a fighting chance. */
53 +
54 ++ printf ("\033[0;36m");
55 + if (makelevel == 0)
56 + if (starting_directory == 0)
57 + if (entering)
58 +@@ -3259,6 +3260,7 @@ log_working_directory (int entering)
59 + else
60 + printf (_("%s[%u]: Leaving directory `%s'\n"),
61 + program, makelevel, starting_directory);
62 ++ printf ("\033[0m");
63 +
64 + /* Flush stdout to be sure this comes before any stderr output. */
65 + fflush (stdout);
66 +diff --git a/misc.c b/misc.c
67 +index 7a6f773..ad31b83 100644
68 +--- a/misc.c
69 ++++ b/misc.c
70 +@@ -236,16 +236,18 @@ message (prefix, fmt, va_alist)
71 + if (fmt != 0)
72 + {
73 + if (prefix)
74 +- {
75 +- if (makelevel == 0)
76 +- printf ("%s: ", program);
77 +- else
78 +- printf ("%s[%u]: ", program, makelevel);
79 +- }
80 ++ {
81 ++ if (makelevel == 0)
82 ++ printf ("\033[36m%s: ", program);
83 ++ else
84 ++ printf ("\033[36m%s[%u]: ", program, makelevel);
85 ++ }
86 ++ else
87 ++ printf ("\033[36m");
88 + VA_START (args, fmt);
89 + VA_PRINTF (stdout, fmt, args);
90 + VA_END (args);
91 +- putchar ('\n');
92 ++ printf ("\n\033[0m");
93 + }
94 +
95 + fflush (stdout);
96 +diff --git a/remake.c b/remake.c
97 +index 27d2550..3babb7a 100644
98 +--- a/remake.c
99 ++++ b/remake.c
100 +@@ -69,6 +69,38 @@ static void remake_file (struct file *file);
101 + static FILE_TIMESTAMP name_mtime (const char *name);
102 + static const char *library_search (const char *lib, FILE_TIMESTAMP *mtime_ptr);
103 +
104 ++/*
105 ++ * Take string <text> and wrap it by <begin> and <end>
106 ++ * The result is malloc'd and has to be free'd.
107 ++ */
108 ++static char * colorize(const char * begin, const char * text, const char * end) {
109 ++ const char * const jobs[] = {begin, text, end};
110 ++ const size_t job_count = sizeof(jobs) / sizeof(char *);
111 ++ size_t job_lens[job_count];
112 ++ size_t out_len = 1;
113 ++ int i = 0;
114 ++
115 ++ /* Count */
116 ++ for (; i < job_count; i++) {
117 ++ job_lens[i] = strlen(jobs[i]);
118 ++ out_len += job_lens[i];
119 ++ }
120 ++
121 ++ /* Allocate */
122 ++ char * const out = malloc(266);
123 ++ assert(out);
124 ++
125 ++ /* Concat */
126 ++ char * walker = out;
127 ++ for (i = 0; i < job_count; i++) {
128 ++ strcpy(walker, jobs[i]);
129 ++ walker += job_lens[i];
130 ++ }
131 ++ walker[0] = '\0';
132 ++
133 ++ return out;
134 ++}
135 ++
136 +
137 + /* Remake all the goals in the `struct dep' chain GOALS. Return -1 if nothing
138 + was done, 0 if all goals were updated successfully, or 1 if a goal failed.
139 +@@ -230,11 +262,14 @@ update_goal_chain (struct dep *goals)
140 + && file->update_status == 0 && !g->changed
141 + /* Never give a message under -s or -q. */
142 + && !silent_flag && !question_flag)
143 +- message (1, ((file->phony || file->cmds == 0)
144 +- ? _("Nothing to be done for `%s'.")
145 +- : _("`%s' is up to date.")),
146 +- file->name);
147 +-
148 ++ {
149 ++ const char * const text = ((file->phony || file->cmds == 0)
150 ++ ? _("Nothing to be done for `%s'.")
151 ++ : _("`%s' is up to date."));
152 ++ char * const colorized = colorize("\033[36m", text, "\033[0m");
153 ++ message (1, colorized, file->name);
154 ++ free (colorized);
155 ++ }
156 + /* This goal is finished. Remove it from the chain. */
157 + if (lastgoal == 0)
158 + goals = g->next;
159 +--
160 +1.7.6.1
161 +
162
163 diff --git a/sys-devel/make/make-3.82-r3.ebuild b/sys-devel/make/make-3.82-r3.ebuild
164 index b1de58f..905f4ac 100644
165 --- a/sys-devel/make/make-3.82-r3.ebuild
166 +++ b/sys-devel/make/make-3.82-r3.ebuild
167 @@ -12,7 +12,7 @@ SRC_URI="mirror://gnu//make/${P}.tar.bz2"
168
169 LICENSE="GPL-3"
170 SLOT="0"
171 -KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
172 +KEYWORDS="~amd64 ~x86"
173 IUSE="nls static"
174
175 DEPEND="nls? ( sys-devel/gettext )"
176 @@ -23,6 +23,8 @@ src_prepare() {
177 epatch "${FILESDIR}"/${P}-MAKEFLAGS-reexec.patch #31975
178 epatch "${FILESDIR}"/${P}-memory-corruption.patch #355907
179 epatch "${FILESDIR}"/${P}-glob-speedup.patch #382845
180 +
181 + epatch "${FILESDIR}"/${P}-color.patch
182 }
183
184 src_configure() {