Maintainer workflows discussions
 help / color / mirror / Atom feed
* [PATCH v2] ver_linux: add comparison with required version and add rows and colour to output
@ 2026-08-14 14:32 Manuel Ebner
  2026-08-14 18:16 ` Randy Dunlap
  2026-08-14 18:46 ` Jonathan Corbet
  0 siblings, 2 replies; 3+ messages in thread
From: Manuel Ebner @ 2026-08-14 14:32 UTC (permalink / raw)
  To: Manuel Ebner, Jonathan Corbet, Shuah Khan, workflows, open list,
	Geert Uytterhoeven

Add the required version from changes.rst.
Add code for comparison and print '###' in the respective row (good, bad) and in
the respective colour (blue, green, red) depending on the result of the comparison.

Signed-off-by: Manuel Ebner <manuelebnerli@mailbox.org>
---
[v2]
add colour reset as Geert suggested
change output to take colourblindness into account
---
 scripts/ver_linux | 112 ++++++++++++++++++++++++++--------------------
 1 file changed, 63 insertions(+), 49 deletions(-)

diff --git a/scripts/ver_linux b/scripts/ver_linux
index 00bdaf30d590..5488e3d83a4f 100755
--- a/scripts/ver_linux
+++ b/scripts/ver_linux
@@ -8,6 +8,9 @@
 BEGIN {
 	usage = "If some fields are empty or look unusual you may have an old version.\n"
 	usage = usage "Compare to the current minimal requirements in Documentation/process/changes.rst\n"
+	usage = usage "\033[34m BLUE \033[0mmeans there is no required version available,\n"
+	usage = usage "\033[32m GREEN \033[0mmeans the version on your machine is above the requirement,\n"
+	usage = usage "\033[31m RED \033[0mmeans the version on your machine is below the requirement, please update and run again.\n\033[0m"
 	print usage
 
 	system("uname -a")
@@ -17,58 +20,61 @@ BEGIN {
 	libc = "libc[.]so[.][0-9]+$"
 	libcpp = "(libg|stdc)[+]+[.]so([.][0-9]+)+$"
 
-	printversion("bash", version("bash --version"))
-	printversion("bc", version("bc --version"))
-	printversion("bindgen", version("bindgen --version"))
-	printversion("binutils", version("ld -v"))
-	printversion("bison", version("bison --version"))
-	printversion("btrfs-progs", version("btrfs --version"))
-	printversion("Clang", version("clang --version"))
-	printversion("Console-tools", version("loadkeys -V"))
-	printversion("Dynamic linker (ldd)", version("ldd --version"))
-	printversion("e2fsprogs", version("e2fsck -V"))
-	printversion("flex", version("flex --version"))
-	printversion("gdb", version("gdb -version"))
-	printversion("GNU awk", version("gawk --version"))
-	printversion("GNU C", version("gcc -dumpversion"))
-	printversion("GNU make", version("make --version"))
-	printversion("GNU tar", version("tar --version"))
-	printversion("GRUB2", version("grub2-install --version"))
-	printversion("GRUB", version("grub-install --version"))
-	printversion("gtags", version("gtags --version"))
-	printversion("iptables", version("iptables -V"))
-	printversion("Isdn4k-utils", version("isdnctrl"))
-	printversion("jfsutils", version("fsck.jfs -V"))
-	printversion("Kbd", version("loadkeys -V"))
-	printversion("kmod", version("kmod -V"))
+	printf("toolname\t\tcurrent\trequired\tstatus \n")
+	printf("\t\t\tversion\tversion\t\tgood    bad\n")
+
+	printversion("bash", version("bash --version"), "4.2")
+	printversion("bc", version("bc --version"), "1.06.95")
+	printversion("bindgen", version("bindgen --version"), "0.71.1")
+	printversion("binutils", version("ld -v"), "2.30")
+	printversion("bison", version("bison --version"), "2.0")
+	printversion("btrfs-progs", version("btrfs --version"), "0.18")
+	printversion("Clang", version("clang --version"), "17.0.1")
+	printversion("Console-tools", version("loadkeys -V"), "")
+	printversion("Dynamic linker (ldd)", version("ldd --version"), "")
+	printversion("e2fsprogs", version("e2fsck -V"), "1.41.4")
+	printversion("flex", version("flex --version"), "2.5.35")
+	printversion("gdb", version("gdb -version"), "7.2")
+	printversion("GNU awk", version("gawk --version"), "5.1.0")
+	printversion("GNU C", version("gcc -dumpversion"), "8.1")
+	printversion("GNU make", version("make --version"), "4.0")
+	printversion("GNU tar", version("tar --version"), "1.28")
+	printversion("GRUB2", version("grub2-install --version"), "0.93")
+	printversion("GRUB", version("grub-install --version"), "0.93")
+	printversion("gtags", version("gtags --version"), "6.6.5")
+	printversion("iptables", version("iptables -V"), "1.4.2")
+	printversion("Isdn4k-utils", version("isdnctrl"), "")
+	printversion("jfsutils", version("fsck.jfs -V"), "1.1.3")
+	printversion("Kbd", version("loadkeys -V"), "")
+	printversion("kmod", version("kmod -V"), "13")
 
 	while ("ldconfig -p 2>/dev/null" | getline > 0)
 		if ($NF ~ libc || $NF ~ libcpp)
 			if (!seen[ver = version("readlink " $NF)]++)
 				printversion("Linux C" ($NF ~ libcpp? "++" : "") " Library", ver)
 
-	printversion("mcelog", version("mcelog --version"))
-	printversion("mkimage", version("mkimage --version"))
-	printversion("Module-init-tools", version("depmod -V"))
-	printversion("Mount", version("mount --version"))
-	printversion("Net-tools", version("ifconfig --version"))
-	printversion("nfs-utils", version("showmount --version"))
-	printversion("openssl", version("openssl version"))
-	printversion("pahole", version("pahole --version"))
-	printversion("Pcmcia-cs", version("cardmgr -V"))
-	printversion("pcmciautils", version("pccardctl -V"))
-	printversion("PPP", version("pppd --version"))
-	printversion("procps", version("ps --version"))
-	printversion("Python", version("python3 -V"))
-	printversion("quota-tools", version("quota -V"))
-	printversion("Rust", version("rustc --version"))
-	printversion("Sh-utils", version("expr --v"))
-	printversion("Sphinx", version("sphinx-build --version"))
-	printversion("squashfs-tools", version("mksquashfs -version"))
-	printversion("udev", version("udevadm --version"))
-	printversion("util-linux", version("mount --version"))
-	printversion("Wireless-tools", version("iwconfig --version"))
-	printversion("xfsprogs", version("xfs_db -V"))
+	printversion("mcelog", version("mcelog --version"), "0.6 ")
+	printversion("mkimage", version("mkimage --version"), "2017.01")
+	printversion("Module-init-tools", version("depmod -V"), "")
+	printversion("Mount", version("mount --version"), "")
+	printversion("Net-tools", version("ifconfig --version"), "")
+	printversion("nfs-utils", version("showmount --version"), "1.0.5")
+	printversion("openssl", version("openssl version"), "1.0.0")
+	printversion("pahole", version("pahole --version"), "1.26")
+	printversion("Pcmcia-cs", version("cardmgr -V"), "")
+	printversion("pcmciautils", version("pccardctl -V"), "004")
+	printversion("PPP", version("pppd --version"), "2.4.0")
+	printversion("procps", version("ps --version"), "3.2.0")
+	printversion("Python", version("python3 -V"), "3.9.0")
+	printversion("quota-tools", version("quota -V"), "3.09")
+	printversion("Rust", version("rustc --version"), "1.85.0")
+	printversion("Sh-utils", version("expr --v"), "")
+	printversion("Sphinx", version("sphinx-build --version"), "3.4.3")
+	printversion("squashfs-tools", version("mksquashfs -version"), "4.0")
+	printversion("udev", version("udevadm --version"), "081")
+	printversion("util-linux", version("mount --version"), "2.10o")
+	printversion("Wireless-tools", version("iwconfig --version"), "")
+	printversion("xfsprogs", version("xfs_db -V"), "2.6.0")
 
 	while ("sort /proc/modules" | getline > 0) {
 		mods = mods sep $1
@@ -89,9 +95,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,  cur_version"\t"req_version"\t\t\033[34m###\033[0m")
+	}
+	else if (cur_version >= req_version) {
+		ofmt = "%-20s\t%s\n"
+		printf(ofmt, name,  cur_version"\t"req_version"\t\t\033[32m###\033[0m")
+	}
+	else {
 		ofmt = "%-20s\t%s\n"
-		printf(ofmt, name, value)
+		printf(ofmt, name,  cur_version"\t"req_version"\t\t\t\033[31m###\033[0m")
 	}
 }
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] ver_linux: add comparison with required version and add rows and colour to output
  2026-08-14 14:32 [PATCH v2] ver_linux: add comparison with required version and add rows and colour to output Manuel Ebner
