Re: [PATCH] ver_linux: add comparison with required version and colour to output

From: Geert Uytterhoeven

Date: Fri Aug 14 2026 - 10:00:30 EST


Hi Manuel,

On Fri, 14 Aug 2026 at 15:55, Manuel Ebner <manuelebnerli@xxxxxxxxxxx> wrote:
> Add the required version from changes.rst.
> Add code for comparison and print in colour (blue, green, red) depending
> on the result of the comparison.
>
> Signed-off-by: Manuel Ebner <manuelebnerli@xxxxxxxxxxx>

Thanks for your patch!

> --- a/scripts/ver_linux
> +++ b/scripts/ver_linux

> @@ -89,9 +92,17 @@ function version(cmd, ver) {
> return ver
> }
>
> -function printversion(name, value, ofmt) {
> - if (value != "") {
> +function printversion(name, cur_version, req_version, ofmt) {
> + if (req_version == "") {
> ofmt = "%-20s\t%s\n"
> - printf(ofmt, name, value)
> + printf(ofmt, "\033[34m"name, cur_version)
> + }
> + else if (cur_version >= req_version) {
> + ofmt = "%-20s\t%s\n"
> + printf(ofmt, "\033[32m"name, cur_version)
> + }
> + else {
> + ofmt = "%-20s\t%s\n"
> + printf(ofmt, "\033[31m"name, cur_version)
> }
> }

None of the above reset the color (using "\033[37m", or the shorter
"\033[0m").

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds