Add a wrapper around `make`

For building Linux kernels. I pipe the output to a colorizing script to
add some nice colors to the build.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
This commit is contained in:
Anna Schumaker 2021-10-20 13:26:27 -04:00
parent 1a5f6eb872
commit 730d42ee7f
2 changed files with 26 additions and 0 deletions

21
colorize.py Normal file
View File

@ -0,0 +1,21 @@
import sys
import termcolor
import re
def colorize(line, pattern, color=None, attrs=None):
if (match := re.search(f"({pattern})", line)):
return re.sub(pattern, termcolor.colored(match[0], color, attrs=attrs), line)
return line
for line in sys.stdin:
line = colorize(line, "^ C[\w]*", "green")
line = colorize(line, "^ ZSTD", "green")
line = colorize(line, "^ SIGN", "cyan")
line = colorize(line, "^ INSTALL", "yellow")
line = colorize(line, "^ LD", "yellow")
line = colorize(line, " \[M\] ", "magenta")
line = colorize(line, "[\w/-]+\.k?o", attrs=["bold"])
line = colorize(line, "^#(.*)", "cyan")
line = colorize(line, "^Kernel(.*)$", attrs=["bold"])
print(line, end="")

5
makelinux.zsh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/zsh
set -eo pipefail
let jobs=$(nproc)-2
make -j$jobs $* | python /home/anna/bin/colorize.py