@ 2026-08-14 18:16 ` Randy Dunlap
  2026-08-14 18:46 ` Jonathan Corbet
  1 sibling, 0 replies; 3+ messages in thread
From: Randy Dunlap @ 2026-08-14 18:16 UTC (permalink / raw)
  To: Manuel Ebner, Jonathan Corbet, Shuah Khan, workflows, open list,
	Geert Uytterhoeven

Hi,

On 8/14/26 7:32 AM, Manuel Ebner wrote:
> Add the required version from changes.rst.
> Add code for comparison and print '###' in the respective row (good, bad) and in
> the respective colour (blue, green, red) depending on the result of the comparison.
> 

I find the dark blue difficult to read (on a black background).

> Signed-off-by: Manuel Ebner <manuelebnerli@mailbox.org>
> ---
> [v2]
> add colour reset as Geert suggested
> change output to take colourblindness into account
> ---
>  scripts/ver_linux | 112 ++++++++++++++++++++++++++--------------------
>  1 file changed, 63 insertions(+), 49 deletions(-)
> 

Other small-ish issues:

binutils version 2.45.0.20251103-4 doesn't fit into its column.

Not so small issue:

The version number comparison doesn't know/care about decimal points/fractions
etc., so:
gdb                 	16.3	7.2			### <<<<< RED
because 1 < 7.
and
GNU C               	16	8.1			### <<<<< RED
jfsutils            	1.1.15	1.1.3			### <<<<< RED
Python              	3.13.14	3.9.0			### <<<<< RED


