Re: [PATCH] ver_linux: add comparison with required version and colour to output
Geert Uytterhoeven <[email protected]>
| Newsgroups | org.kernel.vger.workflows,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <CAMuHMdV461YV5jThYgoGAxnZhB3Vf5tAmcm-eML1o-jVRrerBA@mail.gmail.com> |
Hi Manuel, On Fri, 14 Aug 2026 at 15:55, Manuel Ebner <[email protected]> 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 <[email protected]> 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 -- [email protected] 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