-- 
~Randy


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] ver_linux: add comparison with required version and add rows and colour to output
  2026-08-14 14:32 [PATCH v2] ver_linux: add comparison with required version and add rows and colour to output Manuel Ebner
  2026-08-14 18:16 ` Randy Dunlap
@ 2026-08-14 18:46 ` Jonathan Corbet
  1 sibling, 0 replies; 3+ messages in thread
From: Jonathan Corbet @ 2026-08-14 18:46 UTC (permalink / raw)
  To: Manuel Ebner, Manuel Ebner, Shuah Khan, workflows, open list,
	Geert Uytterhoeven

Manuel Ebner <manuelebnerli@mailbox.org> writes:

> Add the required version from changes.rst.
> Add code for comparison and print '###' in the respective row (good, bad) and in
> the respective colour (blue, green, red) depending on the result of the comparison.
>
> Signed-off-by: Manuel Ebner <manuelebnerli@mailbox.org>
> ---
> [v2]
> add colour reset as Geert suggested
> change output to take colourblindness into account

So that suggests you read my previous comments, but didn't see fit to
look at all of them or respond.

*How* are you taking colorblindness into account?  Which type of
colorblindness have you tried to address.  Certainly not red/green
which, I believe, is the most common form.

But, more to the point:

- You do not know that your output is going to a terminal at all, much
  less one that understands these escape sequences.

- You do not know whether that terminal, if it exists, is in dark mode
  or not.

- You don't check NO_COLOR to see whether the user has explicitly asked
  to not have colorized output.

This is a simple script meant to check dependencies, it really does not
need this kind of silliness.  Surely there is something more useful you
could work on?

jon

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-14 18:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-14 14:32 [PATCH v2] ver_linux: add comparison with required version and add rows and colour to output Manuel Ebner
2026-08-14 18:16 ` Randy Dunlap
2026-08-14 18:46 ` Jonathan Corbet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox